fix(lsp): support containerName in symbol requests #35029

The field is present for SymbolInformation and WorkspaceSymbol.
This commit is contained in:
Riley Bruins
2025-07-22 10:30:16 -07:00
committed by GitHub
parent 9fc985bc98
commit 8b5d8dfc73
3 changed files with 12 additions and 7 deletions

View File

@@ -1867,7 +1867,7 @@ end
--- Converts symbols to quickfix list items.
---
---@param symbols lsp.DocumentSymbol[]|lsp.SymbolInformation[] list of symbols
---@param symbols lsp.DocumentSymbol[]|lsp.SymbolInformation[]|lsp.WorkspaceSymbol[] list of symbols
---@param bufnr? integer buffer handle or 0 for current, defaults to current
---@param position_encoding? 'utf-8'|'utf-16'|'utf-32'
--- default to first client of buffer
@@ -1907,8 +1907,13 @@ function M.symbols_to_items(symbols, bufnr, position_encoding)
local is_deprecated = symbol.deprecated
or (symbol.tags and vim.tbl_contains(symbol.tags, protocol.SymbolTag.Deprecated))
local text =
string.format('[%s] %s%s', kind, symbol.name, is_deprecated and ' (deprecated)' or '')
local text = string.format(
'[%s] %s%s%s',
kind,
symbol.name,
symbol.containerName and ' in ' .. symbol.containerName or '',
is_deprecated and ' (deprecated)' or ''
)
items[#items + 1] = {
filename = filename,