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

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
This commit is contained in:
Mango The Fourth
2024-05-21 18:23:37 +02:00
committed by GitHub
parent ad191be65e
commit d9a2acdab3

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' })