From a8f9aef46ff94b04f3473538cf9189933635cef2 Mon Sep 17 00:00:00 2001 From: Tymko Oleg Date: Tue, 1 Dec 2020 18:53:12 +0700 Subject: [PATCH] =?UTF-8?q?#113=20/=20=D0=9E=D1=82=D0=BA=D0=B0=D0=B7=20?= =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20source?= =?UTF-8?q?=20=D0=B2=20=D0=B4=D0=B8=D0=B0=D0=B3=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=D0=BA=D0=B5,=20=D0=BF=D1=80=D0=B5=D0=B4=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20source=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=D0=B0=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=84=D0=BE=D1=80=D0=BC=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../otymko/phoenixbsl/gui/stage/IssuesStage.java | 3 ++- .../github/otymko/phoenixbsl/logic/PhoenixAPI.java | 11 +++++++++++ .../phoenixbsl/logic/lsp/BSLLanguageClient.java | 4 +--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/otymko/phoenixbsl/gui/stage/IssuesStage.java b/src/main/java/com/github/otymko/phoenixbsl/gui/stage/IssuesStage.java index 06c9a4a..cbdc60c 100644 --- a/src/main/java/com/github/otymko/phoenixbsl/gui/stage/IssuesStage.java +++ b/src/main/java/com/github/otymko/phoenixbsl/gui/stage/IssuesStage.java @@ -214,7 +214,8 @@ public void updateIssues(List diagnostics) { var startLine = position.getLine() + 1 + lineOffset; Issue issue = new Issue(); - issue.setSource(diagnostic.getSource()); + + issue.setSource(PhoenixAPI.getValueSourceByString(diagnostic.getSource())); issue.setDescription(diagnostic.getMessage()); issue.setStartLine(startLine); issue.setLocation(String.valueOf(startLine)); diff --git a/src/main/java/com/github/otymko/phoenixbsl/logic/PhoenixAPI.java b/src/main/java/com/github/otymko/phoenixbsl/logic/PhoenixAPI.java index 2c45a36..d852b24 100644 --- a/src/main/java/com/github/otymko/phoenixbsl/logic/PhoenixAPI.java +++ b/src/main/java/com/github/otymko/phoenixbsl/logic/PhoenixAPI.java @@ -1,6 +1,7 @@ package com.github.otymko.phoenixbsl.logic; import com.github.otymko.phoenixbsl.logic.designer.DesignerTextEditor; +import com.github.otymko.phoenixbsl.logic.service.SonarLintService; import com.sun.jna.platform.win32.WinDef; import lombok.experimental.UtilityClass; import lombok.extern.slf4j.Slf4j; @@ -138,6 +139,16 @@ public void clearListBySource(List diagnostics, String source) { diagnostics.removeAll(exclude); } + public String getValueSourceByString(String value) { + String result; + if (value.equals(SonarLintService.SOURCE)) { + result = SonarLintService.SOURCE; + } else { + result = "bsl-ls"; + } + return result; + } + private static void applyAllQuickFixes(List> codeActions, String[] strings) { codeActions.forEach(diagnostic -> { CodeAction codeAction = diagnostic.getRight(); diff --git a/src/main/java/com/github/otymko/phoenixbsl/logic/lsp/BSLLanguageClient.java b/src/main/java/com/github/otymko/phoenixbsl/logic/lsp/BSLLanguageClient.java index 499cd74..7b5111a 100644 --- a/src/main/java/com/github/otymko/phoenixbsl/logic/lsp/BSLLanguageClient.java +++ b/src/main/java/com/github/otymko/phoenixbsl/logic/lsp/BSLLanguageClient.java @@ -19,7 +19,7 @@ import java.util.concurrent.CompletableFuture; public class BSLLanguageClient implements LanguageClient { - private static final String SOURCE = "bsl-ls"; + private static final String SOURCE = "bsl-language-server"; public BSLLanguageClient() { // none @@ -51,8 +51,6 @@ public void publishDiagnostics(PublishDiagnosticsParams publishDiagnosticsParams var diagnosticList = core.getTextEditor().getDiagnostics(); PhoenixAPI.clearListBySource(diagnosticList, SOURCE); - publishDiagnosticsParams.getDiagnostics().parallelStream() - .forEach(diagnostic -> diagnostic.setSource(SOURCE)); diagnosticList.addAll(publishDiagnosticsParams.getDiagnostics()); PhoenixCore.getInstance().getEventManager().notify(