-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Point editors to this tree-sitter #33
Comments
I was looking if these editors use the same set of captures for highlighting, but seems they don't. Zed uses https://zed.dev/docs/extensions/languages#syntax-highlighting Seems that nvim tried to use the same groups used in Helix. Considering that nvim-tree-sitter require the queries to be in their repository, and Zed includes the supported parsers in their own repository https://github.com/zed-industries/zed/tree/c57cc35b030407a6e4e9f9cd990135dcdcf36e9e/crates/languages. What highlighting query format should we keep here in the repository?
Probably because it checks the same captures used by Zed, since the tree-sitter guy is one of the founders. So I think we should keep the Zed format here in the repository and move the nvim format to nvim-tree-sitter. What do you guys think? |
Trying to get this working with helix, running into an issue where helix segfaults and I have no idea why. Created an upstream issue to hopefully get feedback to try and figure this out. Could be something wrong with this repo, or with how helix is building it. |
Could we keep all of them here and dup to their respective repos when changes are made? |
This is a neat idea: https://github.com/tree-sitter/tree-sitter-scala/blob/68773dfed7fee05b3549aaf52ebf8be7c7fe7d5f/.github/workflows/ci.yml#L126-L145 We could use Github actions to check for queries in other repos drifting out of sync |
Now that I'm on a computer I checked the captures used by nvim and tree-sitter, they are the same 🎉 The tree-sitter ones: All the same. TL;DR; |
I'm still not sure we can re-use the same ones for every editor, at least not for helix, due to difference in query precedence rules: https://docs.helix-editor.com/guides/adding_languages.html#queries
|
I think we can consider both the same until some Helix user complain 😅 , but try to avoid multiple queries match the same node seems like a good practice to me. |
On going nvim-treesitter/nvim-treesitter#7481 |
For us, the value of tracked queries is as a reference -- it is much easier to see what changes need to be made to adapt to breaking parser changes if you've made similar changes already. (This also means that these queries are worthless if they're not covered by CI that is run on every PR.) Things like capture names or predicates are trivial customizations on top of that, so I wouldn't worry too much about those; they're basically "somebody else's problem". Regarding precedence: Helix is the odd man out; the official precedence is "last match wins", i.e., Neovim rules. (They have a PR up to switch, but it's going slooooowly.) |
@clason I assume you're referring to the highlight support in @hugopl I think this is the official list of tree-sitter highlight groups: https://github.com/tree-sitter/tree-sitter/blob/master/highlight/src/lib.rs#L28 |
Not really; I don't use the upstream crates. I just mean it's important to keep the queries compatible with the grammar. (I use https://github.com/nvim-treesitter/nvim-treesitter/blob/main/scripts/check-queries.lua for that, of course, but as long as you can check that the queries don't refer to removed or renamed nodes, any way will do.) |
The linter in nvim-treesitter already found some issues that I fixed in the PR but not here, I'll do that once I have time. |
The text was updated successfully, but these errors were encountered: