Skip to content

Commit

Permalink
fix: trigger suggest correctly while open settings.json
Browse files Browse the repository at this point in the history
  • Loading branch information
erha19 committed Apr 21, 2022
1 parent 11a8201 commit 88042cb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/preferences/src/browser/preference-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ export class PreferenceContribution
});

commands.registerCommand(PREFERENCE_COMMANDS.OPEN_USER_SETTING_FILE, {
execute: async () => {
execute: () => {
this.openResource(PreferenceScope.User);
},
});

commands.registerCommand(PREFERENCE_COMMANDS.OPEN_WORKSPACE_SETTING_FILE, {
execute: async () => {
execute: () => {
this.openResource(PreferenceScope.Workspace);
},
});
Expand Down Expand Up @@ -315,11 +315,15 @@ export class PreferenceContribution
}
}

async openResource(scope?: PreferenceScope, preferenceId?: string) {
async openResource(scope?: PreferenceScope, preferenceId?: string, groupIndex?: number) {
const url = await this.preferenceService.getCurrentPreferenceUrl(scope);
const openResult = await this.commandService.executeCommand<IResourceOpenResult>(
EDITOR_COMMANDS.OPEN_RESOURCE.id,
new URI(url),
{
focus: true,
groupIndex: this.workbenchEditorService.currentEditorGroup.index,
},
);
if (openResult && preferenceId) {
const editor = this.workbenchEditorService.editorGroups.find((g) => g.name === openResult.groupId)?.currentEditor;
Expand Down

0 comments on commit 88042cb

Please sign in to comment.