mirror of
https://github.com/neovim/neovim.git
synced 2026-05-23 21:30:11 +00:00
fix(lsp): util.lua attempt to concatenate userdata #39225
Problem:
Error when querying document symbols using python-lsp-server:
lsp/util.lua:1955: attempt to concatenate field 'containerName' (a userdata value)
Solution:
Check for `vim.NIL`.
This commit is contained in:
@@ -3,6 +3,7 @@ local validate = vim.validate
|
||||
local api = vim.api
|
||||
local list_extend = vim.list_extend
|
||||
local uv = vim.uv
|
||||
local isnil = require('vim._core.util').isnil
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -1986,13 +1987,13 @@ function M.symbols_to_items(symbols, bufnr, position_encoding)
|
||||
local end_lnum = range['end'].line + 1
|
||||
local end_col = get_line_byte_from_position(bufnr, range['end'], position_encoding) + 1
|
||||
|
||||
local is_deprecated = symbol.deprecated
|
||||
or (symbol.tags and vim.tbl_contains(symbol.tags, protocol.SymbolTag.Deprecated))
|
||||
local is_deprecated = not isnil(symbol.deprecated or nil)
|
||||
or (not isnil(symbol.tags) and vim.tbl_contains(symbol.tags, protocol.SymbolTag.Deprecated))
|
||||
local text = string.format(
|
||||
'[%s] %s%s%s',
|
||||
kind,
|
||||
symbol.name,
|
||||
symbol.containerName and ' in ' .. symbol.containerName or '',
|
||||
not isnil(symbol.containerName) and ' in ' .. symbol.containerName or '',
|
||||
is_deprecated and ' (deprecated)' or ''
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user