Skip to content

Commit

Permalink
Fix insert missing parameters code action overwriting existing content
Browse files Browse the repository at this point in the history
Signed-off-by: Jessica He <jhe@redhat.com>
  • Loading branch information
JessicaJHee authored and datho7561 committed Apr 11, 2023
1 parent 788c683 commit f185bd5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public void doCodeActions(CodeActionRequest request, List<CompletableFuture<Void
// collect missing paramters
for (Parameter param : section.getParameters()) {
if (requiredUserTagParamNames.contains(param.getName())) {
startRangeOffset = param.getEnd();
requiredUserTagParamNames.remove(param.getName());
}
startRangeOffset = param.getEnd();
}

Range range = QutePositionUtility.createRange(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,20 @@ public void missingRequiredParameterIt() throws Exception {
" \"\"")));
}

// https://github.com/redhat-developer/quarkus-ls/issues/856
@Test
public void missingRequiredParameterWithOptionalParamter() throws Exception {
String template = "{#myTag required=\"required\" optional=\"optional\"}\r\n" + //
"{/}";
Diagnostic d = d(0, 1, 0, 7, QuteErrorCode.MissingRequiredParameter,
"Missing required parameter(s) `it` of `myTag` user tag.",
DiagnosticSeverity.Warning);
testDiagnosticsFor(template, d);
testCodeActionsFor(template, d, //
ca(d, te(0, 47, 0, 47, //
" \"\"")));
}

@Test
public void noMatchBetweenStartEndSection() throws Exception {
String template = "{#form }\r\n"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{it}
{required}
{required}
{#if optional??}optional="{optional}"{/if}

0 comments on commit f185bd5

Please sign in to comment.