From 8d5a678bb8ff4b3b7de78b82af8ac094c4e6b286 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Mon, 4 Apr 2022 08:17:39 +0200 Subject: [PATCH] #240 - fix snippet action --- src/listeners/general/ModeListener.ts | 9 +++++++-- src/services/ModeSwitch.ts | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/listeners/general/ModeListener.ts b/src/listeners/general/ModeListener.ts index 00a1d758..636499d2 100644 --- a/src/listeners/general/ModeListener.ts +++ b/src/listeners/general/ModeListener.ts @@ -28,6 +28,7 @@ export class ModeListener extends BaseListener { public static async getMode() { const modes = Settings.get(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); + } } \ No newline at end of file diff --git a/src/services/ModeSwitch.ts b/src/services/ModeSwitch.ts index 155128ea..352740d4 100644 --- a/src/services/ModeSwitch.ts +++ b/src/services/ModeSwitch.ts @@ -30,6 +30,8 @@ export class ModeSwitch { ModeSwitch.isInit = true; } + + ModeListener.getMode(); const modes = Settings.get(SETTING_GLOBAL_MODES); if (!modes || modes.length === 0) { @@ -38,7 +40,6 @@ export class ModeSwitch { } ModeSwitch.setText(); - ModeListener.getMode(); } public static getMode(): string {