Fix #589
This commit is contained in:
@@ -383,6 +383,8 @@ completion.autocomplete~
|
||||
formatting.format~
|
||||
`fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem`
|
||||
The function to customize the completion menu appearance. See |complete-items|.
|
||||
NOTE: The `vim.CompletedItem` can have special properties `abbr_hl_group`,
|
||||
`kind_hl_group` and `menu_hl_group`.
|
||||
|
||||
*cmp-config.formatting.fields*
|
||||
formatting.fields~
|
||||
|
||||
@@ -213,17 +213,17 @@ entry.get_view = function(self, suggest_offset, entries_buf)
|
||||
view.abbr.text = item.abbr or ''
|
||||
view.abbr.bytes = #view.abbr.text
|
||||
view.abbr.width = vim.fn.strdisplaywidth(view.abbr.text)
|
||||
view.abbr.hl_group = self:is_deprecated() and 'CmpItemAbbrDeprecated' or 'CmpItemAbbr'
|
||||
view.abbr.hl_group = item.abbr_hl_group or (self:is_deprecated() and 'CmpItemAbbrDeprecated' or 'CmpItemAbbr')
|
||||
view.kind = {}
|
||||
view.kind.text = item.kind or ''
|
||||
view.kind.bytes = #view.kind.text
|
||||
view.kind.width = vim.fn.strdisplaywidth(view.kind.text)
|
||||
view.kind.hl_group = 'CmpItemKind' .. (types.lsp.CompletionItemKind[self:get_kind()] or '')
|
||||
view.kind.hl_group = item.kind_hl_group or ('CmpItemKind' .. (types.lsp.CompletionItemKind[self:get_kind()] or ''))
|
||||
view.menu = {}
|
||||
view.menu.text = item.menu or ''
|
||||
view.menu.bytes = #view.menu.text
|
||||
view.menu.width = vim.fn.strdisplaywidth(view.menu.text)
|
||||
view.menu.hl_group = 'CmpItemMenu'
|
||||
view.menu.hl_group = item.menu_hl_group or 'CmpItemMenu'
|
||||
view.dup = item.dup
|
||||
end)
|
||||
return view
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
---@field public empty "1"|nil
|
||||
---@field public dup "1"|nil
|
||||
---@field public id any
|
||||
---@field public abbr_hl_group string|nil
|
||||
---@field public kind_hl_group string|nil
|
||||
---@field public menu_hl_group string|nil
|
||||
|
||||
---@class vim.Position
|
||||
---@field public row number
|
||||
|
||||
Reference in New Issue
Block a user