Skip to content
Open
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
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