Skip to content

Conversation

girishji
Copy link
Contributor

@girishji girishji commented Oct 5, 2025

Fixes #18488

NOTE: If completion items are already fuzzy-sorted during collection (for example, when a user or omni function returns a pre-sorted list), an additional redundant sort will still occur within the completion mechanism. This is harmless — the list is typically small, and the sorting operation (O(N log N)) remains efficient even for linked lists. No need for premature optimization.

Fixes vim#18488

NOTE: If completion items are already fuzzy-sorted during collection (for
example, when a user or omni function returns a pre-sorted list), an
additional redundant sort will still occur within the completion mechanism.
This is harmless — the list is typically small, and the sorting operation (O(N
log N)) remains efficient even for linked lists. No need for premature
optimization.
@ddad431
Copy link

ddad431 commented Oct 6, 2025

This pr give sorted list is different with typing resorted list. It seems that there is no sorting between the sources? Is this expected or an error?

set cfc=keyword cot+=noselect,fuzzy
augroup group_vim_ins_completion
    autocmd!
    autocmd FileType vim
                \ setlocal omnifunc=vimcomplete#Complete |
                \ setlocal complete+=o^7
augroup END

before
image

resort by <C-h><BeforeChar>
image

this pr
image

M  src/insexpand.c
M  src/testdir/test_ins_complete.vim
@girishji
Copy link
Contributor Author

girishji commented Oct 6, 2025

There was a bug. Pl. try now.

@ddad431
Copy link

ddad431 commented Oct 6, 2025

I have tested, no problem.

@chrisbra
Copy link
Member

chrisbra commented Oct 6, 2025

thanks

@chrisbra chrisbra closed this in 10aa04e Oct 6, 2025
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Oct 7, 2025
Problem:  completion: fuzzy candidates are not sorted
          (ddad431)
Solution: Always sort fuzzy candidates (Girish Palya)

fixes: vim/vim#18488
closes: vim/vim#18497

vim/vim@10aa04e

Co-authored-by: Girish Palya <girishji@gmail.com>
zeertzjq added a commit to neovim/neovim that referenced this pull request Oct 7, 2025
Problem:  completion: fuzzy candidates are not sorted
          (ddad431)
Solution: Always sort fuzzy candidates (Girish Palya)

fixes: vim/vim#18488
closes: vim/vim#18497

vim/vim@10aa04e

Co-authored-by: Girish Palya <girishji@gmail.com>
@girishji
Copy link
Contributor Author

girishji commented Oct 7, 2025

Thanks

@girishji girishji deleted the fuzzysort branch October 7, 2025 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

completion(fuzzy sorting): give opt to allow fuzzy sorting when the completion menu first opens
3 participants