From 75cbb61e968dbadc953de4c8531cc971b3ee8a58 Mon Sep 17 00:00:00 2001 From: azerr Date: Wed, 23 Oct 2024 15:17:45 +0200 Subject: [PATCH] chore: consume Quarkus LS to benefit with Ollama support Signed-off-by: azerr --- .../devtools/intellij/quarkus/lsp/QuarkusLanguageClient.java | 4 +++- .../redhat/devtools/intellij/quarkus/lsp/QuarkusServer.java | 5 +++-- .../devtools/intellij/qute/lsp/QuteLanguageClient.java | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) 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 760d42dd8..1cb5c1f66 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 @@ -76,7 +76,9 @@ public QuarkusLanguageClient(Project project) { @Override public void dispose() { super.dispose(); - connection.disconnect(); + if (connection != null) { + connection.disconnect(); + } UserDefinedMicroProfileSettings.getInstance(getProject()).removeChangeHandler(getDidChangeConfigurationListener()); } diff --git a/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusServer.java b/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusServer.java index d15e28242..37ff2f90b 100644 --- a/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusServer.java +++ b/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusServer.java @@ -23,6 +23,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; import java.nio.file.Path; import java.util.Arrays; import java.util.HashMap; @@ -49,9 +50,9 @@ public QuarkusServer(Project project) { Path quarkusServerPath = pluginPath.resolve("lib/server/com.redhat.quarkus.ls.jar"); List commands = new JavaProcessCommandBuilder(project, "microprofile") - .setJar(lsp4mpServerPath.toString()) - .setCp(quarkusServerPath.toString()) + .setCp(lsp4mpServerPath.toString() + File.pathSeparatorChar + quarkusServerPath.toString()) .create(); + commands.add("org.eclipse.lsp4mp.ls.MicroProfileServerLauncher"); commands.add("-DrunAsync=true"); super.setCommands(commands); diff --git a/src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteLanguageClient.java b/src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteLanguageClient.java index 4e42da15f..8d51d139e 100644 --- a/src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteLanguageClient.java +++ b/src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteLanguageClient.java @@ -67,7 +67,9 @@ public QuteLanguageClient(Project project) { @Override public void dispose() { super.dispose(); - connection.disconnect(); + if (connection != null) { + connection.disconnect(); + } UserDefinedQuteSettings.getInstance(getProject()).removeChangeHandler(getDidChangeConfigurationListener()); }