redhat-developer / redhat-developer/quarkus-ls
Adjust error range for Qute syntax validation.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 50
- Forks
- 18
- Avg merge
- 22h 11m
- Merged PRs (30d)
- 3
Description
Today we parse the Qute template with the real parser of Qute, but the error highlight is not very nice:

In this sample, #fragment should be highlighted as an error and we need to provide code actionwhich insert required id parameter.
Now we embed last version of Qute parser where @mkouba did some improvement to retrieve easily information of the error (error code, arguments, offset), we can support error range according an error code and arguments at https://github.com/redhat-developer/quarkus-ls/blob/906a34fa7cb85c8da5436019f087ab05d7a08cf0/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsForSyntax.java#L70
BUT it will work only for the first error since Qute parser stops the parsing as soon as it find an error.
To avoid higlighting the first error with proper range, I mean highlight all errors correctly I suggest that we follow this strategy:
- manage those error validation in https://github.com/redhat-developer/quarkus-ls/blob/906a34fa7cb85c8da5436019f087ab05d7a08cf0/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/services/QuteDiagnostics.java#L189
- as soon as we implement an error for a given error code, we can ignore this error in https://github.com/redhat-developer/quarkus-ls/blob/906a34fa7cb85c8da5436019f087ab05d7a08cf0/qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/services/diagnostics/QuteDiagnosticsForSyntax.java#L70
We need to use Qute error code

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in qute.ls/com.redhat.qute.ls/src/main/java/com/redhat/qute/services/QuteDiagnostics.java around line 189 and compare it with diagnostics/QuteDiagnosticsForSyntax.java around line 70. Read the available Qute error codes, offsets, and arguments, then trace how syntax diagnostics and code actions are produced. Done means errors such as the #fragment case receive the correct range and the required id code action is provided without losing later errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100