Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit 78582e1

Browse files
committed
fix: few minor issue with sorting
1 parent 6c63530 commit 78582e1

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

lua/completion/complete.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ M.performComplete = function(complete_source, complete_items_map, manager, bufnr
5555
if checkCallback(callback_array) == true and timer:is_closing() == false then
5656
if api.nvim_get_mode()['mode'] == 'i' or api.nvim_get_mode()['mode'] == 'ic' then
5757
local items = getCompletionItems(items_array, prefix)
58-
util.sort_completion_items(items)
58+
if vim.g.completion_sorting ~= "none" then
59+
util.sort_completion_items(items)
60+
end
5961
if vim.g.completion_max_items ~= nil then
6062
items = { unpack(items, 1, vim.g.completion_max_items)}
6163
end

lua/completion/util.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ local function remove_unmatch_completion_items(items, prefix)
3131
end
3232

3333
function M.sort_completion_items(items)
34-
if vim.g.completion_sorting == 'none' then
35-
return
36-
end
3734
table.sort(items, function(a, b)
3835
if a.priority ~= b.priority and a.priority ~= nil and b.priority ~= nil then
3936
return a.priority > b.priority

plugin/completion.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if !exists('g:completion_timer_cycle')
6666
endif
6767

6868
if ! exists('g:completion_sorting')
69-
let g:completion_sorting = 'length'
69+
let g:completion_sorting = 'alphabet'
7070
endif
7171

7272
if ! exists('g:completion_sorted_alphabetically')

0 commit comments

Comments
 (0)