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

completions: Highlight fuzzy matching #2190

Closed

Conversation

danyspin97
Copy link
Contributor

Requires #1905 .

I had to create a vector for every completion to add the spans, but I didn't notice any slowdown (even with idle-timeout = 0). The loop part is only slightly longer for non consecutive matches, but in this case the matching rows are just few ones, so there is no performance impact.

Preview:
20220404_18h01m43s_grim

Comment on lines +87 to +88
.fuzzy_indices(text, pattern)
.map(|(score, fuzzy_indices)| (index, score, fuzzy_indices))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very slow and expensive for large datasets. We should do what we do in the file picker: use fuzzy_match to score, then use fuzzy_indices inside the render method to only compute the indices for elements on screen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case the render function relies on Table::render_table function. I can do that, but it would require passing more information to the latter (the highlighted style and the prompt), making it less general. Is it okay?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, https://github.com/helix-editor/helix/pull/3053/files#diff-b6c51d6e6645b52604abc7b9cd90c0200ab42d52be2f7e623929376971e784c6R641-R715 has a similar implementation where it patches the spans while rendering. We should be able to reuse the code once that PR is merged

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, reusing the code would definitely be the best. Unfortunately that PR hasn't seen much progress in the last couple of months; if you prefer I can pick it up and continue where it was left.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danyspin97 #3053 has been merged! That should help this PR be able to move further.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LeoniePhiline Thanks for the heads up :) I have also updated #1905 so this PR should be close to being merged.

@the-mikedavis the-mikedavis added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 18, 2022
@the-mikedavis the-mikedavis added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from a maintainer. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 13, 2022
@the-mikedavis the-mikedavis added S-waiting-on-pr Status: This is waiting on another PR to be merged first and removed S-waiting-on-review Status: Awaiting review from a maintainer. labels Aug 6, 2022
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Sep 13, 2022
@the-mikedavis the-mikedavis added S-waiting-on-review Status: Awaiting review from a maintainer. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-pr Status: This is waiting on another PR to be merged first S-waiting-on-review Status: Awaiting review from a maintainer. labels Jan 26, 2023
@pascalkuthe pascalkuthe added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 29, 2023
@pascalkuthe
Copy link
Member

closing this one out as stale. Thank you for contributing!

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 S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants