#240 - fix snippet action

This commit is contained in:
Elio Struyf
2022-04-04 08:17:39 +02:00
parent 8d901105bf
commit 8d5a678bb8
2 changed files with 9 additions and 3 deletions
+7 -2
View File
@@ -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;
}
@@ -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);
}
}
+2 -1
View File
@@ -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) {
@@ -38,7 +40,6 @@ export class ModeSwitch {
}
ModeSwitch.setText();
ModeListener.getMode();
}
public static getMode(): string {