mirror of
https://github.com/neovim/neovim.git
synced 2025-11-03 09:14:24 +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:
@@ -307,6 +307,7 @@ describe('vim.lsp.completion: item conversion', function()
|
||||
info = '',
|
||||
kind = 'Module',
|
||||
menu = '',
|
||||
hl_group = '',
|
||||
word = 'this_thread',
|
||||
}
|
||||
local result = complete(' std::this|', completion_list)
|
||||
@@ -362,6 +363,7 @@ describe('vim.lsp.completion: item conversion', function()
|
||||
info = '',
|
||||
kind = 'Module',
|
||||
menu = '',
|
||||
hl_group = '',
|
||||
word = 'this_thread',
|
||||
}
|
||||
local result = complete(' std::this|is', completion_list)
|
||||
@@ -529,6 +531,14 @@ describe('vim.lsp.completion: protocol', function()
|
||||
{
|
||||
label = 'hello',
|
||||
},
|
||||
{
|
||||
label = 'hercules',
|
||||
tags = { 1 }, -- 1 represents Deprecated tag
|
||||
},
|
||||
{
|
||||
label = 'hero',
|
||||
deprecated = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -545,6 +555,7 @@ describe('vim.lsp.completion: protocol', function()
|
||||
info = '',
|
||||
kind = 'Unknown',
|
||||
menu = '',
|
||||
hl_group = '',
|
||||
user_data = {
|
||||
nvim = {
|
||||
lsp = {
|
||||
@@ -557,6 +568,50 @@ describe('vim.lsp.completion: protocol', function()
|
||||
},
|
||||
word = 'hello',
|
||||
},
|
||||
{
|
||||
abbr = 'hercules',
|
||||
dup = 1,
|
||||
empty = 1,
|
||||
icase = 1,
|
||||
info = '',
|
||||
kind = 'Unknown',
|
||||
menu = '',
|
||||
hl_group = 'DiagnosticDeprecated',
|
||||
user_data = {
|
||||
nvim = {
|
||||
lsp = {
|
||||
client_id = 1,
|
||||
completion_item = {
|
||||
label = 'hercules',
|
||||
tags = { 1 },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
word = 'hercules',
|
||||
},
|
||||
{
|
||||
abbr = 'hero',
|
||||
dup = 1,
|
||||
empty = 1,
|
||||
icase = 1,
|
||||
info = '',
|
||||
kind = 'Unknown',
|
||||
menu = '',
|
||||
hl_group = 'DiagnosticDeprecated',
|
||||
user_data = {
|
||||
nvim = {
|
||||
lsp = {
|
||||
client_id = 1,
|
||||
completion_item = {
|
||||
label = 'hero',
|
||||
deprecated = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
word = 'hero',
|
||||
},
|
||||
}, matches)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user