mirror of
https://github.com/neovim/neovim.git
synced 2026-05-01 11:34:56 +00:00
fix(lsp): handle non-string documentation in completion items #38291
Problem: `get_doc` throws error with "attempt to get length of a userdata value" when `item.documentation` is truthy but not a string (e.g. vim.NIL from a JSON null). Solution: Check `type(item.documentation)` before taking its length.
This commit is contained in:
@@ -261,7 +261,7 @@ local function get_doc(item)
|
||||
if
|
||||
has_completeopt('popup')
|
||||
and item.insertTextFormat == protocol.InsertTextFormat.Snippet
|
||||
and #(item.documentation or '') == 0
|
||||
and (type(item.documentation) ~= 'string' or #item.documentation == 0)
|
||||
and vim.bo.filetype ~= ''
|
||||
and (item.textEdit or (item.insertText and item.insertText ~= ''))
|
||||
then
|
||||
|
||||
Reference in New Issue
Block a user