commit 7f8f8d6cb7874369c36553cd8cc500de1b572b31
parent e13c36e312a9128f5c2ffd5a444939efc43bc0b5
Author: rhcher <kaer41@qq.com>
Date: Tue, 14 Jun 2022 01:31:48 +0800
feat(lsp): sort codelens if multiple item per line (#18951)
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua
@@ -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' })