Fix syntax highlighting for "var" keyword #5

Merged
sergeichestakov merged 5 commits from var-highlighting into main 2023-02-06 16:52:46 +01:00
sergeichestakov commented 2023-02-03 21:19:36 +01:00 (Migrated from github.com)

I discovered that the newly introduced "var" keyword does not have proper syntax highlighting in Java despite the grammar supporting it.

It seems that it's not being highlighted as a typeName like the rest of the type names (e.g. int, long, etc) are. I think adding it to the list of simpleTypes should do the trick. We can also remove the union type in the local variable declaration since that would be made redundant. I'm new to Lezer grammars so please let me know if something looks off!

I discovered that the newly introduced "var" keyword does not have proper syntax highlighting in Java despite the grammar [supporting it](https://github.com/lezer-parser/java/commit/d35006b7e72645d5e17c9b241caff85d2a67691e). It seems that it's not being highlighted as a `typeName` like the rest of the type names (e.g. `int`, `long`, etc) are. I think adding it to the list of `simpleTypes` should do the trick. We can also remove the union type in the local variable declaration since that would be made redundant. I'm new to Lezer grammars so please let me know if something looks off!
marijnh commented 2023-02-04 08:02:43 +01:00 (Migrated from github.com)

It looks like the var token parses fine but was just forgotten in src/highlight.js. Is there any reason you ended up changing the grammar instead of adding it there that I am missing?

It looks like the `var` token parses fine but was just forgotten in `src/highlight.js`. Is there any reason you ended up changing the grammar instead of adding it there that I am missing?
sergeichestakov commented 2023-02-05 01:22:37 +01:00 (Migrated from github.com)

ahh I see. I thought it was technically more correct to classify it as a simpleType, which also conveniently simplifies the grammar, but happy to update the syntax highlighting spec instead

ahh I see. I thought it was technically more correct to classify it as a `simpleType`, which also conveniently simplifies the grammar, but happy to update the syntax highlighting spec instead
sergeichestakov commented 2023-02-05 01:27:31 +01:00 (Migrated from github.com)

let me know if the latest commit looks better! wasn't sure what the best way to classify it is in the style spec but I figured matching the primitive types (standard typeNames) was most fitting

let me know if the latest commit looks better! wasn't sure what the best way to classify it is in the style spec but I figured matching the primitive types (standard typeNames) was most fitting
marijnh commented 2023-02-05 09:19:20 +01:00 (Migrated from github.com)

I'd go with definitionKeyword. Does that work for you?

I'd go with `definitionKeyword`. Does that work for you?
sergeichestakov commented 2023-02-06 14:03:26 +01:00 (Migrated from github.com)

yep sounds good. done!

yep sounds good. done!
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/java!5
No description provided.