Skip to content

Commit

Permalink
Remove UI-blocking pop-up in LSWrapper.getInitializedServer() (#951)
Browse files Browse the repository at this point in the history
This commit follows up on the discussion started at
#947 (comment).

It removes the UI-blocking pop-up window that would appear when calling
org.eclipse.lsp4e.LanguageServerWrapper.getInitializedServer()
from a UI thread.

A progress indicator reflecting the status of the server's
initialization will still be displayed in the "Progress" view.
  • Loading branch information
joaodinissf committed Apr 3, 2024
1 parent 83954d5 commit 58b0873
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
import org.eclipse.lsp4e.internal.SupportedFeatures;
import org.eclipse.lsp4e.server.StreamConnectionProvider;
import org.eclipse.lsp4e.ui.Messages;
import org.eclipse.lsp4e.ui.UI;
import org.eclipse.lsp4j.ClientCapabilities;
import org.eclipse.lsp4j.ClientInfo;
import org.eclipse.lsp4j.CodeActionOptions;
Expand Down Expand Up @@ -108,7 +107,6 @@
import org.eclipse.lsp4j.services.LanguageServer;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;

import com.google.common.base.Functions;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
Expand Down Expand Up @@ -792,16 +790,9 @@ protected CompletableFuture<LanguageServer> getInitializedServer() {
LanguageServerPlugin.logError(ex);
}

if (initializeFuture != null && !this.initializeFuture.isDone()) {
if (Display.getCurrent() != null) { // UI Thread
final Job waitForInitialization = createInitializeLanguageServerJob();
waitForInitialization.setUser(true);
waitForInitialization.setSystem(false);
PlatformUI.getWorkbench().getProgressService().showInDialog(UI.getActiveShell(), waitForInitialization);
}
if (initializeFuture != null) {
return initializeFuture.thenApply(r -> this.languageServer);
}
final CompletableFuture<Void> currentInitializeFuture = initializeFuture;
if (currentInitializeFuture != null && !currentInitializeFuture.isDone()) {
return currentInitializeFuture.thenApply(r -> this.languageServer);
}
return CompletableFuture.completedFuture(this.languageServer);
}
Expand Down

0 comments on commit 58b0873

Please sign in to comment.