From 8930f17e259d08ac39da6fd9744ae245adc4d2e6 Mon Sep 17 00:00:00 2001 From: Sheng Chen Date: Wed, 14 Aug 2024 12:51:39 +0800 Subject: [PATCH] enhancement - Support onBuildShowMessage for BSP client --- .../gradle/bs/importer/GradleBuildClient.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/GradleBuildClient.java b/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/GradleBuildClient.java index e390e065c..2773c107b 100644 --- a/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/GradleBuildClient.java +++ b/extension/jdtls.ext/com.microsoft.gradle.bs.importer/src/com/microsoft/gradle/bs/importer/GradleBuildClient.java @@ -20,6 +20,7 @@ import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.ProjectUtils; import org.eclipse.lsp4j.ExecuteCommandParams; +import org.eclipse.lsp4j.MessageParams; import org.eclipse.lsp4j.ProgressParams; import org.eclipse.lsp4j.WorkDoneProgressBegin; import org.eclipse.lsp4j.WorkDoneProgressCreateParams; @@ -100,9 +101,16 @@ public void onBuildPublishDiagnostics(PublishDiagnosticsParams arg0) { } @Override - public void onBuildShowMessage(ShowMessageParams arg0) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'onBuildShowMessage'"); + public void onBuildShowMessage(ShowMessageParams params) { + org.eclipse.lsp4j.MessageType type = switch (params.getType()) { + case ERROR -> org.eclipse.lsp4j.MessageType.Error; + case WARNING -> org.eclipse.lsp4j.MessageType.Warning; + case INFORMATION -> org.eclipse.lsp4j.MessageType.Info; + case LOG -> org.eclipse.lsp4j.MessageType.Log; + default -> throw new IllegalArgumentException("Unsupported message type: " + params.getType()); + }; + MessageParams messageParams = new MessageParams(type, params.getMessage()); + this.lsClient.showMessage(messageParams); } @Override