diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2025-01-24 06:44:23 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2025-01-25 22:39:37 +0800 |
| commit | 63aa167f944b147b9d4b8c417a37f4beb212d984 (patch) | |
| tree | fedaaa81b703cc95ff64b40a7f58ede27022ed4b /test | |
| parent | 851137f67905f6038e51b5b7d1490fbedea4faaa (diff) | |
| download | rneovim-63aa167f944b147b9d4b8c417a37f4beb212d984.tar.gz rneovim-63aa167f944b147b9d4b8c417a37f4beb212d984.tar.bz2 rneovim-63aa167f944b147b9d4b8c417a37f4beb212d984.zip | |
vim-patch:9.1.1049: insert-completed items are always sorted
Problem: insert-completed items are always sorted, although the LSP
spec[1] standard defines sortText in the returned
completionitem list. This means that the server has sorted the
results. When fuzzy is enabled, this will break the server's
sorting results.
Solution: disable sorting of candidates when "nosort" is set in
'completeopt'
[1]
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItem
closes: vim/vim#16501
https://github.com/vim/vim/commit/f400a0cc41113eb75516bdd7f38aeaa15208ba2c
Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/old/testdir/test_ins_complete.vim | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim index f1ff45ff90..988b7995ed 100644 --- a/test/old/testdir/test_ins_complete.vim +++ b/test/old/testdir/test_ins_complete.vim @@ -2778,7 +2778,7 @@ func Test_complete_fuzzy_match() if a:findstart return col(".") endif - return [#{word: "foo"}, #{word: "foobar"}, #{word: "fooBaz"}, #{word: "foobala"}] + return [#{word: "foo"}, #{word: "foobar"}, #{word: "fooBaz"}, #{word: "foobala"}, #{word: "你好吗"}, #{word: "我好"}] endfunc new @@ -2837,6 +2837,21 @@ func Test_complete_fuzzy_match() call feedkeys("STe\<C-X>\<C-N>x\<CR>\<Esc>0", 'tx!') call assert_equal('Tex', getline('.')) + " test case for nosort option + set cot=menuone,menu,noinsert,fuzzy,nosort + " fooBaz" should have a higher score when the leader is "fb". + " With `nosort`, "foobar" should still be shown first in the popup menu. + call feedkeys("S\<C-x>\<C-o>fb", 'tx') + call assert_equal('foobar', g:word) + call feedkeys("S\<C-x>\<C-o>好", 'tx') + call assert_equal("你好吗", g:word) + + set cot+=noselect + call feedkeys("S\<C-x>\<C-o>好", 'tx') + call assert_equal(v:null, g:word) + call feedkeys("S\<C-x>\<C-o>好\<C-N>", 'tx') + call assert_equal('你好吗', g:word) + " clean up set omnifunc= bw! |