Repository navigation
feat(command): Support completion with external subcommands - #159
Conversation
Resolving the command line typed so far and running the middleware of its commands in completion mode is now a function of its own, so that other kinds of completion can run at the leaf command too. Co-authored-by: Cursor <cursoragent@cursor.com>
A command that overrides passThroughArgs leaves every argument after it unparsed, to be passed through to another program. That includes --help and --. The arguments are the remainingPosArgs of the command, as they were written. A pass-through command must not be the root command, and must not have subcommands or command line options. CommandDefinition gains the passThroughArgs getter, which classes that implement that interface directly need to add. Co-authored-by: Cursor <cursoragent@cursor.com>
A pass-through command completes the arguments after it by overriding completePassThroughArgs, which gets the words typed so far. It is called with the resolved context of the command, inside the middleware of the commands, in completion mode. The default is file completion. Co-authored-by: Cursor <cursoragent@cursor.com>
requestCompletionFrom asks another program for the completion of some words, by running its __complete request, and returns the response as it is. A pass-through command uses it to complete the arguments that it passes to that program. For this, CompletionResponse.tryParse parses a response in the wire format, and the name of the request, completeRequestCommand, is public. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
When
command subcommandruns a separate executable "subcommand", defer the completion of the rest of the command line to that executable.Summary by CodeRabbit
--.