diff --git a/src/languageServerApi/languageServerApiManager.ts b/src/languageServerApi/languageServerApiManager.ts index 3aa77e76..494c08a4 100644 --- a/src/languageServerApi/languageServerApiManager.ts +++ b/src/languageServerApi/languageServerApiManager.ts @@ -65,6 +65,15 @@ class LanguageServerApiManager { })); } + if (extensionApi.onDidProjectsDelete) { + const onDidProjectsDelete: Event = 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 = extensionApi.onDidServerModeChange; diff --git a/src/views/dependencyDataProvider.ts b/src/views/dependencyDataProvider.ts index 00f0827f..72c4cf55 100644 --- a/src/views/dependencyDataProvider.ts +++ b/src/views/dependencyDataProvider.ts @@ -197,9 +197,7 @@ export class DependencyDataProvider implements TreeDataProvider { 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();