Skip to content

can't fuzzy match a single completion candidate #14912

Closed

Description

@habamax

Steps to reproduce

  1. run barebone vim with vim -Nu NONE
  2. :set completeopt+=fuzzy
  3. add line xyz
  4. on the next line type x and press CTRL-N

I would expect it to complete xyz. It doesn't happen.

image

Expected behaviour

xyz should be completed as withoug fuzzy

Version of Vim

9.1.465

Environment

debian 12

Logs and stack traces

No response

Activity

  1. habamax commented on Jun 4, 2024

    @habamax
    ContributorAuthor
  2. glepnir commented on Jun 4, 2024

    @glepnir
    Member

    Issues description are not as detailed as we discussed in the commit section.

    1. does fuzzy should works like menuone when only have one matched item.
    2. not work when use normal completion <C-N>/<C-p> reproduce step
    xyz
    yxz
    
    x |-> Press C-n
    

    thanks for report

  3. chrisbra commented on Jun 4, 2024

    @chrisbra
    Member

    Wait, not sure I understand. We added fuzzy to 'completeopt' option. That is about how vim handles the completion menu and list of already existing candidates. So my understand for fuzzy was, when enabled, the reduction of the list of candidates happens by fuzzy matching, but how the list of candidates is created is depends on what kind of completion mode was used (e.g. those of i_CTRL-X mappings). One may use fuzzy-completion there as well (using a custom omni-completion), but you may as well simply use regex based search of atoms inside the current buffer of make use of the dictionary.

    So given that, I would expect that completeopt+=fuzzy doesn't make a difference for
    x<C-N> since the list of candidates is build using default keyword local completion (even when there is only 1 candidate).

  4. chrisbra commented on Jun 4, 2024

    @chrisbra
    Member

    I made a small change to the doc 2a2c4ff on how this should work. I hope we can make it work then as documented.

  5. habamax commented on Jun 12, 2024

    @habamax
    ContributorAuthor

    It is actually a bit worse. It can't complete at all if menu is not in completeopt:

    asciicast

  6. glepnir commented on Jun 12, 2024

    @glepnir
    Member

    emm okay .. i am working on it.

  7. glepnir commented on Jun 12, 2024

    @glepnir
  8. habamax commented on Jun 12, 2024

    @habamax
    ContributorAuthor

    Is this patch against the master branch here? git apply fails...

  9. glepnir commented on Jun 12, 2024

    @glepnir
    Member

    latest commit of master.

  10. habamax commented on Jun 12, 2024

    @habamax
    ContributorAuthor

    applied patch manually:

    1. same thing with set completeopt=fuzzy it doesn't complete
    2. after several presses of C-n and C-p I've got segmentation fault

    image

  11. glepnir commented on Jun 12, 2024

    @glepnir
    Member

    Took some time. Tests are working fine. PR will be submitted after cleaning up

    pum

  12. 39 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions