Skip to content

feat(completion): add fuzzycollect - #14976

Closed
glepnir wants to merge 1 commit into
vim:masterfrom
glepnir:fix_2
Closed

glepnir wants to merge 1 commit into
vim:masterfrom
glepnir:fix_2

Conversation

@glepnir

@glepnir glepnir commented Jun 12, 2024 •

Copy link
Copy Markdown
Member

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.

Fix #14912

@glepnir
glepnir marked this pull request as draft June 12, 2024 14:07
@chrisbra

Copy link
Copy Markdown
Member

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.

@habamax

habamax commented Jun 13, 2024

Copy link
Copy Markdown
Contributor

It actually makes sense to apply fuzzy initially when gathering completion candidates as well. At least I would expect it to happen. Also #14921

@glepnir

glepnir commented Jun 13, 2024 •

Copy link
Copy Markdown
Member Author

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. I don't have any opinion with it, because I don't use keyword completion very often. If need support, I will try my best.

@glepnir
glepnir force-pushed the fix_2 branch 2 times, most recently from 25b5353 to e8d0ae9 Compare June 13, 2024 12:24
@glepnir

glepnir commented Jun 13, 2024

Copy link
Copy Markdown
Member Author

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

@glepnir
glepnir marked this pull request as ready for review June 13, 2024 12:44
Comment thread src/testdir/test_ins_complete.vim Outdated
@chrisbra

Copy link
Copy Markdown
Member

alright, convinced :)

Comment thread src/insexpand.c Outdated
Comment thread src/insexpand.c
@glepnir
glepnir force-pushed the fix_2 branch 2 times, most recently from 563a9c9 to a60c1f2 Compare June 14, 2024 06:33
Comment thread src/insexpand.c Outdated
@techntools

Copy link
Copy Markdown

@chrisbra @glepnir

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.

@chrisbra

Copy link
Copy Markdown
Member

so maybe we can use a separate sub-option 'fuzzysearch' for the 'completeopt' option then?

@techntools

Copy link
Copy Markdown

Yes

@Shane-XB-Qian

This comment was marked as off-topic.

@techntools

Copy link
Copy Markdown

Let the people have it if they want it

@Shane-XB-Qian

This comment was marked as off-topic.

@glepnir

glepnir commented Jun 15, 2024

Copy link
Copy Markdown
Member Author

Ping me when there is a result and I will implement it

@chrisbra

Copy link
Copy Markdown
Member

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!

@techntools

Copy link
Copy Markdown

Thanks.

I vote for fuzzycollect.

@Shane-XB-Qian

This comment was marked as off-topic.

@glepnir
glepnir force-pushed the fix_2 branch 2 times, most recently from c84745b to 44e096b Compare June 16, 2024 08:12
@glepnir glepnir changed the title fix(completion): when only fuzzy no completion insert feat(completion): add fuzzycollect Jun 16, 2024
@glepnir
glepnir force-pushed the fix_2 branch 4 times, most recently from 1f6c7e9 to f121421 Compare June 16, 2024 08:47
Comment thread src/testdir/test_ins_complete.vim Outdated
@chrisbra

Copy link
Copy Markdown
Member

so this is ready?

@glepnir

glepnir commented Jun 18, 2024 •

Copy link
Copy Markdown
Member Author

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.

@chrisbra

Copy link
Copy Markdown
Member

No complaints? I take that as a general agreement :) Thanks everybody!

@chrisbra chrisbra closed this in 43eef88 Jun 19, 2024
glepnir added a commit to glepnir/neovim that referenced this pull request Jun 20, 2024
Problem:  cannot use fuzzy keyword completion
          (Maxim Kim)
Solution: add the fuzzycollect value for the 'completeopt'
          setting, to gather matches using fuzzy logic (glepnir)

fixes: vim/vim#14912
closes: vim/vim#14976

vim/vim@43eef88
glepnir added a commit to glepnir/neovim that referenced this pull request Jun 20, 2024
Problem:  cannot use fuzzy keyword completion
          (Maxim Kim)
Solution: add the fuzzycollect value for the 'completeopt'
          setting, to gather matches using fuzzy logic (glepnir)

fixes: vim/vim#14912
closes: vim/vim#14976

vim/vim@43eef88
glepnir added a commit to glepnir/neovim that referenced this pull request Jun 20, 2024
Problem:  cannot use fuzzy keyword completion
          (Maxim Kim)
Solution: add the fuzzycollect value for the 'completeopt'
          setting, to gather matches using fuzzy logic (glepnir)

fixes: vim/vim#14912
closes: vim/vim#14976

vim/vim@43eef88
glepnir added a commit to glepnir/neovim that referenced this pull request Jun 20, 2024
Problem:  cannot use fuzzy keyword completion
          (Maxim Kim)
Solution: add the fuzzycollect value for the 'completeopt'
          setting, to gather matches using fuzzy logic (glepnir)

fixes: vim/vim#14912
closes: vim/vim#14976

vim/vim@43eef88
glepnir added a commit to glepnir/neovim that referenced this pull request Jun 20, 2024
Problem:  cannot use fuzzy keyword completion
          (Maxim Kim)
Solution: add the fuzzycollect value for the 'completeopt'
          setting, to gather matches using fuzzy logic (glepnir)

fixes: vim/vim#14912
closes: vim/vim#14976

vim/vim@43eef88
glepnir added a commit to glepnir/neovim that referenced this pull request Jun 20, 2024
Problem:  cannot use fuzzy keyword completion
          (Maxim Kim)
Solution: add the fuzzycollect value for the 'completeopt'
          setting, to gather matches using fuzzy logic (glepnir)

fixes: vim/vim#14912
closes: vim/vim#14976

vim/vim@43eef88
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jul 10, 2024
vim-patch:9.1.0503: cannot use fuzzy keyword completion

Problem:  cannot use fuzzy keyword completion
          (Maxim Kim)
Solution: add the "fuzzycollect" value for the 'completeopt'
          setting, to gather matches using fuzzy logic (glepnir)

fixes: vim/vim#14912
closes: vim/vim#14976

vim/vim@43eef88

vim-patch:9.1.0549: fuzzycollect regex based completion not working as expected

Problem:  fuzzycollect regex based completion not working as expected
Solution: Revert Patch v9.1.0503 (glepnir)

closes: vim/vim#15192

vim/vim@600a12d

Co-authored-by: glepnir <[email protected]>
zeertzjq added a commit to neovim/neovim that referenced this pull request Jul 10, 2024
vim-patch:9.1.0503: cannot use fuzzy keyword completion

Problem:  cannot use fuzzy keyword completion
          (Maxim Kim)
Solution: add the "fuzzycollect" value for the 'completeopt'
          setting, to gather matches using fuzzy logic (glepnir)

fixes: vim/vim#14912
closes: vim/vim#14976

vim/vim@43eef88

vim-patch:9.1.0549: fuzzycollect regex based completion not working as expected

Problem:  fuzzycollect regex based completion not working as expected
Solution: Revert Patch v9.1.0503 (glepnir)

closes: vim/vim#15192

vim/vim@600a12d

Co-authored-by: glepnir <[email protected]>
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.

can't fuzzy match a single completion candidate

6 participants