mirror of
https://github.com/neovim/neovim.git
synced 2025-11-23 10:36:29 +00:00
lsp: Fix bad sortText comparison (#12485)
The spec indicates we have to fallback to comparing by label if sortText is falsy. Closes #12431
This commit is contained in:
@@ -299,10 +299,9 @@ end
|
||||
---
|
||||
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
|
||||
local function sort_completion_items(items)
|
||||
if items[1] and items[1].sortText then
|
||||
table.sort(items, function(a, b) return a.sortText < b.sortText
|
||||
end)
|
||||
end
|
||||
table.sort(items, function(a, b)
|
||||
return (a.sortText or a.label) < (b.sortText or b.label)
|
||||
end)
|
||||
end
|
||||
|
||||
--@private
|
||||
|
||||
Reference in New Issue
Block a user