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.12k stars 44 forks source link

Problems with the new version #115

Closed iaurman closed 1 year ago

iaurman commented 1 year ago

Yesterday it was the block highlight. Today after update, it's instead the underline highlight. Have tried hi link illuminatedWord Visual, doesn't work.

Also, in the newer version, sometimes all the same words highlight, which is good. But sometimes, only the word under cursor is highlighted even if the same word is right next to it. Sometimes it just doesn't highlight at all. It's so inconsistent even within the same file. Come on.

image image image
ugoschieli commented 1 year ago

Same problem, now it underlines words instead of highlight them

Allaman commented 1 year ago

I think this is as intended see https://github.com/RRethy/vim-illuminate#highlight-groups ?

You could overwrite these highlight groups to your liking

iaurman commented 1 year ago

I think this is as intended see https://github.com/RRethy/vim-illuminate#highlight-groups ?

You could overwrite these highlight groups to your liking

I think i tried that with stanout and strikethrough. But it doesn't seem to have any effect on it. What should I config?

krish-r commented 1 year ago

I believe it should be -

vimscript

hi link IlluminatedWordText Visual
hi link IlluminatedWordRead Visual
hi link IlluminatedWordWrite Visual

lua

vim.api.nvim_set_hl(0, "IlluminatedWordText", { link = "Visual" })
vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "Visual" })
vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "Visual" })
Allaman commented 1 year ago

@krish-r I can confirm the lua part - was just writing something similar 😄

image
RRethy commented 1 year ago

I updated the migration guide to make it clear the highlight groups changed. FWIW they changed because now highlights can have a type which wasn't the case before. What @krish-r posted is correct.

Also, in the newer version, sometimes all the same words highlight, which is good. But sometimes, only the word under cursor is highlighted even if the same word is right next to it. Sometimes it just doesn't highlight at all. It's so inconsistent even within the same file. Come on.

@iaurman You'll have to be a bit more specific here, are you using tree-sitter or LSP? If so, then the highlighting is dependant on what they provide. In the screenshots you showed you hovered on return and int, for return it's out of scope of the other return so having them both highlight wouldn't make sense, and for int it's a builtin type not an identifier so most LSP servers and tree-sitter won't highlight it. It sounds like you want the naive highlighting from only regex matching which you have achieve with this:

require('illuminate').configure({
    providers = {
        'regex',
    },
}

If you want something different, you'll need to provide more information than a couple of screenshots which aren't very useful to anyone, it's not even clear what language you are using (it could be C/C++/Java).

I'll leave this issue open for a day in case of follow-ups.

iaurman commented 1 year ago

I updated the migration guide to make it clear the highlight groups changed. FWIW they changed because now highlights can have a type which wasn't the case before. What @krish-r posted is correct.

Also, in the newer version, sometimes all the same words highlight, which is good. But sometimes, only the word under cursor is highlighted even if the same word is right next to it. Sometimes it just doesn't highlight at all. It's so inconsistent even within the same file. Come on.

@iaurman You'll have to be a bit more specific here, are you using tree-sitter or LSP? If so, then the highlighting is dependant on what they provide. In the screenshots you showed you hovered on return and int, for return it's out of scope of the other return so having them both highlight wouldn't make sense, and for int it's a builtin type not an identifier so most LSP servers and tree-sitter won't highlight it. It sounds like you want the naive highlighting from only regex matching which you have achieve with this:

require('illuminate').configure({
    providers = {
        'regex',
    },
}

If you want something different, you'll need to provide more information than a couple of screenshots which aren't very useful to anyone, it's not even clear what language you are using (it could be C/C++/Java).

I'll leave this issue open for a day in case of follow-ups.

Sorry for the delay. Yes, krish-r's answer and the regex highlighting is my solution. My LSP and tree-sitter might not be working properly before thus causing me to think it's a problem here. Thanks for the solution.