Skip to content
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1921,12 +1921,12 @@
"group": "1_javaactions"
},
{
"when": "explorerResourceIsFolder&&javaLSReady",
"when": "explorerResourceIsFolder&&javaLSReady&&resourceDirname in java.projects",
"command": "java.project.addToSourcePath.command",
"group": "1_javaactions@1"
},
{
"when": "explorerResourceIsFolder&&javaLSReady",
"when": "explorerResourceIsFolder&&javaLSReady&&resourceDirname in java.projects",
"command": "java.project.removeFromSourcePath.command",
"group": "1_javaactions@2"
}
Expand Down
18 changes: 17 additions & 1 deletion src/standardLanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class StandardLanguageClient {

public registerLanguageClientActions(context: ExtensionContext, hasImported: boolean, jdtEventEmitter: EventEmitter<Uri>) {
activationProgressNotification.showProgress();
this.languageClient.onNotification(StatusNotification.type, (report) => {
this.languageClient.onNotification(StatusNotification.type, async (report) => {
// Resolve serverRunning on the first status notification from the server,
// indicating the server process is alive and can accept requests.
apiManager.resolveServerRunningPromise();
Expand Down Expand Up @@ -149,10 +149,17 @@ export class StandardLanguageClient {
apiManager.getApiInstance().onDidClasspathUpdate((projectUri: Uri) => {
checkLombokDependency(context, projectUri);
});
apiManager.getApiInstance().onDidProjectsImport(() => {
updateJavaProjectsContext();
});
apiManager.getApiInstance().onDidProjectsDelete(() => {
updateJavaProjectsContext();
});
// Disable the client-side snippet provider since LS is ready.
snippetCompletionProvider.dispose();
registerDocumentValidationListener(context, this.languageClient);
commands.executeCommand('setContext', 'javaLSReady', true);
updateJavaProjectsContext();
break;
case 'Started':
this.status = ClientStatus.started;
Expand Down Expand Up @@ -844,6 +851,15 @@ export class StandardLanguageClient {
}
}

function updateJavaProjectsContext(): void {
getAllJavaProjects().then((projectUris) => {
const projectPaths = projectUris.map((uriString) => Uri.parse(uriString).fsPath.replace(/[\\/]$/, ''));
commands.executeCommand('setContext', 'java.projects', projectPaths);
}).catch((error) => {
logger.error(error);
});
}

async function showImportFinishNotification(context: ExtensionContext) {
const neverShow: boolean | undefined = context.globalState.get<boolean>("java.neverShowImportFinishNotification");
if (!neverShow) {
Expand Down
Loading