fix(picker.lsp): sort document symbols by position

This commit is contained in:
Folke Lemaitre 2025-02-07 09:14:06 +01:00
parent 1eaeafe1a9
commit cc22177dcf
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -375,6 +375,12 @@ function M.symbols(opts, ctx)
return want(M.symbol_kind(item.kind))
end,
})
table.sort(items, function(a, b)
if a.pos[1] == b.pos[1] then
return a.pos[2] < b.pos[2]
end
return a.pos[1] < b.pos[1]
end)
for _, item in ipairs(items) do
item.tree = opts.tree
item.buf = bufmap[item.file]