-
-
Notifications
You must be signed in to change notification settings - Fork 302
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 custom ordering in command name completion #525
Comments
@notramo What would be a possible use for this? (I'm genuinely curious) One possibility I can think of is to have directory-specific completions, e.g. for project-specific scripts. Do you have others? |
This sounds logical but it's not going to be very useful. Elvish has fixed rules for resolving commands and there is no customization point in changing that; this is a delibrate design choice. Since you cannot customize the rules for finding commands, customizing how to complete commands doesn't make much sense. Do you have a particular use case in mind? |
I want to make a tool that completes command by recency, frequency, and $pwd. My idea to solve the command resolution problem: fn my-custom-command-completer [command]{ edit:list-commands | to-json | completer-executable $command } or fn my-custom-command-completer [command]{ completer-executable --current $command --all ( edit:list-commands | each [i]{ print $i' ' ) } |
That is a very good use case, I like it. Although instead of allowing the user to customize the entire completion for commands, I prefer to support this customization by adding an additional sorting phase and supporting customization for that. Elvish's completion is already divided into a candidate-generation phase and a matching phase, both of which can be customized separately. The motivation is orthogonality and flexibility for customization; adding a sorting phase (and relevant customization API) is coherent with the design. |
Completion function is configurable for arguments, but not for executable/function names.
Elvish should have a command completion command, similar to the ones given in
edit:arg-completer
. I thinkedit:command-completer
would be a good name for it.The text was updated successfully, but these errors were encountered: