Repository navigation
Command-wide completions - #16765
Command-wide completions#16765
Conversation
| } | ||
| } | ||
|
|
||
| pub fn get_command_arguments( |
There was a problem hiding this comment.
Make it pub(super)? Or make it more general and move it somewhere in flatten.rs?
There was a problem hiding this comment.
Yeah, this might come in handy somewhere else. Not a blocker for this PR though
blindFS
left a comment
There was a problem hiding this comment.
I haven't fully tested it yet, but I agree with the overall design.
Probably need careful documentation on this topic, because the custom/external completer stuff is already somewhat complicated to grasp.
Preserve spans, remove `Span:unknown()` usage
27bd0cc to
151990e
Compare
151990e to
945068d
Compare
|
@ysthakur @Bahex @b0o Can you guys reproduce it? Most of other single character named commands don't share this problem, only Could be a reedline issue happens to be triggered by those But I don't get what it has to do with this PR. |
|
@blindFS yeah I can reproduce it. I'm also guessing it has something to do with the placeholder character.
Maybe fallback order/behavior got modified? |
Not likely, but I have absolutely no clue 🤔. I feel it may reveal something very funny underneath. What's so special about |
|
Yes, I can also reproduce it. Strange. |
|
Since it's specifically |
Actually it's not the case. As I stated in a previous comment, the vector of suggestions sent to reedline remains unchanged. That's why I said it might be a hidden reedline issue. |
|
Heads-up that the TODO item in the PR description hasn't been done so this functionality is not mentioned in the docs nor cookbook, only in the release note. I was looking into implementing completion for a tool and didn't even come across this by way of the release note but rather through Clap's ongoing discussion of their implementation.
|
|
@Bahex do you have time to document this? No worries if not, there are other completion-related doc updates that I was planning to do anyway |
|
@ysthakur Hello! Did you happen to document this in one of your updates? |
|
@ofek Sorry, not yet. I'll try to get to it this week |
|
No worries, thank you! |




def --wrappeddoes not invoke shell completions for positional arguments #14504Also includes the following bugfix:
spans: list<string>argument provided to the external completer (and completer commands used withattr completewith this addition) previously had invalid spans (fromSpan::unknown).These values now have correct spans pointing to their location in the source code.
This change was moved out to another PR
Using a nonexistent command name as a parameter completer now throws a parse error:
Release notes summary - What our users need to know
Command-wide completion handler
There is big difference between custom completions that can be specified in a command's signature, and the "global" external completer (
$env.config.completions.external.completer).The former is added to individual parameters, while the latter provides completions for all arguments of (external) commands.
This makes using custom commands that wrap external commands awkward. The global external completer won't provide completions for the wrapper command and adding completions to that command uses a completely different API. It would be nice to be able to use the external completer's API for custom completions, or use the external completer for wrapper commands...
@complete externalNow it's possible to explicitly enable the global external completer for
externand custom commanddefinitions:@complete <completer>Instead of using the external completer, command-wide custom completers can be used for specific commands:
Combined with
externdefinitions, this makes it trivial to use specific completion sources for specific commands:Yes, you can remove the
matchexpression from your external completer!{|spans: list<string>| # ... # no need for this anymore! match $spans.0 { # fish completes commits and branch names in a nicer way git => $fish_completer # carapace doesn't have completions for asdf asdf => $fish_completer _ => $carapace_completer } | do $in $spansFull implementation of
fish-completerfrom the cookbook.Tasks after submitting