From dcb7383b6148f19d26beb6030924475026475f2e Mon Sep 17 00:00:00 2001 From: Sylvain Dehors Date: Fri, 20 Dec 2024 15:04:38 +0100 Subject: [PATCH] control auto-refresh behaviour with a settings property --- package.json | 6 ++++++ src/extension.ts | 15 ++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4ca69f55..28fb7896 100644 --- a/package.json +++ b/package.json @@ -216,6 +216,12 @@ "default": false, "description": "If this value is true, and if the setting java.home has a value, then the environment variable JAVA_HOME will be set to the value of java.home when a new terminal window is created.", "scope": "window" + }, + "liberty.refresh.enabled": { + "type": "boolean", + "default": true, + "description": "If this value is false the extension will not try to refresh the liberty dashboard upon changes in the workspace.", + "scope": "window" } } } diff --git a/src/extension.ts b/src/extension.ts index 07a0a9bb..816075d2 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -106,9 +106,12 @@ function bindRequest(request: string) { function registerCommands(context: ExtensionContext) { let projectProvider = getProjectProvider(context); + const refreshEnabled: any = helperUtil.getConfiguration("refresh.enabled"); - if (vscode.workspace.workspaceFolders !== undefined) { - registerFileWatcher(projectProvider); + if (vscode.workspace.workspaceFolders !== undefined) { + if(refreshEnabled) { + registerFileWatcher(projectProvider); + } vscode.window.registerTreeDataProvider("liberty-dev", projectProvider); } @@ -163,9 +166,11 @@ function registerCommands(context: ExtensionContext) { }) ); // Listens for any new folders are added to the workspace - context.subscriptions.push(vscode.workspace.onDidChangeWorkspaceFolders((event) => { - projectProvider.refresh(); - })); + if(refreshEnabled) { + context.subscriptions.push(vscode.workspace.onDidChangeWorkspaceFolders((event) => { + projectProvider.refresh(); + })); + } } // this method is called when your extension is deactivated