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
[FR] Provide a way to not order suggested autocompletion variants alphabetically #17
Comments
This is more involved than it initially seems. The reason is we go through all the
The resulting minimal DFA is going to look like this: As you can see, there are conflicting expectations as to the order of transitions in the DFA: on one hand we expect (a, b, c), on the other (c, b, a). There’s no right answer in this case. |
I think what you described is a corner case, so let's exclude it from the initial FR: Is the task in such a reduced case achievable? |
For cases like
|
but I still get suggested |
What shell are you on? |
zsh 5.8 |
I am sorry, I don't understand zsh completions. Guys on #zsh @ irc.freenode.net said that it's just the way your util generates the completion rules that makes them sorted. |
I figured out the how to disable zsh’s sorting. It’s a matter of passing the right options to The way it’s currently called: That’s not the whole story though. Hash tables are used extensively throughout complgen to represent DFA transitions. In order to get the order of options from the grammar, the hash table would need to be replaced with something that preserves the insertion order. |
Guys on the channel first only suggested adding
After replacing |
Nice! If you get tired of editing it manually after every compilation and you’re up for a contribution, this functionality could be encoded in an additional option, like |
Currently such such .usage's:
produce shell autocompletion rules where the items are suggested in alphabetical order (
1 2 3
in the first case anda b c
in the second) instead of the way they were ordered in the .usage files (I'd expect3 2 1
in the first case andc b a
in the second).The text was updated successfully, but these errors were encountered: