linefeed icon indicating copy to clipboard operation
linefeed copied to clipboard

Support lowercase matched auto completion

Open TheWaWaR opened this issue 6 years ago • 5 comments

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.

TheWaWaR avatar Jun 10 '18 16:06 TheWaWaR

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

murarth avatar Jun 10 '18 16:06 murarth

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.

TheWaWaR avatar Jun 10 '18 17:06 TheWaWaR

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?

murarth avatar Jun 10 '18 18:06 murarth

image These are candidates of git ou

TheWaWaR avatar Jun 11 '18 02:06 TheWaWaR

@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.

murarth avatar Jun 18 '18 19:06 murarth