Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: healthcheck fails #51

Open
PuppyGirlBelly opened this issue Nov 8, 2023 · 3 comments
Open

[Bug]: healthcheck fails #51

PuppyGirlBelly opened this issue Nov 8, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@PuppyGirlBelly
Copy link

PuppyGirlBelly commented Nov 8, 2023

Neovim version

0.9.4

Language affected

All

Query

rainbow-delimiters-react

Strategy

No response

Description

Hi, for some reason the healthcheck fails when I have the javascript query rule 'rainbow-delimiters-react' enabled. When I comment it out, the healthcheck passes without issue.

Healthcheck Output

==============================================================================
rainbow-delimiters: require("rainbow-delimiters.health").check()

- ERROR Failed to run healthcheck for "rainbow-delimiters" plugin. Exception:
  function health#check, line 25
  Vim(eval):E5108: Error executing lua ...im/0.9.4/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 1260 for language javascript
  stack traceback:
  [C]: in function '_ts_parse_query'
  ...im/0.9.4/share/nvim/runtime/lua/vim/treesitter/query.lua:259: in function 'get'
  ...ainbow-delimiters.nvim/lua/rainbow-delimiters/health.lua:63: in function 'check_query'
  ...ainbow-delimiters.nvim/lua/rainbow-delimiters/health.lua:160: in function 'check'
  [string "luaeval()"]:1: in main chunk

Lazy Settings

Just a note, I like to include as many default settings as I can to make it easier to change settings without looking at documentation. So that is why there are so many comments and settings in my configuration.

{
    'hiphish/rainbow-delimiters.nvim',
    dependencies = "nvim-treesitter/nvim-treesitter",
    event = "VeryLazy",
    config = function()
        local rainbow = require 'rainbow-delimiters'

        vim.g.rainbow_delimiters = {
            -- Each language is based on a treesitter language name.

            -- Defines the highlighting strategy.
            strategy = {
                --[[
                'global' - Highlight all delimiters, updates with document
                           changes.
                'local'  - Highlight only the subtree that contains the cursor,
                           updates when the cursor moves.
                --]]
                -- Default Strategy
                [''] = rainbow.strategy['global'],
                html = rainbow.strategy['local'],
                latex = function()
                    -- Disabled for very large files,
                    if vim.fn.line('$') > 10000 then
                        return nil
                        -- global strategy for large files,
                    elseif vim.fn.line('$') > 1000 then
                        return rainbow.strategy['global']
                    end
                    -- local strategy otherwise
                    return rainbow.strategy['local']
                end
            },

            -- Defines what to match
            query = {
                -- Default Query - Reasonable set of parenthesis and similar
                -- delimiters in most languages
                [''] = 'rainbow-delimiters',
                -- Matches `\begin` and `\end` instructions
                latex = 'rainbow-blocks',
                -- Matches keywords like `function` and `end` as well as
                -- parenthesis
                lua = 'rainbow-blocks',
                -- Includes React support
                javascript = 'rainbow-delimiters-react',
                --[[
                -- Only parenthesis without React tags
                javascript = 'rainbow-parens',
                -- Only typescript highlighting without React tags
                tsx = 'rainbow-parens',
                --]]
                -- Matches keywords like `begin` and `end` as well as
                -- parenthesis
                verilog = 'rainbow-blocks',
            },
            highlight = {
                'RainbowDelimiterRed',
                'RainbowDelimiterYellow',
                'RainbowDelimiterBlue',
                'RainbowDelimiterOrange',
                'RainbowDelimiterGreen',
                'RainbowDelimiterViolet',
                'RainbowDelimiterCyan',
            },
            --[[
            blacklist = {
                'c',
                'cpp',
            },
            whitelist = {
                'python',
                'javascript',
            },
            log = {
                file = '~/.local/state/lvim/rainbow-delimiters.log',
                level = vim.log.levels.DEBUG,
            },
            --]]
        }
    end
}
@PuppyGirlBelly PuppyGirlBelly added the bug Something isn't working label Nov 8, 2023
@Danielkonge
Copy link
Contributor

Danielkonge commented Nov 12, 2023

Which parsers do you have installed? You can check by typing:
:checkhealth nvim-treesitter<CR>

I think you need at least both javascript and jsx to get React tags working (I can see in nvim-treesitter, that javascript inherits queries from ecma and jsx, so you might be missing one of those?).

I am not sure if this is the problem, but the error makes it sound like there is some unknown query, so this is my guess at what's the problem.

@PuppyGirlBelly
Copy link
Author

I took a look and I have javascript, tsx, typescript; however I can't seem to install a jsx as there doesn't seem to be a jsx parser supported in neovim-treesitter.

https://github.com/nvim-treesitter/nvim-treesitter#supported-languages

@Danielkonge
Copy link
Contributor

Danielkonge commented Nov 13, 2023

I took a look and I have javascript, tsx, typescript; however I can't seem to install a jsx as there doesn't seem to be a jsx parser supported in neovim-treesitter.

https://github.com/nvim-treesitter/nvim-treesitter#supported-languages

I guess the jsx stuff should all be in the javascript parser then. I just saw here that they split up the jsx queries from the "standard" javascript queries.

I have checked this in my own Neovim setup now, and I don't get any errors from 'rainbow-delimiters-react'.

When you check the parsers, does everything look correct for javascript? (All checkmarks like here)
Screenshot 2023-11-13 at 14 09 33

Have you tried updating your parsers via :TSUpdate<CR> and/or updating the nvim-treesitter plugin? I am on Neovim 0.10, but I can try to see if I can maybe reproduce this on 0.9.4 later, if you still get the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants