Skip to content

Commit

Permalink
neovim: revert to default nvim-cmp sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
geodimm committed Nov 13, 2024
1 parent 685cfb0 commit 5360e8a
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions nvim/lua/plugins/autocompletion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ return {
'hrsh7th/nvim-cmp',
config = function()
local cmp = require('cmp')
local compare = require('cmp.config.compare')
local context = require('cmp.config.context')
local types = require('cmp.types')
local luasnip = require('luasnip')
local lspkind = require('lspkind')
local cmp_git = require('cmp_git')
Expand Down Expand Up @@ -37,27 +35,6 @@ return {
end
end

local function custom_kind_comparator(entry1, entry2)
local kind1 = entry1:get_kind()
local kind2 = entry2:get_kind()
kind1 = kind1 == types.lsp.CompletionItemKind.Text and 100 or kind1
kind2 = kind2 == types.lsp.CompletionItemKind.Text and 100 or kind2
if kind1 ~= kind2 then
if kind1 == types.lsp.CompletionItemKind.Snippet then
return false
end
if kind2 == types.lsp.CompletionItemKind.Snippet then
return true
end
local diff = kind1 - kind2
if diff < 0 then
return true
elseif diff > 0 then
return false
end
end
end

cmp.setup({
enabled = function()
local disabled = false
Expand Down Expand Up @@ -120,23 +97,6 @@ return {
end,
},

sorting = {
priority_weight = 2,
comparators = {
compare.exact,
compare.offset,
-- compare.scopes,
compare.score,
-- compare.recently_used,
-- compare.locality,
-- compare.kind,
custom_kind_comparator,
compare.sort_text,
compare.length,
compare.order,
},
},

sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'nvim_lsp_signature_help' },
Expand Down

0 comments on commit 5360e8a

Please sign in to comment.