fix(picker.lsp): only sort when not getting workspace symbols. Closes #1071

This commit is contained in:
Folke Lemaitre 2025-02-11 10:18:18 +01:00
parent 6e0962a82e
commit d607d2e050
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -356,12 +356,14 @@ function M.symbols(opts, ctx)
})
-- Fix sorting
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)
if not opts.workspace then
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)
end
-- fix last
local last = {} ---@type table<snacks.picker.finder.Item, snacks.picker.finder.Item>