Add formatting.deprecated option

This commit is contained in:
hrsh7th
2021-08-24 22:59:39 +09:00
parent fc31a7e8ef
commit 2f0f5f3a91
4 changed files with 13 additions and 2 deletions

View File

@@ -51,6 +51,7 @@ return function()
mapping = {},
formatting = {
deprecated = true,
format = function(_, vim_item)
return vim_item
end

View File

@@ -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

View File

@@ -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