Skip to content

Commit

Permalink
feat: Register the project delete event (#802)
Browse files Browse the repository at this point in the history
Signed-off-by: Sheng Chen <[email protected]>
  • Loading branch information
jdneo authored Nov 29, 2023
1 parent a0dcf41 commit 465fb8e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/languageServerApi/languageServerApiManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ class LanguageServerApiManager {
}));
}

if (extensionApi.onDidProjectsDelete) {
const onDidProjectsDelete: Event<Uri[]> = extensionApi.onDidProjectsDelete;
contextManager.context.subscriptions.push(onDidProjectsDelete(() => {
commands.executeCommand(Commands.VIEW_PACKAGE_INTERNAL_REFRESH, /* debounce = */true);
syncHandler.updateFileWatcher(Settings.autoRefresh());
}));

}

if (this.extensionApi?.serverMode === LanguageServerMode.LightWeight) {
if (extensionApi.onDidServerModeChange) {
const onDidServerModeChange: Event<string> = extensionApi.onDidServerModeChange;
Expand Down
4 changes: 1 addition & 3 deletions src/views/dependencyDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,7 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> {
this._rootItems = rootItems;
}
}
if (_.isEmpty(rootItems)) {
contextManager.setContextValue(Context.NO_JAVA_PROJECT, true);
}
contextManager.setContextValue(Context.NO_JAVA_PROJECT, _.isEmpty(rootItems));
return rootItems;
} finally {
explorerLock.release();
Expand Down

0 comments on commit 465fb8e

Please sign in to comment.