@@ -23,6 +23,7 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c
2323import { IContextMenuService } from 'vs/platform/contextview/browser/contextView' ;
2424import { IEnvironmentService } from 'vs/platform/environment/common/environment' ;
2525import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
26+ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
2627import { WorkbenchTree } from 'vs/platform/list/browser/listService' ;
2728import { ILogService } from 'vs/platform/log/common/log' ;
2829import { INotificationService } from 'vs/platform/notification/common/notification' ;
@@ -41,11 +42,11 @@ import { ISettingLinkClickEvent, resolveExtensionsSettings, resolveSettingsTree,
4142import { ISettingsEditorViewState , MODIFIED_SETTING_TAG , ONLINE_SERVICES_SETTING_TAG , parseQuery , SearchResultIdx , SearchResultModel , SettingsTreeGroupElement , SettingsTreeModel , SettingsTreeSettingElement } from 'vs/workbench/parts/preferences/browser/settingsTreeModels' ;
4243import { settingsTextInputBorder } from 'vs/workbench/parts/preferences/browser/settingsWidgets' ;
4344import { TOCRenderer , TOCTree , TOCTreeModel } from 'vs/workbench/parts/preferences/browser/tocTree' ;
44- import { SETTINGS_EDITOR_COMMAND_SHOW_CONTEXT_MENU , CONTEXT_SETTINGS_EDITOR , CONTEXT_SETTINGS_SEARCH_FOCUS , CONTEXT_TOC_ROW_FOCUS , IPreferencesSearchService , ISearchProvider } from 'vs/workbench/parts/preferences/common/preferences' ;
45- import { IPreferencesService , ISearchResult , ISettingsEditorModel , SettingsEditorOptions , ISettingsEditorOptions } from 'vs/workbench/services/preferences/common/preferences' ;
45+ import { CONTEXT_SETTINGS_EDITOR , CONTEXT_SETTINGS_SEARCH_FOCUS , CONTEXT_TOC_ROW_FOCUS , IPreferencesSearchService , ISearchProvider , SETTINGS_EDITOR_COMMAND_SHOW_CONTEXT_MENU } from 'vs/workbench/parts/preferences/common/preferences' ;
46+ import { IPreferencesService , ISearchResult , ISettingsEditorModel , ISettingsEditorOptions , SettingsEditorOptions } from 'vs/workbench/services/preferences/common/preferences' ;
4647import { SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput' ;
4748import { Settings2EditorModel } from 'vs/workbench/services/preferences/common/preferencesModels' ;
48- import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
49+
4950const $ = DOM . $ ;
5051
5152export class SettingsEditor2 extends BaseEditor {
@@ -98,6 +99,7 @@ export class SettingsEditor2 extends BaseEditor {
9899 private searchFocusContextKey : IContextKey < boolean > ;
99100
100101 private scheduledRefreshes : Map < string , DOM . IFocusTracker > ;
102+ private lastFocusedSettingElement : string ;
101103
102104 /** Don't spam warnings */
103105 private hasWarnedMissingSettings : boolean ;
@@ -239,6 +241,17 @@ export class SettingsEditor2 extends BaseEditor {
239241 }
240242
241243 focus ( ) : void {
244+ if ( this . lastFocusedSettingElement ) {
245+ const elements = this . settingsTreeRenderer . getDOMElementsForSettingKey ( this . settingsTree . getHTMLElement ( ) , this . lastFocusedSettingElement ) ;
246+ if ( elements . length ) {
247+ const control = elements [ 0 ] . querySelector ( SettingsRenderer . CONTROL_SELECTOR ) ;
248+ if ( control ) {
249+ ( < HTMLElement > control ) . focus ( ) ;
250+ return ;
251+ }
252+ }
253+ }
254+
242255 this . focusSearch ( ) ;
243256 }
244257
@@ -535,6 +548,7 @@ export class SettingsEditor2 extends BaseEditor {
535548 } ) ) ;
536549 this . _register ( this . settingsTreeRenderer . onDidClickSettingLink ( settingName => this . onDidClickSetting ( settingName ) ) ) ;
537550 this . _register ( this . settingsTreeRenderer . onDidFocusSetting ( element => {
551+ this . lastFocusedSettingElement = element . setting . key ;
538552 this . settingsTree . reveal ( element ) ;
539553 } ) ) ;
540554
0 commit comments