diff --git a/qute.ls/com.redhat.qute.ls/pom.xml b/qute.ls/com.redhat.qute.ls/pom.xml
index b842ae26b..1fabf098d 100644
--- a/qute.ls/com.redhat.qute.ls/pom.xml
+++ b/qute.ls/com.redhat.qute.ls/pom.xml
@@ -39,7 +39,7 @@
yyyyMMdd-HHmm
${maven.build.timestamp}
0.14.0
- 2.7.0.Final
+ 2.15.3.Final
5.6.1
jboss-releases-repository
https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/
diff --git a/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/ls/commons/snippets/Snippet.java b/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/ls/commons/snippets/Snippet.java
index dd091b777..a6c70291b 100644
--- a/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/ls/commons/snippets/Snippet.java
+++ b/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/ls/commons/snippets/Snippet.java
@@ -39,6 +39,8 @@ public class Snippet {
private ISnippetContext> context;
+ private List urls;
+
public String getLabel() {
return label;
}
@@ -94,6 +96,14 @@ public String getSortText() {
public void setSortText(String sortText) {
this.sortText = sortText;
}
+
+ public List getUrls() {
+ return urls;
+ }
+
+ public void setUrls(List urls) {
+ this.urls = urls;
+ }
public ISnippetContext> getContext() {
return context;
diff --git a/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/ls/commons/snippets/SnippetDeserializer.java b/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/ls/commons/snippets/SnippetDeserializer.java
index 8bef554ce..bdb5b7922 100644
--- a/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/ls/commons/snippets/SnippetDeserializer.java
+++ b/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/ls/commons/snippets/SnippetDeserializer.java
@@ -40,6 +40,7 @@ class SnippetDeserializer implements JsonDeserializer {
private static final String SORTTEXT_ELT = "sortText";
private static final String BODY_ELT = "body";
private static final String CONTEXT_ELT = "context";
+ private static final String URL_ELT = "url";
private final TypeAdapter extends ISnippetContext>> contextDeserializer;
@@ -139,6 +140,21 @@ public Snippet deserialize(JsonElement json, Type typeOfT, JsonDeserializationCo
}
}
+ // url
+ List urls = new ArrayList<>();
+ JsonElement urlElt = snippetObj.get(URL_ELT);
+ if (urlElt != null) {
+ if (urlElt.isJsonArray()) {
+ JsonArray urlArray = (JsonArray) urlElt;
+ urlArray.forEach(elt -> {
+ urls.add(elt.getAsString());
+ });
+ } else if (urlElt.isJsonPrimitive()) {
+ urls.add(urlElt.getAsString());
+ }
+ }
+ snippet.setUrls(urls);
+
return snippet;
}
diff --git a/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/utils/DocumentationUtils.java b/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/utils/DocumentationUtils.java
index 5350ca49e..fcfdfd741 100644
--- a/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/utils/DocumentationUtils.java
+++ b/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/utils/DocumentationUtils.java
@@ -282,6 +282,8 @@ public static MarkupContent getDocumentation(Snippet snippet, boolean markdown)
documentation.append(snippet.getDescription());
}
+ addUrls(snippet.getUrls(), documentation, markdown);
+
return createMarkupContent(documentation, markdown);
}
@@ -340,14 +342,31 @@ private static void addUrl(String url, StringBuilder documentation, boolean mark
if (!StringUtils.isEmpty(url)) {
documentation.append(System.lineSeparator());
documentation.append("See ");
- if (markdown) {
- documentation.append("[here](");
- documentation.append(url);
- documentation.append(")");
- } else {
- documentation.append(url);
+ addUrl(url, "here", documentation, markdown);
+ documentation.append(" for more informations.");
+ }
+ }
+
+ private static void addUrls(List urls, StringBuilder documentation, boolean markdown) {
+ if (urls != null && !urls.isEmpty()) {
+ documentation.append(System.lineSeparator());
+ documentation.append("See ");
+ for (String url : urls) {
+ addUrl(url, "here", documentation, markdown);
}
documentation.append(" for more informations.");
}
}
+
+ private static void addUrl(String url, String label, StringBuilder documentation, boolean markdown) {
+ if (markdown) {
+ documentation.append("[");
+ documentation.append(label);
+ documentation.append("](");
+ documentation.append(url);
+ documentation.append(")");
+ } else {
+ documentation.append(url);
+ }
+ }
}
\ No newline at end of file
diff --git a/qute.ls/com.redhat.qute.ls/src/main/resources/com/redhat/qute/services/snippets/qute-snippets.json b/qute.ls/com.redhat.qute.ls/src/main/resources/com/redhat/qute/services/snippets/qute-snippets.json
index fadc31238..2a110d699 100644
--- a/qute.ls/com.redhat.qute.ls/src/main/resources/com/redhat/qute/services/snippets/qute-snippets.json
+++ b/qute.ls/com.redhat.qute.ls/src/main/resources/com/redhat/qute/services/snippets/qute-snippets.json
@@ -1,18 +1,37 @@
-{ "#each": {
- "prefix": ["each", "{#"],
+{
+ "#each": {
+ "prefix": [
+ "each",
+ "{#"
+ ],
"body": [
"{#each ${1:items}}",
"\t{it.${2:name}}$0",
"{/each}"
],
- "description": "Loop section with implicit alias"
+ "description": "Loop section with implicit alias",
+ "url": "https://quarkus.io/guides/qute-reference#loop_section"
},
"#eval": {
"prefix": "eval",
"body": [
"{#eval ${1:content} /}$0"
],
- "description": "Parse and evaluate a template dynamically"
+ "description": "Parse and evaluate a template dynamically",
+ "url": "https://quarkus.io/guides/qute-reference#eval-section"
+ },
+ "#fragment": {
+ "prefix": "fragment",
+ "body": [
+ "{#fragment id=\"${1:item}\"}",
+ "\t$0",
+ "{/fragment}"
+ ],
+ "description": "A fragment represents a part of the template that can be treated as a separate template, i.e. rendered separately.",
+ "url": [
+ "https://quarkus.io/guides/qute-reference#fragments",
+ "https://quarkus.io/guides/qute-reference#type_safe_fragments"
+ ]
},
"#for": {
"prefix": "for",
@@ -21,7 +40,8 @@
"\t{${1:item}.${3:name}}$0",
"{/for}"
],
- "description": "Loop section with alias"
+ "description": "Loop section with alias",
+ "url": "https://quarkus.io/guides/qute-reference#loop_section"
},
"#if": {
"prefix": "if",
@@ -30,7 +50,8 @@
"\t$0",
"{/if}"
],
- "description": "If section"
+ "description": "If section",
+ "url": "https://quarkus.io/guides/qute-reference#if_section"
},
"#else": {
"prefix": "if-else",
@@ -41,7 +62,8 @@
"\t$0",
"{/if}"
],
- "description": "Else section"
+ "description": "Else section",
+ "url": "https://quarkus.io/guides/qute-reference#if_section"
},
"#elseif": {
"prefix": "if-elseif",
@@ -54,7 +76,8 @@
"\t$0",
"{/if}"
],
- "description": "Else If section"
+ "description": "Else If section",
+ "url": "https://quarkus.io/guides/qute-reference#if_section"
},
"#include": {
"prefix": "include",
@@ -63,7 +86,8 @@
"\t$0",
"{/include}"
],
- "description": "Include section"
+ "description": "Include section",
+ "url": "https://quarkus.io/guides/qute-reference#include_helper"
},
"#insert": {
"prefix": "insert",
@@ -72,7 +96,8 @@
"\t$0",
"{/insert}"
],
- "description": "Insert section"
+ "description": "Insert section",
+ "url": "https://quarkus.io/guides/qute-reference#include_helper"
},
"#let": {
"prefix": "let",
@@ -81,14 +106,16 @@
"\t$0",
"{/let}"
],
- "description": "Let section"
+ "description": "Let section",
+ "url": "https://quarkus.io/guides/qute-reference#let_section"
},
"#parameter": {
"prefix": "parameter",
"body": [
"{@${1:class} ${2:alias}}$0"
],
- "description": "Insert parameter declaration"
+ "description": "Insert parameter declaration",
+ "url": "https://quarkus.io/guides/qute-reference#typesafe_expressions"
},
"#set": {
"prefix": "set",
@@ -97,7 +124,8 @@
"\t$0",
"{/set}"
],
- "description": "Let section"
+ "description": "Let section",
+ "url": "https://quarkus.io/guides/qute-reference#let_section"
},
"#switch": {
"prefix": "switch",
@@ -106,7 +134,8 @@
"\t{#case ${2:case}}$0",
"{/switch}"
],
- "description": "Switch section"
+ "description": "Switch section",
+ "url": "https://quarkus.io/guides/qute-reference#when_section"
},
"#with": {
"prefix": "with",
@@ -115,7 +144,8 @@
"\t{${2:name}}$0",
"{/with}"
],
- "description": "With section"
+ "description": "With section",
+ "url": "https://quarkus.io/guides/qute-reference#with_section"
},
"#when": {
"prefix": "when",
@@ -124,6 +154,7 @@
"\t{#is ${2:case}}$0",
"{/when}"
],
- "description": "When section"
+ "description": "When section",
+ "url": "https://quarkus.io/guides/qute-reference#when_section"
}
}
diff --git a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/QuteAssert.java b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/QuteAssert.java
index 664f022c5..592fbbce1 100644
--- a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/QuteAssert.java
+++ b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/QuteAssert.java
@@ -106,7 +106,7 @@ public class QuteAssert {
private static final String FILE_URI = "test.qute";
- public static final int SECTION_SNIPPET_SIZE = 14 /* #each, #for */ + 3 /* #user, #formElement */;
+ public static final int SECTION_SNIPPET_SIZE = 15 /* #each, #for, ... #fragment ... */ + 3 /* #user, #formElement */;
public static String getFileUri(String templateFile) {
return Paths.get(TEMPLATE_BASE_DIR + templateFile).toUri().toString();
diff --git a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsInExpressionTest.java b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsInExpressionTest.java
index 0b3cfb6cf..a0605908d 100644
--- a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsInExpressionTest.java
+++ b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsInExpressionTest.java
@@ -511,7 +511,7 @@ public void quoteNoteClosed() throws Exception {
"{foo.getBytes('abcd)}";
testDiagnosticsFor(template, //
d(1, 22, 1, 22, QuteErrorCode.SyntaxError,
- "Parser error on line 2: unexpected non-text buffer at the end of the template - unterminated string literal: foo.getBytes('abcd)}",
+ "Parser error: unexpected non-text buffer at the end of the template - unterminated string literal: foo.getBytes('abcd)}",
DiagnosticSeverity.Error));
}
diff --git a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsInExpressionWithLetSectionTest.java b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsInExpressionWithLetSectionTest.java
index 9386df394..4563fa8f6 100644
--- a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsInExpressionWithLetSectionTest.java
+++ b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsInExpressionWithLetSectionTest.java
@@ -94,7 +94,7 @@ public void autoClose() throws Exception {
testDiagnosticsFor(template, //
d(2, 6, 2, 6, QuteErrorCode.SyntaxError,
- "Parser error on line 3: no section start tag found for {/let}", DiagnosticSeverity.Error), //
+ "Parser error: no section start tag found for {/let}", DiagnosticSeverity.Error), //
d);
testCodeActionsFor(template, d, //
ca(d, te(0, 0, 0, 0, "{@java.lang.String name}\r\n")),
diff --git a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsInExpressionWithNamespaceTest.java b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsInExpressionWithNamespaceTest.java
index 5938ef20c..40840124d 100644
--- a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsInExpressionWithNamespaceTest.java
+++ b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsInExpressionWithNamespaceTest.java
@@ -130,7 +130,7 @@ public void badNamespace() throws Exception {
Diagnostic d = d(0, 1, 0, 2, QuteErrorCode.UndefinedNamespace, "No namespace resolver found for: `X`.",
DiagnosticSeverity.Warning);
testDiagnosticsFor(template,
- d(0, 0, 0, 3, QuteErrorCode.SyntaxError, "Parser error on line 1: empty expression found {X:}",
+ d(0, 0, 0, 3, QuteErrorCode.SyntaxError, "Parser error on: empty expression found {X:}",
DiagnosticSeverity.Error), //
d);
diff --git a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsSyntaxErrorTest.java b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsSyntaxErrorTest.java
index d14840779..4152f064d 100644
--- a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsSyntaxErrorTest.java
+++ b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsSyntaxErrorTest.java
@@ -29,7 +29,7 @@ public class QuteDiagnosticsSyntaxErrorTest {
public void emptyParameterDeclaration() {
String template = "{@}";
testDiagnosticsFor(template, //
- d(0, 2, 0, 2, QuteErrorCode.SyntaxError, "Parser error on line 1: invalid parameter declaration {@}",
+ d(0, 2, 0, 2, QuteErrorCode.SyntaxError, "Parser error: invalid parameter declaration {@}",
DiagnosticSeverity.Error));
}
}
diff --git a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsWithIncludeSectionTest.java b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsWithIncludeSectionTest.java
index 2ecf6c753..27014e39a 100644
--- a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsWithIncludeSectionTest.java
+++ b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsWithIncludeSectionTest.java
@@ -31,7 +31,7 @@ public void templateNotDefined() throws Exception {
testDiagnosticsFor(template, //
// error coming from the real Qute parser
d(0, 11, 0, 11, QuteErrorCode.SyntaxError,
- "Parser error on line 1: mandatory section parameters not declared for {#include /}: [template]",
+ "Parser error: mandatory section parameters not declared for {#include /}: [template]",
DiagnosticSeverity.Error), //
// error coming from Qute LS parser
d(0, 1, 0, 9, QuteErrorCode.TemplateNotDefined, "Template id must be defined as parameter.",
diff --git a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/hover/QuteHoverInTag.java b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/hover/QuteHoverInTag.java
index 392a97dce..cd18076a0 100644
--- a/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/hover/QuteHoverInTag.java
+++ b/qute.ls/com.redhat.qute.ls/src/test/java/com/redhat/qute/services/hover/QuteHoverInTag.java
@@ -38,7 +38,9 @@ public void coreTag() throws Exception {
assertHover(template, "**#for** section tag " + //
System.lineSeparator() + //
System.lineSeparator() + //
- "Loop section with alias", //
+ "Loop section with alias" + //
+ System.lineSeparator() + //
+ "See [here](https://quarkus.io/guides/qute-reference#loop_section) for more informations.", //
r(0, 1, 0, 5));
}