mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -07:00
fix(lsp): Add separator between codelens in virttext (#15049)
Before: Lens1Lens2 After: Lens1 | Lens2 Fixes https://github.com/neovim/neovim/issues/15048
This commit is contained in:
parent
0b64d5ecd1
commit
7c61d9c3bf
@ -528,6 +528,9 @@ LspCodeLens
|
||||
Used to color the virtual text of the codelens. See
|
||||
|nvim_buf_set_virtual_text()|.
|
||||
|
||||
LspCodeLensSeparator *hl-LspCodeLensSeparator*
|
||||
Used to color the seperator between two or more code lens.
|
||||
|
||||
*lsp-highlight-signature*
|
||||
|
||||
Highlight groups related to |vim.lsp.handlers.signature_help()|.
|
||||
|
@ -111,12 +111,16 @@ function M.display(lenses, bufnr, client_id)
|
||||
local ns = namespaces[client_id]
|
||||
local num_lines = api.nvim_buf_line_count(bufnr)
|
||||
for i = 0, num_lines do
|
||||
local line_lenses = lenses_by_lnum[i]
|
||||
local line_lenses = lenses_by_lnum[i] or {}
|
||||
api.nvim_buf_clear_namespace(bufnr, ns, i, i + 1)
|
||||
local chunks = {}
|
||||
for _, lens in pairs(line_lenses or {}) do
|
||||
local num_line_lenses = #line_lenses
|
||||
for j, lens in ipairs(line_lenses) do
|
||||
local text = lens.command and lens.command.title or 'Unresolved lens ...'
|
||||
table.insert(chunks, {text, 'LspCodeLens' })
|
||||
if j < num_line_lenses then
|
||||
table.insert(chunks, {' | ', 'LspCodeLensSeparator' })
|
||||
end
|
||||
end
|
||||
if #chunks > 0 then
|
||||
api.nvim_buf_set_virtual_text(bufnr, ns, i, chunks, {})
|
||||
|
Loading…
Reference in New Issue
Block a user