mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
feat(lsp): lsp.completion support set deprecated (#29882)
Problem: CompletionItem in lsp spec mentioned the deprecated attribute Solution: when item has deprecated attribute set hl_group to DiagnosticDeprecated in complete function
This commit is contained in:
@@ -253,6 +253,13 @@ function M._lsp_to_complete_items(result, prefix, client_id)
|
||||
for _, item in ipairs(items) do
|
||||
if matches(item) then
|
||||
local word = get_completion_word(item)
|
||||
local hl_group = ''
|
||||
if
|
||||
item.deprecated
|
||||
or vim.list_contains((item.tags or {}), protocol.CompletionTag.Deprecated)
|
||||
then
|
||||
hl_group = 'DiagnosticDeprecated'
|
||||
end
|
||||
table.insert(candidates, {
|
||||
word = word,
|
||||
abbr = item.label,
|
||||
@@ -262,6 +269,7 @@ function M._lsp_to_complete_items(result, prefix, client_id)
|
||||
icase = 1,
|
||||
dup = 1,
|
||||
empty = 1,
|
||||
hl_group = hl_group,
|
||||
user_data = {
|
||||
nvim = {
|
||||
lsp = {
|
||||
|
Reference in New Issue
Block a user