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

Support lowercase matched auto completion #44

Open
TheWaWaR opened this issue Jun 10, 2018 · 5 comments
Open

Support lowercase matched auto completion #44

TheWaWaR opened this issue Jun 10, 2018 · 5 comments

Comments

@TheWaWaR
Copy link

First, thank you for your really cool project : )

The doc of Completer::complete says:

Returns the set of possible completions for the prefix word.

As I understand, it only support prefix based auto completion. However, if auto competion support lowercase matched candidates would be more cool.

Suppose we have subcommands below:

  • count
  • checkout
  • branch

If we type ou, the matched candidates will be count and checkout.

@murarth
Copy link
Owner

murarth commented Jun 10, 2018

Prefix matching is only the convention. You can implement a Completer that returns completion candidates based on any arbitrary criteria.

@TheWaWaR
Copy link
Author

TheWaWaR commented Jun 10, 2018

Wow! It actually works!

I tried this before, just not realized it works that way. If the word is not a prefix then it just disappeared, the candidates shows up correctly though. Not the way zsh (or maybe oh-my-zsh) auto completion works.

@murarth
Copy link
Owner

murarth commented Jun 10, 2018

Well, linefeed does expect that the completion candidates will have a common prefix (though it does not require this to be true). The current word is replaced with that prefix. How does zsh do it when there's no common prefix?

@TheWaWaR
Copy link
Author

image
These are candidates of git ou

@murarth
Copy link
Owner

murarth commented Jun 18, 2018

@TheWaWaR: Wow, that is elaborate. I don't envision linefeed natively implementing a completion function that looks like that, but if one wanted to implement a similar completion interface as a Command trait implementation, I believe it would be possible.

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

No branches or pull requests

2 participants