From b598513a5ec9deaa3824c50ff01327c1c4532b86 Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Fri, 30 Jun 2023 09:43:51 +0200 Subject: [PATCH] feat: update to lsp4mp 0.8.0 and quarkus-ls 0.15.0 Signed-off-by: Fred Bricon --- gradle.properties | 4 ++-- .../lsp4ij/LanguageServiceAccessor.java | 4 ++++ .../psi/core/ProjectLabelManager.java | 2 +- .../quarkus/lsp/QuarkusLanguageClient.java | 22 +++++++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 301dc2e92..b04c3f30f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,6 @@ projectVersion=1.21.1-SNAPSHOT jetBrainsToken=invalid jetBrainsChannel=stable quarkusVersion=3.1.2.Final -lsp4mpVersion=0.7.1 -quarkusLsVersion=0.14.1 +lsp4mpVersion=0.8.0 +quarkusLsVersion=0.15.0 kotlin.stdlib.default.dependency = false diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4ij/LanguageServiceAccessor.java b/src/main/java/com/redhat/devtools/intellij/lsp4ij/LanguageServiceAccessor.java index a7d8c62aa..25ea48cdf 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4ij/LanguageServiceAccessor.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4ij/LanguageServiceAccessor.java @@ -6,11 +6,13 @@ import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.module.Module; +import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.vfs.VirtualFile; import com.redhat.devtools.intellij.lsp4ij.server.StreamConnectionProvider; import org.eclipse.lsp4j.ServerCapabilities; +import org.eclipse.lsp4j.TextDocumentIdentifier; import org.eclipse.lsp4j.services.LanguageServer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -586,6 +588,8 @@ public CompletableFuture>> getL res.add(new Pair(wrapper, server)); } })).toArray(CompletableFuture[]::new)).thenApply(theVoid -> res); + } catch (final ProcessCanceledException cancellation) { + throw cancellation; } catch (final Exception e) { LOGGER.warn(e.getLocalizedMessage(), e); } diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/ProjectLabelManager.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/ProjectLabelManager.java index 0e579708c..83f0be3cd 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/ProjectLabelManager.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/ProjectLabelManager.java @@ -90,7 +90,7 @@ public ProjectLabelInfoEntry getProjectLabelInfo(MicroProfileJavaProjectLabelsPa try { VirtualFile file = utils.findFile(params.getUri()); if (file == null) { - // The uri doesn't belong to an Eclipse project + // The uri doesn't belong to an IDEA project return ProjectLabelInfoEntry.EMPTY_PROJECT_INFO; } Module module = utils.getModule(file); diff --git a/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusLanguageClient.java b/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusLanguageClient.java index 2f0e9fd5b..e48ea07b3 100644 --- a/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusLanguageClient.java +++ b/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusLanguageClient.java @@ -147,6 +147,11 @@ public CompletableFuture getJavaProjectLabels(MicroProfil return runAsBackground("Computing Java projects labels", monitor -> ProjectLabelManager.getInstance().getProjectLabelInfo(javaParams, PsiUtilsLSImpl.getInstance(getProject()))); } + @Override + public CompletableFuture> getAllJavaProjectLabels() { + return runAsBackground("Computing All Java projects labels", monitor -> ProjectLabelManager.getInstance().getProjectLabelInfo(PsiUtilsLSImpl.getInstance(getProject()))); + } + @Override public CompletableFuture getJavaFileInfo(MicroProfileJavaFileInfoParams javaParams) { return runAsBackground("Computing Java file info", monitor -> PropertiesManagerForJava.getInstance().fileInfo(javaParams, PsiUtilsLSImpl.getInstance(getProject()))); @@ -185,4 +190,21 @@ public CompletableFuture resolveCodeAction(CodeAction unresolved) { return (CodeAction) PropertiesManagerForJava.getInstance().resolveCodeAction(unresolved, PsiUtilsLSImpl.getInstance(getProject())); }); } + + @Override + public CompletableFuture getJavaCursorContext(MicroProfileJavaCompletionParams params) { + return runAsBackground("Computing Java Cursor context", monitor -> PropertiesManagerForJava.getInstance().javaCursorContext(params, PsiUtilsLSImpl.getInstance(getProject()))); + } + + @Override + public CompletableFuture> getJavaWorkspaceSymbols(String projectUri) { + //Workspace symbols not supported yet https://github.com/redhat-developer/intellij-quarkus/issues/808 + return CompletableFuture.completedFuture(null); + } + + @Override + public CompletableFuture getPropertyDocumentation(MicroProfilePropertyDocumentationParams params) { + // Requires porting https://github.com/eclipse/lsp4mp/issues/321 / https://github.com/eclipse/lsp4mp/pull/329 + return CompletableFuture.completedFuture(null); + } }