diff --git a/src/vs/workbench/parts/preferences/browser/preferencesEditor.ts b/src/vs/workbench/parts/preferences/browser/preferencesEditor.ts index 4e38ab78809069de235433fcc1b03320b586218d..8451812db5acfaacaa83eb6e833a12137693f569 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesEditor.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesEditor.ts @@ -168,7 +168,10 @@ export class PreferencesEditor extends BaseEditor { this.searchWidget.focus(); } - public focusSearch(): void { + public focusSearch(filter?: string): void { + if (filter !== null) { + this.searchWidget.setValue(filter); + } this.searchWidget.focus(); } diff --git a/src/vs/workbench/parts/search/browser/searchViewlet.ts b/src/vs/workbench/parts/search/browser/searchViewlet.ts index a80ddee1837a382f404297a43c3dc9029ccbf767..1aaebaee8160c81b9ca8d27893ee579df64cb954 100644 --- a/src/vs/workbench/parts/search/browser/searchViewlet.ts +++ b/src/vs/workbench/parts/search/browser/searchViewlet.ts @@ -61,6 +61,7 @@ import { attachListStyler } from 'vs/platform/theme/common/styler'; import { IOutputService } from 'vs/workbench/parts/output/common/output'; import { Color } from 'vs/base/common/color'; import { getOutOfWorkspaceEditorResources } from 'vs/workbench/parts/search/common/search'; +import { PreferencesEditor } from "vs/workbench/parts/preferences/browser/preferencesEditor"; export class SearchViewlet extends Viewlet { @@ -1081,11 +1082,12 @@ export class SearchViewlet extends Viewlet { }).on(dom.EventType.CLICK, (e: MouseEvent) => { dom.EventHelper.stop(e, false); - if (this.contextService.hasWorkspace()) { - this.preferencesService.openWorkspaceSettings().done(() => null, errors.onUnexpectedError); - } else { - this.preferencesService.openGlobalSettings().done(() => null, errors.onUnexpectedError); - } + let editorPromise = this.contextService.hasWorkspace() ? this.preferencesService.openWorkspaceSettings() : this.preferencesService.openGlobalSettings(); + editorPromise.done(editor => { + if (editor instanceof PreferencesEditor) { + editor.focusSearch('.exclude'); + } + }, errors.onUnexpectedError); }); }