Skip to content

Commit

Permalink
false positive error with section name which contains number
Browse files Browse the repository at this point in the history
Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed Nov 7, 2024
1 parent a02c519 commit b7de7ec
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class TemplateScanner extends AbstractScanner<TokenType, ScannerState> {
private static final int[] RCURLY_QUOTE = new int[] { '}', '"', '\'', };

private static final Predicate<Integer> TAG_NAME_PREDICATE = ch -> {
return Character.isLetter(ch);
return Character.isLetterOrDigit(ch);
};

public static Scanner<TokenType, ScannerState> createScanner(String input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ public class QuteAssert {

public static final String FILE_URI = "test.qute";

public static final int USER_TAG_SIZE = 10 /*
public static final int USER_TAG_SIZE = 11 /*
* #input, #bundleStyle, #form, #title, #simpleTitle, #user,
* #formElement,
* #inputRequired, #myTag, #tagWithArgs
* #ga4
*/;

public static final int SECTION_SNIPPET_SIZE = 15 /* #each, #for, ... #fragment ... */ + USER_TAG_SIZE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void includeTemplateIds() throws Exception {
// Without snippet
testCompletionFor(template, //
false, // no snippet support
16 /* all files from src/test/resources/templates */ - 1 /* README.md */ - USER_TAG_SIZE, //
17 /* all files from src/test/resources/templates */ - 1 /* README.md */ - USER_TAG_SIZE, //
c("base", "base", r(0, 10, 0, 10)),
c("test.json", "test.json", r(0, 10, 0, 10)),
c("test.html", "test.html", r(0, 10, 0, 10)),
Expand All @@ -55,7 +55,7 @@ public void includeTemplateIdsSelf() throws Exception {
testCompletionFor(template, //
"src/test/resources/templates/base.html",
false, // no snippet support
16 /* all files from src/test/resources/templates */ - 1 /* base.html */ - 1 /* README.md */
17 /* all files from src/test/resources/templates */ - 1 /* base.html */ - 1 /* README.md */
- USER_TAG_SIZE, //
// c("base", "base", r(0, 10, 0, 10)),
c("test.json", "test.json", r(0, 10, 0, 10)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void bundleStyleWithingParameter() throws Exception {
"name=\"${1:main.css}\"$0", //
r(0, 14, 0, 14)));
}

@Test
public void input() throws Exception {
String template = "{#|";
Expand Down Expand Up @@ -525,4 +526,21 @@ public void tagWithArgs() throws Exception {
1, //
c("foo", "foo=\"${1:foo}\"$0", r(0, 14, 0, 14)));
}

@Test
public void ga4() throws Exception {
String template = "{#|";

// Without snippet
testCompletionFor(template, //
false, // no snippet support
SECTION_SNIPPET_SIZE, //
c("ga4", "{#ga4 /}", r(0, 0, 0, 2)));

// With snippet support
testCompletionFor(template, //
true, // snippet support
SECTION_SNIPPET_SIZE, //
c("ga4", "{#ga4 /}$0", r(0, 0, 0, 2)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public void definedAllParameterNames() {
testDiagnosticsFor(template);
}

@Test
public void ga4() {
String template = "{#ga4 /}";
testDiagnosticsFor(template);
}

@Test
public void definedAllParameterNamesWithoutAssignment() {
String template = "{@java.lang.String name}\n" + //
Expand Down
Empty file.

0 comments on commit b7de7ec

Please sign in to comment.