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

fix: columnar_menu create_string with quoted suggestions #886

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

blindFS
Copy link
Contributor

@blindFS blindFS commented Mar 12, 2025

This is a stopgap for nushell/nushell#12680, nushell/nushell#13951, nushell/nushell#13630, nushell/nushell#15302.

Fuzzy matching will need more care, and I think @ysthakur knows how to fix that.

nushell/nushell#13951 also exposes another bug in directory_completion, i.e. not doing quoting, which is handled properly in file_completion.

@ysthakur
Copy link
Member

Thanks, it'd be good to have at least a temporary fix for this bug. Could you also modify ide_completions? It has the same problem with split_at.

For fuzzy completions, you can iterate over the graphemes in every suggestion and highlight every grapheme that contains a character whose index is less than shortest_base.len(). I was working on a function to do that here. That one's more complicated than what you need to do because it takes a list of match indices rather than just highlight a prefix (the function's from #798).

@ysthakur ysthakur added the A-Completions Area: Tab completion and inline hint completions label Mar 12, 2025
@blindFS
Copy link
Contributor Author

blindFS commented Mar 12, 2025

@ysthakur Thanks for the reminder! That's interesting, because I was looking at #839 and thought only columnar_menu had the problem, and I also greped create_string in the repo.

It turns out that ide_menu already got the width -> len fix somewhere else and the function name is create_value_string, LoL.

@blindFS
Copy link
Contributor Author

blindFS commented Mar 12, 2025

For fuzzy completions, you can iterate over the graphemes in every suggestion and highlight every grapheme that contains a character whose index is less than shortest_base.len(). I was working on a function to do that here. That one's more complicated than what you need to do because it takes a list of match indices rather than just highlight a prefix (the function's from #798).

I was hoping for a systematic solution for both issues, I'm not sure if nucleo_matcher can directly return the matching indices while calculating the score so that we don't need some extra overhead here in reedline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Completions Area: Tab completion and inline hint completions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants