From c7d4a2678967c1916e7e335c50526efe96f1e45b Mon Sep 17 00:00:00 2001 From: Julian Valentin Date: Sun, 24 Jan 2021 17:26:22 +0100 Subject: [PATCH] Move rule ID to end of diagnostic messages Fixes valentjn/vscode-ltex#233. --- CHANGELOG.md | 1 + .../java/org/bsplines/ltexls/server/CodeActionGenerator.java | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 337c13a..4da7f21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Fix false positives for words added by `Add to dictionary` for Slovak rule IDs `MUZSKY_ROD_NEZIV_A`, `ZENSKY_ROD_A`, and `STREDNY_ROD_A` (fixes [vscode-ltex#221](https://github.com/valentjn/vscode-ltex/issues/221)) - Fix BibTEX field `seealso` not ignored, ignore `category` and `parent` (see [vscode-ltex#211](https://github.com/valentjn/vscode-ltex/issues/211)) - Disable `UPPERCASE_SENTENCE_START` in BibTEX files (see [vscode-ltex#211](https://github.com/valentjn/vscode-ltex/issues/211)) +- Move rule ID to the end of diagnostic messages as VS Code truncates the messages if the Problems panel is narrow (fixes [vscode-ltex#233](https://github.com/valentjn/vscode-ltex/issues/233)) ## 9.1.0 (January 24, 2021) diff --git a/ltexls-core/src/main/java/org/bsplines/ltexls/server/CodeActionGenerator.java b/ltexls-core/src/main/java/org/bsplines/ltexls/server/CodeActionGenerator.java index b7471aa..e0cc482 100644 --- a/ltexls-core/src/main/java/org/bsplines/ltexls/server/CodeActionGenerator.java +++ b/ltexls-core/src/main/java/org/bsplines/ltexls/server/CodeActionGenerator.java @@ -64,8 +64,9 @@ public Diagnostic createDiagnostic(LanguageToolRuleMatch match, LtexTextDocument ret.setRange(new Range(document.convertPosition(match.getFromPos()), document.convertPosition(match.getToPos()))); ret.setSeverity(this.settingsManager.getSettings().getDiagnosticSeverity()); - ret.setSource("LTeX - " + match.getRuleId()); - ret.setMessage(match.getMessage().replaceAll("(.*?)", "'$1'")); + ret.setSource("LTeX"); + ret.setMessage(match.getMessage().replaceAll("(.*?)", "'$1'") + + " \u2013 " + match.getRuleId()); return ret; }