diff --git a/lua/care/presets/utils.lua b/lua/care/presets/utils.lua index 9b5023f..8a2171e 100644 --- a/lua/care/presets/utils.lua +++ b/lua/care/presets/utils.lua @@ -57,4 +57,17 @@ function PresetUtils.kind_highlight(entry, style) return style == "fg" and ("@care.type.fg.%s"):format(entry_kind) or ("@care.type.blended.%s"):format(entry_kind) end +function PresetUtils.get_label_detail(entry) + local label_detail = "" + if entry.completion_item.labelDetails then + if entry.completion_item.labelDetails.detail then + label_detail = label_detail .. entry.completion_item.labelDetails.detail + end + if entry.completion_item.labelDetails.description then + label_detail = label_detail .. entry.completion_item.labelDetails.description + end + end + return label_detail +end + return PresetUtils diff --git a/lua/care/types/preset_utils.lua b/lua/care/types/preset_utils.lua index 9b95a72..2750314 100644 --- a/lua/care/types/preset_utils.lua +++ b/lua/care/types/preset_utils.lua @@ -13,3 +13,6 @@ --- With this function you can get the kind highlight group for a specific entry. The style can either be foreground --- or blended. ---@field kind_highlight fun(entry: care.entry, style: "fg"|"blended"): string +--- Gets the label detail if provided by the language serve. +--- This is equivalent to the `vim_item.menu` from nvim-cmp +---@field get_label_detail fun(entry: care.entry): string