-
Notifications
You must be signed in to change notification settings - Fork 210
Support JPQL syntax #1114
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
The only difficulty is creating from scratch a TextMate grammar for JPQL. Alternatively, we'd need to find one out there on the web as it is likely someone has created it. I have only managed to find the ANTLR grammar for JPQL but this serves a different purpose and doesn't look like it can be converted to TextMate grammar. |
Step one here would be to do syntax highlighting. Once we figured out how to do this, we should probably apply this solution to even more cases where some other "language" is embedded in annotation params, like SpEL. |
The Spring Data JPA project itself contains parser implementations for all the various query languages: https://github.com/spring-projects/spring-data-jpa/tree/main/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query Probably worth to re-use parts of this if we dive into deeper "language" support here, like auto-completion, syntax checking, etc. For SpEL, we already use the Spring built-in SpEL parser to check syntax (but not to do syntax highlighting yet). |
Another pointer: I saw the Java support in VSCode supports syntax highlighting for the content of text blocks in Java, e.g. highlighting the string inside a text block as YAML. |
Here is how sytax highlighting for JPQL looks like in VSCode Inside Eclipse support for Semantic Tokens from LSP is very limited and buggy... Only the @martinlippert I'm thinking of folding in what I have at the moment. No SPEL syntax highlighting (embedded SPEL) and limitations for Eclipse. |
@BoykoAlex Looks great and yes, let's fold that in. |
JPQL part went in with: 95b8e2f Left:
|
HQL support: 8b4abbc Only SPEL support left |
I tried the latest Spring Boot Tools pre-release on VSCode with an older petclinic project, and I am seeing this a lot in the output view of VSCode:
|
NPE fix is included in 2543bdf |
I can see the syntax highlighting showing up nicely after updating to the latest pre-release build of the We should probably close this issue as done as soon as the syntax highlighting parts are complete and create additional issues around diagnostics, enabling the semantic token highlighting for java files in Eclipse, auto-completion, etc. |
SPEL syntax highlighting moved to #1234. Closing this. |
Expected Behavior
IntelliJ has built-in support for JPQL that comes with type-safety. I would expect this feature to be included in the Spring Boot extension pack, since JPQL is used extensively in most Spring Boot projects. What I expect the extension pack to do is to add syntax highlighting, linting and intellisense (copy what IntelliJ does).
Current Behavior
JPQL queries are shown as plain strings at the moment. There is not much to be said about it.
Context
I really like coding in VSCode, but writing JPQL queries has been a pain due to lack of support compared to IntelliJ. Not being able to see type-safety related errors and overal highlighting makes writing JPQL a lot harder than it should be.
The text was updated successfully, but these errors were encountered: