Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fuzzy search for autocomplete #3084

Closed
rgasper opened this issue Jul 15, 2022 · 6 comments · Fixed by #4578
Closed

fuzzy search for autocomplete #3084

rgasper opened this issue Jul 15, 2022 · 6 comments · Fixed by #4578
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@rgasper
Copy link

rgasper commented Jul 15, 2022

Describe your feature request

Adding a fuzzy-find capability to autocomplete would be awesome! It's probably my favorite feature from VSCode that I miss in Helix. In particular, the VSCode autocomplete provides the following types of suggestions that I'm missing:

  • will show suggestions where the currently typed stub is in the middle
    • so if I've typed back, the autocomplete will suggest options like my_data_backup
  • will show suggestions where letters in the currently typed stub show up spaced out throughout the suggestion in order
    • so if I've typed bgvn, the autocomplete will suggest options like _big_global_variable_name
  • autocomplete can be configured via settings to be case-insensitive
@rgasper rgasper added the C-enhancement Category: Improvements label Jul 15, 2022
@kirawi
Copy link
Member

kirawi commented Jul 15, 2022

Duplicate of #1015

@kirawi kirawi marked this as a duplicate of #1015 Jul 15, 2022
@kirawi kirawi closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2022
@kirawi kirawi added the R-duplicate Duplicated issue: please refer to the linked issue label Jul 15, 2022
@archseer
Copy link
Member

Not a duplicate.

@archseer archseer reopened this Jul 16, 2022
@archseer
Copy link
Member

However this should already work out of the box? We fuzzy filter the completion.

@sudormrfbin
Copy link
Member

sudormrfbin commented Jul 16, 2022

  • will show suggestions where the currently typed stub is in the middle

    • so if I've typed back, the autocomplete will suggest options like my_data_backup

Suggestions in the middle don't seem to work (or they work but randomly in at least rust-analyzer).

  • will show suggestions where letters in the currently typed stub show up spaced out throughout the suggestion in order

    • so if I've typed bgvn, the autocomplete will suggest options like _big_global_variable_name

This seems to work with rust-analyzer.

  • autocomplete can be configured via settings to be case-insensitive

Case insensitive autocomplete doesn't work (tested with rust-analyzer and the Dart LSP).

@archseer archseer removed the R-duplicate Duplicated issue: please refer to the linked issue label Jul 16, 2022
@sudormrfbin
Copy link
Member

So this seems to be due to filtering the completion results and removing completions that don't start with the current word:

if !prefix.is_empty() {
items = items
.into_iter()
.filter(|item| {
item.filter_text
.as_ref()
.unwrap_or(&item.label)
.starts_with(&prefix)
})
.collect();
}

@the-mikedavis the-mikedavis added C-bug Category: This is a bug A-helix-term Area: Helix term improvements and removed C-enhancement Category: Improvements labels Jul 31, 2022
@ChrHorn
Copy link
Contributor

ChrHorn commented Aug 1, 2022

After #3215 gets merged we could try to simply remove the prefix filtering to get full fuzzy matching. This would also fix #1807.

ChrHorn added a commit to ChrHorn/helix that referenced this issue Nov 3, 2022
This commit removes the still existing filtering by prefix and should
enable full fuzzy sorting of the autocomplete menu.

closes helix-editor#3084, helix-editor#1807
ChrHorn added a commit to ChrHorn/helix that referenced this issue Nov 3, 2022
PR helix-editor#4134 switched the autocomplete menu from alphabetical to fuzzy
sorting. This commit removes the still existing filtering by prefix and
should enable full fuzzy sorting of the autocomplete menu.

closes helix-editor#3084, helix-editor#1807
archseer added a commit that referenced this issue Nov 17, 2022
PR #4134 switched the autocomplete menu from alphabetical to fuzzy
sorting. This commit removes the still existing filtering by prefix and
should enable full fuzzy sorting of the autocomplete menu.

closes #3084, #1807

Co-authored-by: Blaž Hrastnik <[email protected]>
herkhinah pushed a commit to herkhinah/helix that referenced this issue Dec 11, 2022
PR helix-editor#4134 switched the autocomplete menu from alphabetical to fuzzy
sorting. This commit removes the still existing filtering by prefix and
should enable full fuzzy sorting of the autocomplete menu.

closes helix-editor#3084, helix-editor#1807

Co-authored-by: Blaž Hrastnik <[email protected]>
freqmod pushed a commit to freqmod/helix that referenced this issue Feb 8, 2023
PR helix-editor#4134 switched the autocomplete menu from alphabetical to fuzzy
sorting. This commit removes the still existing filtering by prefix and
should enable full fuzzy sorting of the autocomplete menu.

closes helix-editor#3084, helix-editor#1807

Co-authored-by: Blaž Hrastnik <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants