Skip to content

Commit

Permalink
feat(completion): sort versions by latest when completing rock versions
Browse files Browse the repository at this point in the history
  • Loading branch information
vhyrro committed Oct 27, 2023
1 parent 885c58b commit 30c6684
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/rocks/search.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ search.complete_versions = function(name, query)
for _, rock in pairs(matching_rocks) do
unique_versions[rock.version] = rock
end
return vim.tbl_keys(unique_versions)

local unique_keys = vim.tbl_keys(unique_versions)
table.sort(unique_keys, function(a, b)
return a > b
end)
return unique_keys
end

---@param query string | nil
Expand Down

0 comments on commit 30c6684

Please sign in to comment.