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
Stablize Rust-Native Completion Engine Tracking Issue #3166
Comments
Bash's expectations Inputs for
Inputs for
Output for
Output for
See
|
argcomplete emulates bash's interface in fish by
and then just registers that function https://github.com/kislyuk/argcomplete/blob/develop/argcomplete/shell_integration.py#L60 |
Value hints are supported on
Tooltips are supported on
We should make sure we don't lose these features as part of this transition, ie we shouldn't drop to the lowest common denominator. |
For Powershell Register-ArgumentCompleter
-CommandName <String[]>
-ScriptBlock <ScriptBlock>
[-Native]
[<CommonParameters>] The block receives
The block provides CompletionResult
So it seems like Powershell can fit within rust-driven completions and provide the full feature set. |
I'm starting small and prototyping for just bash support. Looking at argcomplete, it seems they had to use their own shlex implementation. Hoping we can avoid that. The first step is comex/rust-shlex#12. |
Hi, I'm interested in helping with this this I'm developing a few personal tools using clap that would hugely benefit from dynamic completions. Is there any good issues that nobody is working on you could point me towards? |
@happenslol Thanks! Anything unchecked in the "Remaining work" section is up for grabs; just post here that you are getting started on it. The highest priority is the support for each shell as that will help gauge the feasibility and provide feedback on the API. The rest is flushing out parsing implementation. I should split those out into individual issues to make it easier for people to coordinate on those (and to add bounties) but I probably won't have time for another week or so. |
Alright, had a busy week, so I'm only getting back around to this now. I've looked at the work done in #3656, and it looks like the next steps to add zsh and fish support would be to pull some of the functionality out of I'd look at |
@happenslol Yes, that is correct. I'd like to focus on shell support initially as that is where the most unknowns exist |
Oh if cobra is doing the same type of dynamic completions as argcomplete, that is great! That'll serve as a much better example! |
The old way of generating cargo completions no longer work, so we need to manually maintain the completions until clap completions support[1]. [1]: clap-rs/clap#3166
The old way of generating cargo completions no longer work, so we need to manually maintain the completions until clap completions support[1]. [1]: clap-rs/clap#3166
I want to apport a data point: Implements cobra completion with advanced things like a fs cache for dynamic completion querys (e.g. with provenience from remote APIs) for an x amount of seconds. Imagine a aws CLI wrapper that interacts with your custom infrastructure and things like it. |
Maintainer's notes:
Remaining work for feature parity
ValueHint
s (feat(complete): Skeleton for Rust-driven completions #3656)OsString
to preserve non-UTF8 pathsstdout
should not be used before getting to completion processing in case the completions are requestedNon-blocking work
is_require_equal_set
support (Supportis_require_equal_set
in native completions #3923)ValueHint
sDesign considerations
Prior art
#3022 was a tipping point for me in realizing that maybe our current approach to completions doesn't work. We effectively have to implement a mostly-untested parser within each shell. Examples of other problems that seem to stem from this:
If we take the approach of argcomplete where we do the parsing in our core code, rather than in each completion script, this will help us share parsing logic between shell, share some or all parsing logic with clap itself, and make a subset of the logic more testable.
We also need to decide whether to morph the existing parser into supporting this or create a custom parser (since the needs are pretty special). If we do a custom parser, we should probably do #2915 first so we can reuse lexing logic between clap and the completion generation. I've also been considering #2912 which would allow reusing the completion logic with any CLI parser.
The text was updated successfully, but these errors were encountered: