提交 f0278ff4 编写于 作者: R Rob Lourens

Fix #54768 - Copy current search to json editor for "Open settings.json"

上级 00649474
......@@ -286,7 +286,14 @@ export class SettingsEditor2 extends BaseEditor {
this));
actions.push(new Separator());
}
actions.push(this.instantiationService.createInstance(OpenSettingsAction));
actions.push(new Action('settings.openSettingsJson', localize('openSettingsJsonLabel', "Open settings.json"), undefined, undefined, () => {
return this.openSettingsFile().then(editor => {
const currentSearch = this.searchWidget.getValue();
if (editor instanceof PreferencesEditor && currentSearch) {
editor.focusSearch(currentSearch);
}
});
}));
this.toolbar.setActions([], actions)();
this.toolbar.context = <ISettingsToolbarContext>{ target: this.settingsTargetsWidget.settingsTarget };
......@@ -980,36 +987,6 @@ interface ISettingsToolbarContext {
target: SettingsTarget;
}
class OpenSettingsAction extends Action {
static readonly ID = 'settings.openSettingsJson';
static readonly LABEL = localize('openSettingsJsonLabel', "Open settings.json");
constructor(
@IPreferencesService private readonly preferencesService: IPreferencesService,
) {
super(OpenSettingsAction.ID, OpenSettingsAction.LABEL, 'open-settings-json');
}
run(context?: ISettingsToolbarContext): TPromise<void> {
return this._run(context)
.then(() => { });
}
private _run(context?: ISettingsToolbarContext): TPromise<any> {
const target = context && context.target;
if (target === ConfigurationTarget.USER) {
return this.preferencesService.openGlobalSettings(true);
} else if (target === ConfigurationTarget.WORKSPACE) {
return this.preferencesService.openWorkspaceSettings(true);
} else if (URI.isUri(target)) {
return this.preferencesService.openFolderSettings(target, true);
}
return TPromise.wrap(null);
}
}
class FilterByTagAction extends Action {
static readonly ID = 'settings.filterByTag';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册