HiPhish / rainbow-delimiters.nvim

Rainbow delimiters for Neovim with Tree-sitter
https://gitlab.com/HiPhish/rainbow-delimiters.nvim
Apache License 2.0
533 stars 39 forks source link

Astro Support #23

Closed davelongdev closed 1 year ago

davelongdev commented 1 year ago

Neovim version

0.9.0

Language affected

astro

Query

No response

Strategy

No response

Description

hello.  i've been trying to set up this plugin to work on .astro files, but i can't seem to get it working.  i have it working on lua files, html files, and js files, but i can't seem to figure out how to configure it for .astro files.  i'm looking at how to write a custom query, but i'm not sure how to do it yet.  any help would be appreciated.  thanks.
HiPhish commented 1 year ago

Astro is not supported. I did not even know about the language until just now (I guess you meant this Astro?). Each language needs its own set of queries, so we need to add support for each language individually.

See :h rb-delimiters-query for information on how to write a new query. For general information on writing queries refer to the Tree-sitter documentation: https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries

You can add the query to your own settings, that way you can start using it immediately and experiment before submitting a patch to this plugin. The default query name is rainbow-delimiters, but you can choose a different name in your settings. For information on query files see the following help topics:

davelongdev commented 1 year ago

i meant this astro - https://astro.build/

thanks for the info! i'm looking over the docs and your response now.

davelongdev commented 1 year ago

so .astro files are similar to jsx and html, but at least some of them have a frontmatter section (not sure if they all do) - like markdown files. maybe they just need a blank template like the .scm for markdown files?

HiPhish commented 1 year ago

Ideally yes, we could simply have an empty query and that's it. But this only works if Astro actually does language injection instead of replicating the grammar itself. I need a sample Astro file to try it out. Can you please provide one?

Maybe Astro is similar to Vue (queries/vue/rainbow-delimiters.scm) in that there are a few surrounding patterns that need to be defined first.

davelongdev commented 1 year ago

thanks. this one might be a good starting point.

https://github.com/davelongdev/sample-astro-files/blob/main/astro-test.astro

davelongdev commented 1 year ago

this might be helpful.

https://github.com/virchau13/tree-sitter-astro

HiPhish commented 1 year ago

Try the current master branch.

davelongdev commented 1 year ago

seems to be working now! thanks so much.