Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue-445 - control auto-refresh behaviour with a settings property #456

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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