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

non-deprecated version not highlighting (neovim 0.7.2) #134

Closed jplate8 closed 1 year ago

jplate8 commented 1 year ago

Describe the bug I could be installing the plugin wrong, but I can't get highlighting to happen in neovim 0.7.2 unless I add let g:Illuminate_useDeprecated = 1

To Reproduce Steps to reproduce the behavior (include minimal init.vim or .vimrc): Just install the plugin (say, via vim-plugged, as in the following init.vim). minimal init.vim:

call plug#begin('~/.local/share/nvim/site/plugged')
Plug 'RRethy/vim-illuminate'
call plug#end()

To use this minimal init.vim, I ran PlugClean to get rid of any previous plugins.

Note Omitting a minimal init.vim/init.lua/.vimrc will likely result in the issue being closed without explanation.

Output from :IlluminateDebug (when not using deprecated flag)

buf_should_illuminate 1 true
config {
  delay = 100,
  filetype_overrides = {},
  filetypes_allowlist = {},
  filetypes_denylist = { "dirbuf", "dirvish", "fugitive" },
  modes_allowlist = {},
  modes_denylist = {},
  providers = { "lsp", "treesitter", "regex" },
  providers_regex_syntax_allowlist = {},
  providers_regex_syntax_denylist = {},
  under_cursor = true
}
started true
provider table: 0x7f8bd4328368 regex

Expected behavior I expected the highlighting to happen even without using the deprecated flag, since I am on the latest neovim version (0.7.2).

Screenshots Without deprecated flag (no highlighting): image With deprecated flag (highlighting): image

Additional context I noticed that that :help illuminate.txt describes the plugin as being "For NVIM v0.8.0", so I thought that there might be some compatibility issues with what I'm running.

RRethy commented 1 year ago

It might be an issue of highlight groups and when you are loading your colorscheme, see https://github.com/RRethy/vim-illuminate/issues/129#issuecomment-1249458837.

jplate8 commented 1 year ago

Thanks for the response. I tried adding these lines, but the behavior does not seem to have changed. I should also mention that there is no colorscheme being explicitly loaded by this init.vim.

New init.vim:

call plug#begin('~/.local/share/nvim/site/plugged')
Plug 'RRethy/vim-illuminate'
call plug#end()
" let g:Illuminate_useDeprecated = 1
hi def IlluminatedWordText gui=underline
hi def IlluminatedWordRead gui=underline
hi def IlluminatedWordWrite gui=underline

With deprecated flag: image Without deprecated flag: image

RRethy commented 1 year ago

In that same file while your cursor is on call, what's the output of this command:

lua =require('illuminate.reference').buf_get_references(vim.fn.bufnr())
jplate8 commented 1 year ago

When my cursor is on call like this: image That command gives this output: image

I've also discovered that using the gruvbox-material colorscheme seems to fix it: image But the regular gruvbox colorscheme does not work: image gruvbox-material talks about how it has tree-sitter support, and semantic highlighting support. Could these features be relevant?

RRethy commented 1 year ago

Try this config with nvim -u config.vim config.vim:

call plug#begin('~/.local/share/nvim/site/plugged')
Plug 'RRethy/vim-illuminate'
call plug#end()
set termguicolors
jplate8 commented 1 year ago

It looks like that worked! image Thank you so much

RRethy commented 1 year ago

Ah ok, that finally makes sense lol. I modified :IlluminateDebug to show this info in https://github.com/RRethy/vim-illuminate/commit/785f76bc941475a54e50d1f9bce50e28236d951e. You'll have to have set termguicolors in your config to use gui=underline (I wasn't aware of this either till now).