Skip to content

Conversation

@keynmol
Copy link
Collaborator

@keynmol keynmol commented Jan 8, 2023

closes #98

The highlighting queries in this repo are out of date with the version in nvim-treesitter: https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/scala/highlights.scm

That version has some issues, so I used it as the bases and moved/simplified/added rules.
In particular we are more precise about highlighting identifiers (before they would be aggressively highlighted as variable in lots of places)

plans

I feel like we should grow the test coverage of highlighting queries, and once we're satisfied - upstream the changes

using these queries

cp queries/* ~/.local/share/nvim/site/pack/packer/start/nvim-treesitter/queries/scala/

The difference are subtle (and some identifiers have the correct highlighting only because they're capitalised), but in particular class/enum parameters and trait/class/object/enum names are treated correctly.

nvim-treesitter version
image

this version
image

@@ -0,0 +1,37 @@
object Hello {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tree sitter has builtin support for unit testing highlight rules: https://tree-sitter.github.io/tree-sitter/syntax-highlighting#unit-testing

Copy link
Collaborator

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @keynmol!

@eed3si9n eed3si9n merged commit 76b0189 into tree-sitter:master Jan 8, 2023
@keynmol keynmol deleted the sync-and-update-highlights branch January 8, 2023 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add highlight queries for enums

2 participants