- ${listsOptions ? /*html*/`
+ ${options.length > 0 ? /*html*/`
Any one of these:
${options.map(hint => `- ${renderHintMessage(hint, references)}
`).join('')}
diff --git a/server/src/main/java/LJDiagnosticsHandler.java b/server/src/main/java/LJDiagnosticsHandler.java
index b638a2f..4f3fac7 100644
--- a/server/src/main/java/LJDiagnosticsHandler.java
+++ b/server/src/main/java/LJDiagnosticsHandler.java
@@ -72,7 +72,7 @@ public static List
getDiagnostics(List d
d -> PathUtils.toFileUri(d.getFile()),
Collectors.mapping(d -> {
Range range = getRangeFromPosition(d.getPosition());
- return new Diagnostic(range, getHoverMessage(d), severity, SOURCE);
+ return new Diagnostic(range, diagnosticMessage(d), severity, SOURCE);
}, Collectors.toList())
));
@@ -83,19 +83,14 @@ public static List getDiagnostics(List d
}
/**
- * The message the editor shows for a diagnostic: the headline, then the notes that explain it and the
- * counterexample, each on its own line. The hints are left to the LiquidJava view
+ * The message of a diagnostic in the editor: its title alone. VS Code shows that message as plain text in the
+ * hover, the Problems tab and the problem view; the headline, the notes, the counterexample and the hints are
+ * rendered by the extension's own part of the hover, in markdown, and by the LiquidJava view
* @param diagnostic the diagnostic
* @return the message
*/
- static String getHoverMessage(LJDiagnostic diagnostic) {
- List lines = new ArrayList<>();
- lines.add(String.format("%s: %s", diagnostic.getTitle(), diagnostic.getMessage()));
- lines.addAll(diagnostic.getMessageNotes());
- String counterexample = diagnostic.getCounterexampleStr();
- if (counterexample != null && !counterexample.isBlank())
- lines.add(counterexample);
- return String.join("\n", lines);
+ static String diagnosticMessage(LJDiagnostic diagnostic) {
+ return diagnostic.getTitle();
}
/**
diff --git a/server/src/test/java/LJDiagnosticsHandlerTest.java b/server/src/test/java/LJDiagnosticsHandlerTest.java
index 18f0b20..c585785 100644
--- a/server/src/test/java/LJDiagnosticsHandlerTest.java
+++ b/server/src/test/java/LJDiagnosticsHandlerTest.java
@@ -10,9 +10,9 @@
class LJDiagnosticsHandlerTest {
@Test
- void hoverShowsTheHeadlineThenTheNotesThenTheCounterexampleButNoHints() {
- LJDiagnostic diagnostic = new LJDiagnostic("Refinement Error", "expected timeout >= 0 but could not prove it",
- null, "", null) {
+ void messageIsTheTitleAlone() {
+ LJDiagnostic diagnostic = new LJDiagnostic("Refinement Error", "found `x > 0` but expected `y == 1`", null, "",
+ null) {
@Override
public List getMessageNotes() {
return List.of("where Positive(x) means x > 0");
@@ -20,10 +20,6 @@ public List getMessageNotes() {
};
diagnostic.setCounterexampleStr("Counterexample: timeout == -1");
diagnostic.addHint(Hint.general("Add a refinement"));
-
- assertEquals("""
- Refinement Error: expected timeout >= 0 but could not prove it
- where Positive(x) means x > 0
- Counterexample: timeout == -1""", LJDiagnosticsHandler.getHoverMessage(diagnostic));
+ assertEquals("Refinement Error", LJDiagnosticsHandler.diagnosticMessage(diagnostic));
}
}