-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Qute] Create a Qute Language Server #176
Comments
@mkouba if you are aware to support tolerant parser I suggest you see https://github.com/microsoft/tolerant-php-parser and read the section https://github.com/microsoft/tolerant-php-parser/blob/master/docs/HowItWorks.md#how-it-works to design the parser with tolerant mode. If you think it's a feature that you don't want to support in Qute parser, please tell us, thanks! |
Hi @angelozerr and thanks for the summary! Few comments:
The reason why we did it this way is that some of the errors can completely break the parser, e.g. it's not possible to correctly parse the rest of the template.
I'll need to look at your links with tolerant parser examples. |
Indeed, I understand this behaviour but IMHO I think it should be better to report several errors than the first error (like Java editor code for instance, you can see several problems than the first error in your file).
Thanks! I have started something on my side. When I will have something I will push it in my github repository. |
@mkouba @maxandersen please see my POC with Qute parser at https://github.com/angelozerr/tolerant-qute-parser I did that by copying/pasting code from our XML tolerant parser for LSP4XML and adapt it for Qute syntax. I did that to help more our discussion and it is a kind of parser required for the Qute Language Server. |
How about making a pr to the qute parser directly? |
It was more easy for me to do a parser from scratch than trying to modify the qute parser ans i would like to know if @mkouba likes my parser before doing a pr |
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
See redhat-developer/quarkus-ls#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes redhat-developer#176 Signed-off-by: azerr <azerr@redhat.com>
Fixes #176 Signed-off-by: azerr <azerr@redhat.com>
To support completion, validation, hover, etc for Qute, we need to create a Qute Language Server (in a new project like
com.redhat.quarkus.qute.ls
).https://github.com/quarkusio/quarkus/blob/master/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java
This Qute Language Server requires a
QuteAST
which contains all position of Qute expressions. Take a sample:The QuteAST must store each Qute node with proper range (start (character, line) , end(character, line) of node.
QuteAST
-> {@org.acme.Item item }
/\ /\
| |
start (line=1, character = 1) start (line=1, character = 40)
-> {item.name}
-> {item.price}
-> {#if item.price > 100}
-> {item.discountedPrice}
-> {/if}
The parse to compute this QuteAST must:
the QuteAST must contains:
-> {item.name
-> {item.price}
To manage this QuteAST (build by the tolerant parser + store ranges) we have 2 solutions
implement our own Qute parser. I have already done that in LSP4XML because we could not use SAX and DOM parser since they don't manage tolerant parser and ranges (SAX parser throws an error as soon as there is an error and manages only offset not ranges). It's possible but it's a long and hard task.
use the existing Qute parser. I hope we could do that, but Qute parser is not tolerant and doesn't manage ranges (just line information). Indeed Qute parser returns a instance of Template in https://github.com/quarkusio/quarkus/blob/c730ce9683d4f06b75e5c71f63b1f2fd41e0d9f6/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java#L83
but
https://github.com/quarkusio/quarkus/blob/57c68549f60be3ad954a385561a3291f7cf73011/independent-projects/qute/core/src/main/java/io/quarkus/qute/TemplateNode.java#L37 It should maintain ranges (start, end positions (line + character).
Do you think @mkouba is there any chance to support tolerant parser and manages ranges ? It should be really fantastic to do that to integrates Qute parser in an editor.
The text was updated successfully, but these errors were encountered: