aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/completion.lua
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2024-07-31 22:15:34 +0800
committerGitHub <noreply@github.com>2024-07-31 16:15:34 +0200
commit4e90bc30237ae81bf15e77c17ac8089a2cc74046 (patch)
tree1a11de1e060570c562fbe59092322ddec45e6be9 /runtime/lua/vim/lsp/completion.lua
parent573a71469d37cc35f72bfc929f4ce1156833df9f (diff)
downloadrneovim-4e90bc30237ae81bf15e77c17ac8089a2cc74046.tar.gz
rneovim-4e90bc30237ae81bf15e77c17ac8089a2cc74046.tar.bz2
rneovim-4e90bc30237ae81bf15e77c17ac8089a2cc74046.zip
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
Diffstat (limited to 'runtime/lua/vim/lsp/completion.lua')
-rw-r--r--runtime/lua/vim/lsp/completion.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua
index 1078e3eb7e..6a6659fd25 100644
--- a/runtime/lua/vim/lsp/completion.lua
+++ b/runtime/lua/vim/lsp/completion.lua
@@ -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 = {