From 93cfe58e5963cbb87aa3761084198bacdb9bb04f Mon Sep 17 00:00:00 2001 From: Nilesh Date: Sat, 7 Jul 2018 21:28:04 +0530 Subject: [PATCH] keybindingsEditor GUI follows settings now. --- .../parts/preferences/browser/keybindingsEditor.ts | 1 + .../services/preferences/browser/preferencesService.ts | 10 +++++++++- .../preferences/common/preferencesEditorInput.ts | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts b/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts index 4d91fd39cb5..0ac81a6c8ac 100644 --- a/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts +++ b/src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts @@ -110,6 +110,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor } setInput(input: KeybindingsEditorInput, options: EditorOptions, token: CancellationToken): Thenable { + this.searchWidget.setValue(input.defaultSearchValue); return super.setInput(input, options, token) .then(() => this.render(options && options.preserveFocus, token)); } diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index e2ddd17755c..6c4bf2ed9fe 100644 --- a/src/vs/workbench/services/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/services/preferences/browser/preferencesService.ts @@ -243,7 +243,15 @@ export class PreferencesService extends Disposable implements IPreferencesServic return this.editorService.openEditor({ resource: editableKeybindings, options: { pinned: true } }).then(editors => void 0); }); } - return this.editorService.openEditor(this.instantiationService.createInstance(KeybindingsEditorInput), { pinned: true }).then(() => null); + + const keybindingsEditorInput = this.instantiationService.createInstance(KeybindingsEditorInput); + if (openDefaultKeybindings) { + keybindingsEditorInput.setDefaultSearchValue('@source:uesr'); + } else { + keybindingsEditorInput.setDefaultSearchValue(); + } + + return this.editorService.openEditor(keybindingsEditorInput, { pinned: true }).then(() => null); } openRawDefaultKeybindings(): TPromise { diff --git a/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts b/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts index b81ca559188..0faa13eea81 100644 --- a/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts +++ b/src/vs/workbench/services/preferences/common/preferencesEditorInput.ts @@ -56,6 +56,7 @@ export class KeybindingsEditorInput extends EditorInput { public static readonly ID: string = 'workbench.input.keybindings'; public readonly keybindingsModel: KeybindingsEditorModel; + public defaultSearchValue: string; constructor(@IInstantiationService instantiationService: IInstantiationService) { super(); @@ -77,6 +78,10 @@ export class KeybindingsEditorInput extends EditorInput { matches(otherInput: any): boolean { return otherInput instanceof KeybindingsEditorInput; } + + setDefaultSearchValue(defaultSearchValue = ''): void { + this.defaultSearchValue = defaultSearchValue; + } } export class SettingsEditor2Input extends EditorInput { -- GitLab