Skip to content

Commit

Permalink
#240 - fix snippet action
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Apr 4, 2022
1 parent 8d90110 commit 8d5a678
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/listeners/general/ModeListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class ModeListener extends BaseListener {
public static async getMode() {
const modes = Settings.get<Mode[]>(SETTING_GLOBAL_MODES);
if (!modes || modes.length === 0) {
await this.resetEnablement();
return;
}

Expand All @@ -46,8 +47,12 @@ export class ModeListener extends BaseListener {
this.sendMsg(GeneralCommands.setMode as any, undefined);

// Enable dashboards
await commands.executeCommand('setContext', CONTEXT.isSnippetsDashboardEnabled, true);
await commands.executeCommand('setContext', CONTEXT.isDataDashboardEnabled, true);
await this.resetEnablement();
}
}

public static async resetEnablement() {
await commands.executeCommand('setContext', CONTEXT.isSnippetsDashboardEnabled, true);
await commands.executeCommand('setContext', CONTEXT.isDataDashboardEnabled, true);
}
}
3 changes: 2 additions & 1 deletion src/services/ModeSwitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export class ModeSwitch {

ModeSwitch.isInit = true;
}

ModeListener.getMode();

const modes = Settings.get<string | null>(SETTING_GLOBAL_MODES);
if (!modes || modes.length === 0) {
Expand All @@ -38,7 +40,6 @@ export class ModeSwitch {
}

ModeSwitch.setText();
ModeListener.getMode();
}

public static getMode(): string {
Expand Down

0 comments on commit 8d5a678

Please sign in to comment.