redhat-developer / quarkus-ls

Language server for Quarkus tooling
Eclipse Public License 2.0
43 stars 15 forks source link

Handle spaces in parameters to functions in Qute templates #781

Open datho7561 opened 1 year ago

datho7561 commented 1 year ago

If you have a qute template that executes a Java method with parameters:

<h3>{myString.substring(1, 2)}</h3>

The parser doesn't handle the space between the , and the 2 properly, meaning it doesn't recognize any parameters past the 1, making it difficult to provide IDE features for method invocations in Qute templates.

datho7561 commented 1 year ago

See https://github.com/quarkusio/quarkus/issues/22235

Handling this properly involves parsing nested expressions (i.e. each method parameter could itself be an expression). This would involve non-trivial changes to the parser. Additionally, Qute's own parser has several limitations on which types of nested expressions are supported (nested method invocations are supported but you can't use binary operators within method parameters).

As a result, the ideal solution is to write a new parser that can be used by both Qute and qute-ls, using a parser generator such as ANTLR in order for it to be easier to write and maintain. This will take some time to write, and will take additional time to integrate into Qute and qute-ls.

fbricon commented 1 year ago

mmm It seems to be working now. I see no errors on { name.substring( 1 , 2 ) }