Skip to content

Commit 7ac2b91

Browse files
committed
fix: don't return empty hover
Nvim show me an error(since: neovim/neovim#34789), when I hover an symbol whose definition cannot be found by luals ``` **/neovim/runtime/lua/vim/lsp/util.lua:1685: 'width' key must be a positive Integer ``` To reprodunce, hover on a with this file ```lua ---@type a ``` Haven't reproduced with other lsp but I think it's harmless to PR here.
1 parent c2b2826 commit 7ac2b91

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

script/provider/provider.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,13 @@ m.register 'textDocument/hover' {
369369
if not hover or not source then
370370
return nil
371371
end
372+
local value = tostring(hover)
373+
if #value == 0 then
374+
return nil
375+
end
372376
return {
373377
contents = {
374-
value = tostring(hover),
378+
value = value,
375379
kind = 'markdown',
376380
},
377381
range = converter.packRange(state, source.start, source.finish),

0 commit comments

Comments
 (0)