fix(lsp): hide layout in codelenses in virtual text (#28794) (#28895)

Problem: layout i.e. whitespace that is part of codelenses is currently
displayed as weird symbols and large amounts of spaces

Solution: replace all consecutive whitespace symbols with a single space
character when trying to display codelenses as virtual text

(cherry picked from commit d9a2acdab3)

Co-authored-by: Mango The Fourth <40720523+MangoIV@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2024-05-21 18:41:55 +02:00
committed by GitHub
parent 4f0c4c3921
commit efe8a0a520

View File

@ -164,7 +164,7 @@ function M.display(lenses, bufnr, client_id)
return a.range.start.character < b.range.start.character
end)
for j, lens in ipairs(line_lenses) do
local text = lens.command and lens.command.title or 'Unresolved lens ...'
local text = (lens.command and lens.command.title or 'Unresolved lens ...'):gsub('%s+', ' ')
table.insert(chunks, { text, 'LspCodeLens' })
if j < num_line_lenses then
table.insert(chunks, { ' | ', 'LspCodeLensSeparator' })