HiPhish / nvim-ts-rainbow2

Rainbow delimiters for Neovim through Tree-sitter
https://gitlab.com/HiPhish/nvim-ts-rainbow2
Apache License 2.0
338 stars 35 forks source link

bug(typescript): Custom query not working #10

Closed boydaihungst closed 1 year ago

boydaihungst commented 1 year ago

Describe the bug

I wrote some custom queries, tested with treesitter playground. But when I add it to /after/queries/typescript/rainbow-parens.scm only a part of it is correctly highlighted. Here is the custom query and test file. https://gist.github.com/boydaihungst/0dda7965f191977a8b376ca59646fade

Steps to reproduce

  1. add /after/queries/typescript/rainbow-parens.scm follow this guide nvim-treesitter#adding-queries.
  2. Use default plugin's config:
    enable = true,
    query = {
    'rainbow-parens',
    html = 'rainbow-tags'
    },
    strategy = {
    rainbow.strategy.global,
    -- commonlisp = rainbow.strategy['local'],
    },
  3. Restart nvim

Expected behavior

Custom query should work as expected.

Screenshots

image

HiPhish commented 1 year ago

Can you please describe what the solution was for people who come across this thread in the future?

boydaihungst commented 1 year ago

Sorry. I don't know how to fix it. I guess it is overrided by treesitter highlight. I just realized that this plugin is lack supports vue language, so I closed and revert to rainbow 1.

HiPhish commented 1 year ago

My guess would be that because you named your query rainbow-parens as well, the official ones take precedence. Try renaming your query and specify its name in your settings.

just realized that this plugin is lack supports vue language, so I closed and revert to rainbow 1.

Yes, Vue is not yet supported. I had to redo all queries from scratch and I don't know Vue well enough to write an appropriate query.