55
66import * as DOM from 'vs/base/browser/dom' ;
77import { Button } from 'vs/base/browser/ui/button/button' ;
8- import { IAction } from 'vs/base/common/actions' ;
98import * as arrays from 'vs/base/common/arrays' ;
109import { Delayer , ThrottledDelayer } from 'vs/base/common/async' ;
1110import { Color } from 'vs/base/common/color' ;
1211import { getErrorMessage , isPromiseCanceledError } from 'vs/base/common/errors' ;
12+ import { KeyCode } from 'vs/base/common/keyCodes' ;
1313import { TPromise } from 'vs/base/common/winjs.base' ;
1414import 'vs/css!./media/settingsEditor2' ;
1515import { localize } from 'vs/nls' ;
1616import { ConfigurationTarget , IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
17- import { IContextKey } from 'vs/platform/contextkey/common/contextkey' ;
18- import { IContextMenuService , IContextViewService } from 'vs/platform/contextview/browser/contextView' ;
1917import { IEditor } from 'vs/platform/editor/common/editor' ;
2018import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
21- import { WorkbenchList , WorkbenchTree } from 'vs/platform/list/browser/listService' ;
19+ import { WorkbenchTree } from 'vs/platform/list/browser/listService' ;
2220import { ILogService } from 'vs/platform/log/common/log' ;
2321import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
24- import { registerColor } from 'vs/platform/theme/common/colorRegistry' ;
25- import { attachButtonStyler , attachInputBoxStyler , attachSelectBoxStyler , attachStyler } from 'vs/platform/theme/common/styler' ;
26- import { IThemeService , registerThemingParticipant , ICssStyleCollector , ITheme } from 'vs/platform/theme/common/themeService' ;
22+ import { attachButtonStyler } from 'vs/platform/theme/common/styler' ;
23+ import { IThemeService } from 'vs/platform/theme/common/themeService' ;
2724import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor' ;
2825import { EditorOptions } from 'vs/workbench/common/editor' ;
2926import { SearchWidget , SettingsTarget , SettingsTargetsWidget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets' ;
30- import { IPreferencesService , ISearchResult , ISetting , ISettingsEditorModel , ISettingsGroup } from 'vs/workbench/services/preferences/common/preferences' ;
27+ import { ISettingsEditorViewState , SearchResultIdx , SearchResultModel , SettingsAccessibilityProvider , SettingsDataSource , SettingsRenderer , SettingsTreeController , SettingsTreeFilter , TreeElement , TreeItemType } from 'vs/workbench/parts/preferences/browser/settingsTree' ;
28+ import { IPreferencesSearchService , ISearchProvider } from 'vs/workbench/parts/preferences/common/preferences' ;
29+ import { IPreferencesService , ISearchResult , ISettingsEditorModel } from 'vs/workbench/services/preferences/common/preferences' ;
3130import { SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput' ;
3231import { DefaultSettingsEditorModel } from 'vs/workbench/services/preferences/common/preferencesModels' ;
33- import { IPreferencesSearchService , ISearchProvider } from 'vs/workbench/parts/preferences/common/preferences' ;
34- import { KeyCode } from 'vs/base/common/keyCodes' ;
35- import { SettingsRenderer , SettingsDataSource , SettingsTreeController , SettingsAccessibilityProvider , TreeElement , TreeItemType , ISettingsEditorViewState , SearchResultModel , SearchResultIdx , SettingsTreeFilter } from 'vs/workbench/parts/preferences/browser/settingsTree' ;
3632
3733const $ = DOM . $ ;
3834
@@ -52,17 +48,11 @@ export class SettingsEditor2 extends BaseEditor {
5248 private settingsTree : WorkbenchTree ;
5349 private treeDataSource : SettingsDataSource ;
5450
55- private dimension : DOM . Dimension ;
56- private searchFocusContextKey : IContextKey < boolean > ;
57-
5851 private delayedModifyLogging : Delayer < void > ;
5952 private delayedFilterLogging : Delayer < void > ;
6053 private localSearchDelayer : Delayer < void > ;
6154 private remoteSearchThrottle : ThrottledDelayer < void > ;
6255
63- private currentLocalSearchProvider : ISearchProvider ;
64- private currentRemoteSearchProvider : ISearchProvider ;
65-
6656 private pendingSettingModifiedReport : { key : string , value : any } ;
6757
6858 private focusedElement : TreeElement ;
@@ -74,7 +64,6 @@ export class SettingsEditor2 extends BaseEditor {
7464 @ITelemetryService telemetryService : ITelemetryService ,
7565 @IConfigurationService private configurationService : IConfigurationService ,
7666 @IThemeService themeService : IThemeService ,
77- @IContextMenuService contextMenuService : IContextMenuService ,
7867 @IPreferencesService private preferencesService : IPreferencesService ,
7968 @IInstantiationService private instantiationService : IInstantiationService ,
8069 @IPreferencesSearchService private preferencesSearchService : IPreferencesSearchService ,
@@ -107,34 +96,15 @@ export class SettingsEditor2 extends BaseEditor {
10796 } ) ;
10897 }
10998
110- clearInput ( ) : void {
111- super . clearInput ( ) ;
112- }
113-
11499 layout ( dimension : DOM . Dimension ) : void {
115- this . dimension = dimension ;
116100 this . searchWidget . layout ( dimension ) ;
117-
118- this . layoutSettingsList ( ) ;
101+ this . layoutSettingsList ( dimension ) ;
119102 }
120103
121104 focus ( ) : void {
122105 this . searchWidget . focus ( ) ;
123106 }
124107
125- getSecondaryActions ( ) : IAction [ ] {
126- return < IAction [ ] > [
127- ] ;
128- }
129-
130- search ( filter : string ) : void {
131- this . searchWidget . focus ( ) ;
132- }
133-
134- clearSearchResults ( ) : void {
135- this . searchWidget . clear ( ) ;
136- }
137-
138108 private createHeader ( parent : HTMLElement ) : void {
139109 this . headerContainer = DOM . append ( parent , $ ( '.settings-header' ) ) ;
140110
@@ -159,8 +129,7 @@ export class SettingsEditor2 extends BaseEditor {
159129 const searchContainer = DOM . append ( this . headerContainer , $ ( '.search-container' ) ) ;
160130 this . searchWidget = this . _register ( this . instantiationService . createInstance ( SearchWidget , searchContainer , {
161131 ariaLabel : localize ( 'SearchSettings.AriaLabel' , "Search settings" ) ,
162- placeholder : localize ( 'SearchSettings.Placeholder' , "Search settings" ) ,
163- focusKey : this . searchFocusContextKey
132+ placeholder : localize ( 'SearchSettings.Placeholder' , "Search settings" )
164133 } ) ) ;
165134 this . _register ( this . searchWidget . onDidChange ( ( ) => this . onSearchInputChanged ( ) ) ) ;
166135 this . _register ( DOM . addStandardDisposableListener ( this . searchWidget . domNode , 'keydown' , e => {
@@ -294,6 +263,7 @@ export class SettingsEditor2 extends BaseEditor {
294263
295264 private onDidClickShowAllSettings ( ) : void {
296265 this . viewState . showAllSettings = ! this . viewState . showAllSettings ;
266+ this . refreshTree ( ) ;
297267 }
298268
299269 private reportModifiedSetting ( props : { key : string , query : string , searchResults : ISearchResult [ ] , rawResults : ISearchResult [ ] , showConfiguredOnly : boolean , isReset : boolean , settingsTarget : SettingsTarget } ) : void {
@@ -443,13 +413,13 @@ export class SettingsEditor2 extends BaseEditor {
443413 }
444414
445415 private localFilterPreferences ( query : string ) : TPromise < void > {
446- this . currentLocalSearchProvider = this . preferencesSearchService . getLocalSearchProvider ( query ) ;
447- return this . filterOrSearchPreferences ( query , SearchResultIdx . Local , this . currentLocalSearchProvider ) ;
416+ const localSearchProvider = this . preferencesSearchService . getLocalSearchProvider ( query ) ;
417+ return this . filterOrSearchPreferences ( query , SearchResultIdx . Local , localSearchProvider ) ;
448418 }
449419
450420 private remoteSearchPreferences ( query : string ) : TPromise < void > {
451- this . currentRemoteSearchProvider = this . preferencesSearchService . getRemoteSearchProvider ( query ) ;
452- return this . filterOrSearchPreferences ( query , SearchResultIdx . Remote , this . currentRemoteSearchProvider ) ;
421+ const remoteSearchProvider = this . preferencesSearchService . getRemoteSearchProvider ( query ) ;
422+ return this . filterOrSearchPreferences ( query , SearchResultIdx . Remote , remoteSearchProvider ) ;
453423 }
454424
455425 private filterOrSearchPreferences ( query : string , type : SearchResultIdx , searchProvider : ISearchProvider ) : TPromise < void > {
@@ -491,8 +461,8 @@ export class SettingsEditor2 extends BaseEditor {
491461 } ) ;
492462 }
493463
494- private layoutSettingsList ( ) : void {
495- const listHeight = this . dimension . height - ( DOM . getDomNodePagePosition ( this . headerContainer ) . height + 12 /*padding*/ ) ;
464+ private layoutSettingsList ( dimension : DOM . Dimension ) : void {
465+ const listHeight = dimension . height - ( DOM . getDomNodePagePosition ( this . headerContainer ) . height + 12 /*padding*/ ) ;
496466 this . settingsTreeContainer . style . height = `${ listHeight } px` ;
497467 this . settingsTree . layout ( listHeight , 800 ) ;
498468 }
0 commit comments