HiPhish / rainbow-delimiters.nvim

Rainbow delimiters for Neovim with Tree-sitter

Home Page:https://gitlab.com/HiPhish/rainbow-delimiters.nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Astro Support

davelongdev opened this issue · comments

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.

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:

  • :h 'runtimepath'
  • :h treesitter-query
  • :h lua-treesitter-query

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

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

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?

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.

Try the current master branch.

seems to be working now! thanks so much.