treeman / tree-sitter-djot

MIT License
31 stars 5 forks source link

Backport query changes from nvim-treesitter #19

Closed treeman closed 7 months ago

NoahTheDuke commented 7 months ago

I will say that nvim-treesitter is very specific about their queries. Queries are editor specific, so they should be closer to hints to implementers for how to choose. For instance, nvim-treesitter uses lua and nvim-specific predicates that aren't available in Helix/Pulsar/VSCode/etc.

I don't have a good solution except maybe to have a file specifying what nodes ts-djot provides? Then editors can use that as a means of writing their own.

treeman commented 7 months ago

Queries are editor specific, so they should be closer to hints to implementers for how to choose.

Yeah, I didn't really get that before.

Since I don't use any other editor I think what I'll do is maintain the query files as specific to Neovim and document it so people can use them as a starting point for rather than a ground truth.

I don't have a good solution except maybe to have a file specifying what nodes ts-djot provides?

I think it's good enough to have the query files. Even if you don't have eg #lua-match? in Helix, it shouldn't be too hard to adapt it to the Helix equivalent. There's also the test cases in test/corpus/syntax.txt that provides a pretty good overview of all the different markup structures.

Finally there should be other tools to explore the treesitter parsing structure (:TSPlaygroundToggle in Neovim for example) which is what I used to create the queries.