Preset Components
This module contains some high-level components for easily creating format_entry
functions.
format_entry = function(entry, data)
local preset_components = require("care.presets.components")
return {
preset_components.<component_name>(<component_parameters>),
preset_components.<component_name>(<component_parameters>),
}
end
care.preset_components
Methods
ShortcutLabel
preset_components.ShortcutLabel(labels: string[], entry: care.entry, data: care.format_data, highlight_group?: string): { [1]: string, [2]: string }[]
See care.entry
This adds a label for shortcuts described here. By default this will
use the Comment
highlight group. This can be overridden though.
KindIcon
preset_components.KindIcon(entry: care.entry, style?: "blended"|"fg"): { [1]: string, [2]: string }[]
See care.entry
This components displays a kind icon. You can choose between the blended and foreground style.
Label
preset_components.Label(entry: care.entry, data: care.format_data, display_colored_block?: boolean): { [1]: string, [2]: string }[]
See care.entry
This adds a completion item label to be displayed. Optionally this can also include a colored block if the items is a color and we know the value of the color.
ColoredBlock
preset_components.ColoredBlock(entry: care.entry, character?: string): { [1]: string, [2]: string }[]
See care.entry
This component adds a colored block for the item if it is a color. The character used for the block can optionally be configured.
Padding
preset_components.Padding(size: integer): { [1]: string, [2]: string }[]
This function is used to add padding. Use the parameter to determine the width.
KindName
preset_components.KindName(entry: care.entry, use_kind_color: boolean, highlight_group: string?): { [1]: string, [2]: string }[]
See care.entry
This component allows to display the kind of the completion item as a string. You can use the second parameter to choose whether the string should be highlighted with the color of the kind or if it should just use a given highlight group which can be given with the 3rd parameter.