diff --git a/README.md b/README.md index a149820..027c0a8 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,13 @@ vim's `completeopt` setting. Warning: Be careful when changing this value. 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) A function to customize completion menu. diff --git a/lua/cmp/config/default.lua b/lua/cmp/config/default.lua index d2e830a..9635441 100644 --- a/lua/cmp/config/default.lua +++ b/lua/cmp/config/default.lua @@ -51,6 +51,7 @@ return function() mapping = {}, formatting = { + deprecated = true, format = function(_, vim_item) return vim_item end diff --git a/lua/cmp/entry.lua b/lua/cmp/entry.lua index d4bb146..8623c74 100644 --- a/lua/cmp/entry.lua +++ b/lua/cmp/entry.lua @@ -204,8 +204,10 @@ entry.get_vim_item = function(self, suggest_offset) end -- deprecated - if completion_item.deprecated or vim.tbl_contains(completion_item.tags or {}, types.lsp.CompletionItemTag.Deprecated) then - abbr = str.strikethrough(abbr) + if config.get().formatting.deprecated then + if completion_item.deprecated or vim.tbl_contains(completion_item.tags or {}, types.lsp.CompletionItemTag.Deprecated) then + abbr = str.strikethrough(abbr) + end end -- append delta text diff --git a/lua/cmp/types/cmp.lua b/lua/cmp/types/cmp.lua index d578d1f..2435e88 100644 --- a/lua/cmp/types/cmp.lua +++ b/lua/cmp/types/cmp.lua @@ -75,6 +75,7 @@ cmp.ScrollDirection.Down = 'down' ---@field public comparators function[] ---@class cmp.FormattingConfig +---@field public deprecated boolean ---@field public format fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem ---@class cmp.SnippetConfig