bamonroe / tree-sitter-rnoweb

Grammar for rnoweb
1 stars 2 forks source link

Queries? #3

Closed lorenzino65 closed 1 year ago

lorenzino65 commented 1 year ago

Sorry I just cant seem to understand where are the treesitter-queries that are than used in nvim. I wanted to expand the parser to understand which engine is being used for each chunk, but I cant find the queries

bamonroe commented 1 year ago

Sorry for the delay, I've been on holiday and haven't looked at anything remotely resembling work for a few weeks.

This isn't actually the place for these queries, this is just the parser. Neovim users typically pair tree-sitter with the popular nvim-treesitter plugin, which provides the queries (at least until nvim-treesitter gets mainlined, although this will not be for some time). For example, here are the queries for the rnoweb filetype:

https://github.com/nvim-treesitter/nvim-treesitter/tree/master/queries/rnoweb

and specifically for the injection defining queries:

https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/rnoweb/injections.scm

You'll see that every other language supported by nvim has its queries in the queries folder as well. For example, for javascript, the injections are not defined in the parser, but with the injections query provided by nvim-treesitter:

https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/jsx/injections.scm

Your pull request makes a bunch of changes I'll have to review, but thanks very much for all the help.

lorenzino65 commented 1 year ago

Thanks a lot. I wanted to test the queries, but I cant find any way to do that. How do you do? Or is it better to ask in the nvim-treesitter repo? Sorry to bother

bamonroe commented 1 year ago

You test queries by writing tests in the test/corpus folder and running tree-sitter test in the command-line. You can also put the queries in the previously mentioned folder for nvim-treesitter and use TSPlaygroundToggle on some sample text to see if they've worked. I typically do a bit of both when developing rnoweb-nvim