Skip to content

Commit

Permalink
control auto-refresh behaviour with a settings property
Browse files Browse the repository at this point in the history
  • Loading branch information
sdehors-ibm committed Dec 20, 2024
1 parent f8cdd5c commit dcb7383
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Expand Down
15 changes: 10 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dcb7383

Please sign in to comment.