feat: allow more completion highlight control (#1972)
* feat(view): allow hl_group to be a table * feat: improve table field naming
This commit is contained in:
committed by
GitHub
parent
88661b7cbf
commit
29fb485457
@@ -70,13 +70,28 @@ custom_entries_view.new = function()
|
||||
if field == types.cmp.ItemField.Abbr then
|
||||
a = o
|
||||
end
|
||||
vim.api.nvim_buf_set_extmark(buf, custom_entries_view.ns, i, o, {
|
||||
end_line = i,
|
||||
end_col = o + v[field].bytes,
|
||||
hl_group = v[field].hl_group,
|
||||
hl_mode = 'combine',
|
||||
ephemeral = true,
|
||||
})
|
||||
|
||||
if type(v[field].hl_group) == 'table' then
|
||||
for _, extmark in ipairs(v[field].hl_group) do
|
||||
local hl_start, hl_end = unpack(extmark.range)
|
||||
vim.api.nvim_buf_set_extmark(buf, custom_entries_view.ns, i, o + hl_start, {
|
||||
end_line = i,
|
||||
end_col = o + hl_end,
|
||||
hl_group = extmark[1],
|
||||
hl_eol = false,
|
||||
ephemeral = true,
|
||||
})
|
||||
end
|
||||
else
|
||||
vim.api.nvim_buf_set_extmark(buf, custom_entries_view.ns, i, o, {
|
||||
end_line = i,
|
||||
end_col = o + v[field].bytes,
|
||||
hl_group = v[field].hl_group,
|
||||
hl_mode = 'combine',
|
||||
ephemeral = true,
|
||||
})
|
||||
end
|
||||
|
||||
o = o + v[field].bytes + (self.column_width[field] - v[field].width) + 1
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user