Add formatting.deprecated option
This commit is contained in:
@@ -195,6 +195,13 @@ vim's `completeopt` setting. Warning: Be careful when changing this value.
|
|||||||
Default: `menu,menuone,noselect`
|
Default: `menu,menuone,noselect`
|
||||||
|
|
||||||
|
|
||||||
|
### formatting.deprecated (type: boolean)
|
||||||
|
|
||||||
|
Specify deprecated candidate should be marked as deprecated or not.
|
||||||
|
|
||||||
|
Default: `true`
|
||||||
|
|
||||||
|
|
||||||
### formatting.format (type: fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem)
|
### formatting.format (type: fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem)
|
||||||
|
|
||||||
A function to customize completion menu.
|
A function to customize completion menu.
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ return function()
|
|||||||
mapping = {},
|
mapping = {},
|
||||||
|
|
||||||
formatting = {
|
formatting = {
|
||||||
|
deprecated = true,
|
||||||
format = function(_, vim_item)
|
format = function(_, vim_item)
|
||||||
return vim_item
|
return vim_item
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -204,8 +204,10 @@ entry.get_vim_item = function(self, suggest_offset)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- deprecated
|
-- deprecated
|
||||||
if completion_item.deprecated or vim.tbl_contains(completion_item.tags or {}, types.lsp.CompletionItemTag.Deprecated) then
|
if config.get().formatting.deprecated then
|
||||||
abbr = str.strikethrough(abbr)
|
if completion_item.deprecated or vim.tbl_contains(completion_item.tags or {}, types.lsp.CompletionItemTag.Deprecated) then
|
||||||
|
abbr = str.strikethrough(abbr)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- append delta text
|
-- append delta text
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ cmp.ScrollDirection.Down = 'down'
|
|||||||
---@field public comparators function[]
|
---@field public comparators function[]
|
||||||
|
|
||||||
---@class cmp.FormattingConfig
|
---@class cmp.FormattingConfig
|
||||||
|
---@field public deprecated boolean
|
||||||
---@field public format fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem
|
---@field public format fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem
|
||||||
|
|
||||||
---@class cmp.SnippetConfig
|
---@class cmp.SnippetConfig
|
||||||
|
|||||||
Reference in New Issue
Block a user