alaviss / tree-sitter-nim

tree-sitter grammar for Nim
Mozilla Public License 2.0
47 stars 5 forks source link

Extended highlight queries #84

Open omentic opened 8 months ago

omentic commented 8 months ago

Hi alaviss: I just finished porting Helix's old highlight queries to your grammar. You might be interested in them, they're about 150 lines longer but highlight significantly more accurately. I'd make a PR, but I'm not actually sure what scope standard your highlights are based off of...

They're available here: https://github.com/omentic/helix/blob/master/runtime/queries/nim/highlights.scm

omentic commented 8 months ago

before/after

aMOPel commented 8 months ago

Be sure to have a look at the highlight queries (and others like injection) I wrote for Neovim for inspiration. A load of effort went into these so I'm sure you'll find something useful.

https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/nim/highlights.scm

alaviss commented 8 months ago

I'd make a PR, but I'm not actually sure what scope standard your highlights are based off of...

It's whatever that tree-sitter highlight supports so that we can run tests on them.

Ideally the queries should be something that could work with most editors, but as far as I can tell there aren't any concrete standards accepted by all editors. Neovim is adopting some Helix stuff but not all of them (https://github.com/nvim-treesitter/nvim-treesitter/issues/4799), so I'm not sure which standard to follow.

aMOPel commented 8 months ago

@omentic

Also make sure to look at my (manual) test cases which include many edge cases, to test your queries.

https://github.com/aMOPel/nvim-treesitter-nim/blob/main/tests/highlights.nim