RRethy / vim-illuminate

illuminate.vim - (Neo)Vim plugin for automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
2.14k stars 47 forks source link

JSON and YML don't seem to highlight correctly #99

Closed ChristianChiarulli closed 2 years ago

ChristianChiarulli commented 2 years ago

Describe the bug image

Seems to just strip treesitter highlight instead of doing normal, highlighting like in most other language files.

To Reproduce I can maybe get a minimal config together at some point and but for now it seems like it's just a weird interaction between treesitter and this plugin.

Expected behavior image

Normal highlight like this ^^

Additional context It seems to be just stripping the treesitter hl group and showing the underlying highlight that would be there if treesitter was disabled.

I'm also using the LSP setup for this: https://github.com/ChristianChiarulli/nvim/blob/69772c49e076090f0f5b09eebdfa2e9aae52b52e/lua/user/lsp/handlers.lua#L54

RRethy commented 2 years ago

What highlight groups do you have for LspReferenceText, LspReferenceRead, and LspReferenceWrite? Also, what's the output from lua print(vim.inspect(vim.highlight.priorities))?

The highlighting for the LSP functionality is done strictly by calling a Neovim internal function, https://github.com/neovim/neovim/blob/2ab52bd9889790dc7e47a09e801751aada418727/runtime/lua/vim/lsp/util.lua#L1531, so this shouldn't be a vim-illuminate issue.

RRethy commented 2 years ago

Bump

ChristianChiarulli commented 2 years ago

Here are the values I'm using: https://github.com/LunarVim/darkplus.nvim/blob/29d2fe5be08bbc1aada7436db2c717389b5c50a0/lua/darkplus/LSP.lua#L37

image

I "solved" my issue by making the underlying non TS hl group match, it's possible another plugin is causing this issue since no one else seems to have reported it.

RRethy commented 2 years ago

I "solved" my issue by making the underlying non TS hl group match, it's possible another plugin is causing this issue since no one else seems to have reported it.

I'd be inclined to accept that since I can't figure out how that could happen.

ChristianChiarulli commented 2 years ago

I figured it out, this setting is what messes it up:

https://github.com/ChristianChiarulli/nvim/blob/c3c5e673157cfc6f7e10cf9688b534180027f047/lua/user/treesitter.lua#L18

If I have that option in treesitter set then vim illuminate will use the vanilla non treesitter hl group. I didn't need this anyway so I turned it off, but I figured I would leave this comment here just in case anyone else runs into this.