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.19k stars 50 forks source link

Error during error reporting #113

Closed Diablo-D3 closed 2 years ago

Diablo-D3 commented 2 years ago
Error executing vim.schedule lua callback: ...undle/start/vim-illuminate.git/lua/illuminate/engine.lua:139: attempt to perform arithmetic on a string value
stack traceback:
        ...undle/start/vim-illuminate.git/lua/illuminate/engine.lua:139: in function 'cb'
        vim/_editor.lua:256: in function <vim/_editor.lua:256>

Using otherwise vanilla Illuminate config. Seems to have been introduced with: https://github.com/RRethy/vim-illuminate/blob/09235da12cfdad2a4f695610a079b20f1b263b4a/lua/illuminate/engine.lua#L139

RRethy commented 2 years ago

I fixed the string handling, if you see the real internal error you can reopen with it and I'll take a look.

Diablo-D3 commented 2 years ago
vim-illuminate: An internal error has occured: false"...le/start/vim-illuminate.git/lua/illuminate/highlight.lua:38: hl_group is not a valid highlight"

I'm not sure which highlight group is being called.

RRethy commented 2 years ago

I suspect there's an LSP that's not providing kind information in the return data, this is causing kind_to_hl_group to return nil which is an invalid highlight group. I though LSP servers had to provide kind for documentHighlight but they can violate things at times 🤷 . That's my best guess at least.

Diablo-D3 commented 2 years ago

This is with rust-analyzer, I do not currently have any other LSPs installed (although I suspect I should install sumneko lua for neovim config reasons; would also provide an alternate LSP to help debug issues in LSP ecosystem plugins).

RRethy commented 2 years ago

Just checked the spec, kind is an optional field https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentHighlight.