diff --git a/package.json b/package.json index f92486586..35f1b28bf 100644 --- a/package.json +++ b/package.json @@ -171,6 +171,11 @@ "default": true, "scope": "resource" }, + "pacifica.showNewFilePopup": { + "type": "boolean", + "default": true, + "scope": "resource" + }, "pacifica.debuggerServerPort": { "type": "number", "default": 5577, diff --git a/src/constants.ts b/src/constants.ts index 2dff4dabc..0a2b9f729 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -17,7 +17,8 @@ const localize: nls.LocalizeFunc = nls.config({ })(); export const CONFIG = { - SHOW_DEPENDENCY_INSTALL: "pacifica.showDependencyInstall" + SHOW_DEPENDENCY_INSTALL: "pacifica.showDependencyInstall", + SHOW_NEW_FILE_POPUP: "pacifica.showNewFilePopup" } export const CONSTANTS = { diff --git a/src/extension.ts b/src/extension.ts index 5ff5b0538..bd5c67c8f 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -8,6 +8,7 @@ import * as path from "path"; import * as utils from "./extension_utils/utils"; import * as vscode from "vscode"; import { + CONFIG, CONSTANTS, CPX_CONFIG_FILE, DialogResponses, @@ -237,9 +238,9 @@ export async function activate(context: vscode.ExtensionContext) { const fileName = "template.py"; const filePath = __dirname + path.sep + fileName; const file = fs.readFileSync(filePath, "utf8"); - const shouldShowNewFilePopup: boolean = context.globalState.get("shouldShowNewFilePopup", true); + const showNewFilePopup: boolean = vscode.workspace.getConfiguration().get(CONFIG.SHOW_NEW_FILE_POPUP); - if (shouldShowNewFilePopup) { + if (showNewFilePopup) { vscode.window .showInformationMessage( CONSTANTS.INFO.NEW_FILE, @@ -249,7 +250,7 @@ export async function activate(context: vscode.ExtensionContext) { ) .then((selection: vscode.MessageItem | undefined) => { if (selection === DialogResponses.DONT_SHOW) { - context.globalState.update("shouldShowNewFilePopup", false); + vscode.workspace.getConfiguration().update(CONFIG.SHOW_NEW_FILE_POPUP, false); telemetryAI.trackFeatureUsage( TelemetryEventName.CLICK_DIALOG_DONT_SHOW );