(feat) Custom item kinds (#1003)
This commit is contained in:
@@ -269,10 +269,13 @@ entry.get_vim_item = function(self, suggest_offset)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local cmp_opts = self:get_completion_item().cmp or {}
|
||||||
|
|
||||||
local vim_item = {
|
local vim_item = {
|
||||||
word = word,
|
word = word,
|
||||||
abbr = abbr,
|
abbr = abbr,
|
||||||
kind = types.lsp.CompletionItemKind[self:get_kind()] or types.lsp.CompletionItemKind[1],
|
kind = cmp_opts.kind_text or types.lsp.CompletionItemKind[self:get_kind()] or types.lsp.CompletionItemKind[1],
|
||||||
|
kind_hl_group = cmp_opts.kind_hl_group,
|
||||||
menu = menu,
|
menu = menu,
|
||||||
dup = self:get_completion_item().dup or 1,
|
dup = self:get_completion_item().dup or 1,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,6 +170,10 @@ lsp.CompletionItemKind = vim.tbl_add_reverse_lookup(lsp.CompletionItemKind)
|
|||||||
---@field public detail string|nil
|
---@field public detail string|nil
|
||||||
---@field public description string|nil
|
---@field public description string|nil
|
||||||
|
|
||||||
|
---@class lsp.Cmp
|
||||||
|
---@field public kind_text string
|
||||||
|
---@field public kind_hl_group string
|
||||||
|
|
||||||
---@class lsp.CompletionItem
|
---@class lsp.CompletionItem
|
||||||
---@field public label string
|
---@field public label string
|
||||||
---@field public labelDetails lsp.CompletionItemLabelDetails|nil
|
---@field public labelDetails lsp.CompletionItemLabelDetails|nil
|
||||||
@@ -189,6 +193,7 @@ lsp.CompletionItemKind = vim.tbl_add_reverse_lookup(lsp.CompletionItemKind)
|
|||||||
---@field public commitCharacters string[]|nil
|
---@field public commitCharacters string[]|nil
|
||||||
---@field public command lsp.Command|nil
|
---@field public command lsp.Command|nil
|
||||||
---@field public data any|nil
|
---@field public data any|nil
|
||||||
|
---@field public cmp lsp.Cmp|nil
|
||||||
---
|
---
|
||||||
---TODO: Should send the issue for upstream?
|
---TODO: Should send the issue for upstream?
|
||||||
---@field public word string|nil
|
---@field public word string|nil
|
||||||
|
|||||||
Reference in New Issue
Block a user