HiPhish / rainbow-delimiters.nvim

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

[Bug]: not all brackets are colorized in java #81

Closed kawre closed 6 months ago

kawre commented 6 months ago

Neovim version

v0.10.0-dev-2034+g6635ec113f

Language affected

java

Query

No response

Strategy

No response

Description

I wasn't able to find any information about this hence i ask. 
Any reason why `if_statement` and `for_statement` are not included inside the java query?
Or maybe it's just expected behavior?

my config

local M = {
    "HiPhish/rainbow-delimiters.nvim",
    event = "BufEnter",
    enabled = true,
}

M.config = function()
    local rainbow = require("rainbow-delimiters")

    vim.cmd("highlight RainbowDelimiterRed guifg=#ffd700")
    vim.cmd("highlight RainbowDelimiterYellow guifg=#da70d6")
    vim.cmd("highlight RainbowDelimiterBlue guifg=#179fff")

    vim.g.rainbow_delimiters = {
        strategy = {
            [""] = rainbow.strategy["global"],
            vim = rainbow.strategy["local"],
        },
        query = {
            [""] = "rainbow-delimiters",
            lua = "rainbow-blocks",
        },
        highlight = {
            "RainbowDelimiterRed",
            "RainbowDelimiterYellow",
            "RainbowDelimiterBlue",
        },
    }
end

return M
kawre commented 6 months ago

https://github.com/HiPhish/rainbow-delimiters.nvim/assets/69250723/cb128abc-06ee-47a2-8866-5e80d12ff2fb

HiPhish commented 6 months ago

Thanks for the PR. To answer your question, there is no real reason why these patterns were missing. In the beginning I was more conservative as to what constitutes a "delimiter", and none of the patterns you have added can be nested directly in themselves, so I omitted them initially. In hindsight this does not really make sense, but I haven't used Java for quite a while, so it never bothered me personally.