initial attempt we can generate a fuzzy matching regular expression here and give it to searchit. then keyword completion CTRL-N CTRL-P can get a fuzzy result and set into match array. currently multi-byte characters need to be processed
Fix #14912
https://github.com/vim/vim/pull/14976
(2 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
I am not sure we should go this way. I thought the idea is to generate the list of candidates normally (without considering fuzzy) and apply the fuzzying only once the completion list has been show to reduce the number of items shown in the popup? So after the completion menu has been shown with all matches initially?
Otherwiese I am not sure it makes sense for completion methods like thesaurus completion, whole line completion, dictionary, spelling or tags completion. In the end, that's why we have different completion methods for and if you want to gather a list of completions using fuzzy matching, one can omni-completion or user-defined completion.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
It actually makes sense to apply fuzzy initially when gathering completion candidates as well. At least I would expect it to happen. Also #14921
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
removing edit on get_normal_compl_info
will fix the problem of keyword not being completed when completeopt set fuzzy but doesn't include menu/menuone.
I am not sure we should go this way. I thought the idea is to generate the list of candidates normally (without considering fuzzy) and apply the fuzzying only once the completion list has been show to reduce the number of items shown in the popup? So after the completion menu has been shown with all matches initially?
Internally we differentiate between completion behaviors and modes. But for users they think they are all the same, so that's why they want to see fuzzy results in some default completions as well.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@glepnir pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
I tried to make fuzzy support for original pattern at the end. It works fine. But I don't use some default completions very often. So not sure if it's broken or some patterns don't work. Might need some testing and feedback. Thanks
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
In src/testdir/test_ins_complete.vim:
> @@ -2566,6 +2566,15 @@ func Test_complete_fuzzy_match() call feedkeys("S\<C-x>\<C-o>fb\<C-n>", 'tx') call assert_equal('fooBaz', g:word) + set completeopt=fuzzy
The 'completeopt' here includes fuzzy
but not menu
. Is this intended?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@glepnir commented on this pull request.
In src/testdir/test_ins_complete.vim:
> @@ -2566,6 +2566,15 @@ func Test_complete_fuzzy_match() call feedkeys("S\<C-x>\<C-o>fb\<C-n>", 'tx') call assert_equal('fooBaz', g:word) + set completeopt=fuzzy
yup .when no menu it will complete the word directly before .so i just set it to fuzzy
to check this behavior..
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
alright, convinced :)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@chrisbra commented on this pull request.
In src/insexpand.c:
> @@ -4606,11 +4611,38 @@ get_normal_compl_info(char_u *line, int startcol, colnr_T curs_col) STRCPY((char *)compl_pattern, "\\<"); (void)quote_meta(compl_pattern + 2, line + compl_col, compl_length); - } + } +
hm, whitespace change?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
In src/insexpand.c:
> } compl_patternlen = STRLEN(compl_pattern); + if (compl_fuzzy_match) + { + // Adjust size to avoid buffer overflow + fuzzy_len = (size_t)compl_length * 4 + 5; + // Allocate enough space + fuzzy_pattern = alloc(fuzzy_len);
Need to check for NULL
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
> @@ -4606,11 +4611,42 @@ get_normal_compl_info(char_u *line, int startcol, colnr_T curs_col) STRCPY((char *)compl_pattern, "\\<"); (void)quote_meta(compl_pattern + 2, line + compl_col, compl_length); - } + }
Why is the Tab changed into spaces here?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Thanks for this feature.
My primary completion method is keyword completion. When I start typing I am fairly certain about first character of the word I want to be completed. I get the candidates starting with that character and fuzzy match the word I want.
Too many candidates will be generated if we generate them as well with fuzzy. Which may slow down the completion. I would suggest generate candidates with fuzzy under another option such as fuzzysearch
.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
so maybe we can use a separate sub-option 'fuzzysearch' for the 'completeopt' option then?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Yes
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Let the people have it if they want it
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Ping me when there is a result and I will implement it
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
yeah, let's have another option value for 'completeopt' that determines how the candidates for the completion-menu are collected. It may be called 'fuzzysearch' or 'fuzzycollect' then (not good on names), but it seems good to give people the chance on how they want the completion to work. Thanks!
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Thanks.
I vote for fuzzycollect
.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
yeah, let's have another option value for 'completeopt' that determines how the candidates for the completion-menu are collected. It may be called 'fuzzysearch' or 'fuzzycollect' then (not good on names), but it seems good to give people the chance on how they want the completion to work. Thanks!
ok, so 'fuzzy' of completeopt do only filter, right? seems ok, if so.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
In src/testdir/test_ins_complete.vim:
> @@ -2599,7 +2630,7 @@ func Test_complete_fuzzy_match() unlet g:word endfunc -" Check that tie breaking is stable for completeopt+=fuzzy (which should +" Check that tie breaking is stable for completeopt+=fuzzycollect (which should
?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@glepnir commented on this pull request.
In src/testdir/test_ins_complete.vim:
> @@ -2599,7 +2630,7 @@ func Test_complete_fuzzy_match() unlet g:word endfunc -" Check that tie breaking is stable for completeopt+=fuzzy (which should +" Check that tie breaking is stable for completeopt+=fuzzycollect (which should
emm this test can be safe remove right ? sry for typo
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@zeertzjq commented on this pull request.
In src/testdir/test_ins_complete.vim:
> @@ -2599,7 +2630,7 @@ func Test_complete_fuzzy_match() unlet g:word endfunc -" Check that tie breaking is stable for completeopt+=fuzzy (which should +" Check that tie breaking is stable for completeopt+=fuzzycollect (which should
Why remove?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@glepnir pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@glepnir commented on this pull request.
In src/testdir/test_ins_complete.vim:
> @@ -2599,7 +2630,7 @@ func Test_complete_fuzzy_match() unlet g:word endfunc -" Check that tie breaking is stable for completeopt+=fuzzy (which should +" Check that tie breaking is stable for completeopt+=fuzzycollect (which should
fuzzy not work for this keyword compleiton mode. It seems a bit redundant. but there is no harm in keeping it
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@Shane-XB-Qian commented on this pull request.
In src/testdir/test_ins_complete.vim:
> @@ -2599,7 +2630,7 @@ func Test_complete_fuzzy_match() unlet g:word endfunc -" Check that tie breaking is stable for completeopt+=fuzzy (which should +" Check that tie breaking is stable for completeopt+=fuzzycollect (which should
um.. you may mis-understand, fuzzy
of completeopt is to support for (filter) all kinds compl included keyword, vs/but to e.g keyword compl mode maybe not recommend using fuzzycollect
.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
You are receiving this because you are subscribed to this thread.
so this is ready?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Any other questions about the code? @zeertzjq I'm not sure if this is a result of discussion, fuzzycollect
is used for some completion modes that use regular expressions to get matching results right ? feel like the fuzzyclloect
is a bit long :) if LGTY then is ready.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
No complaints? I take that as a general agreement :) Thanks everybody!
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.