Skip to content

Commit

Permalink
#113 / Отказ изменения source в диагностике, представление source для…
Browse files Browse the repository at this point in the history
… вывода на форму
  • Loading branch information
otymko committed Dec 1, 2020
1 parent c1efe26 commit a8f9aef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ public void updateIssues(List<Diagnostic> 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));
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/github/otymko/phoenixbsl/logic/PhoenixAPI.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -138,6 +139,16 @@ public void clearListBySource(List<Diagnostic> 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<Either<Command, CodeAction>> codeActions, String[] strings) {
codeActions.forEach(diagnostic -> {
CodeAction codeAction = diagnostic.getRight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit a8f9aef

Please sign in to comment.