feat(lsp): sort codelens if multiple item per line (#18951)

This commit is contained in:
rhcher 2022-06-14 01:31:48 +08:00 committed by GitHub
parent e13c36e312
commit 7f8f8d6cb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,6 +133,9 @@ function M.display(lenses, bufnr, client_id)
api.nvim_buf_clear_namespace(bufnr, ns, i, i + 1)
local chunks = {}
local num_line_lenses = #line_lenses
table.sort(line_lenses, function(a, b)
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 ...'
table.insert(chunks, { text, 'LspCodeLens' })