-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Consider adding a --help option to 'dotnet complete' #8902
Comments
Just giving you more detail -- currently, Tool-tips might be not easily co-exist with shell auto complete. Since the shell are expecting a result as command. |
@wli3 The point is that if there is an API overload like e.g. a switch, then tool-tip and shell tab complete can co-exist because the shell completion still calls |
I can submit the PR for this. Considering the help text as below. Do share the feedback/inputs if any. Description: Usage: Arguments: Options: |
@vrushalivartak do you intend to define a new directive, make dotnet-complete pass that to the application, and make the System.CommandLine library recognize the directive? If so:
|
Huh I thought this issue was about So if I understand correctly, the request is for a feature where
Same in JSON would be: [
{
"completion": "--some-option",
"help": "this is the help text for --some-option.\r\nIt can span multiple lines. In the line-based format, each continuation line starts with \"...:\"."
},
{
"completion": "--output=",
"help": "another option for demonstration purpose. This one takes an argument.",
"syntax_help": "--output=file"
}
] Shell completion scripts could then potentially use microsoft/terminal#3121 to display these completions and help texts in Windows Terminal. |
@KalleOlaviNiemitalo Thanks for your inputs. I now understand the ask better. |
The sdk/src/Cli/dotnet/commands/dotnet-complete/CompleteCommandParser.cs Lines 26 to 28 in 67e671f
I think that makes it less necessary for |
I think that is already a bit wrong, and CompletionItem.InsertText should be output instead. CompletionItem.Label should be displayed in a menu, but CompletionItem.InsertText should be inserted to the command line if the user chooses the menu item; those are usually the same, but if they differ and the output format used by CompletionItem source code: CliCommand.AddCompletionsFor creates CompletionItem instances for the non-hidden subcommands, options, and arguments of the command. The description, which also appears in the The library doesn't seem to add CliOption.HelpName and CliOption.Arity to the CompletionItem. It could perhaps be changed to format those into CompletionItem.Label but keep CompletionItem.InsertText like it is now. On the other hand, if an application customises the help for an option, it is not obvious to me how the library could copy the customised syntax help into the CompletionItem — would it have to create a HelpContext for that, and would doing so slow down the completions query? Feature request for CompletionItem.HelpLink: dotnet/command-line-api#1962 — Windows Terminal however doesn't seem to support a help URL per completion item: |
I would love this, we just need to ensure we're backwards-compatible in the implementation of the current |
A backward-compatible way could be to create a distinct command? I would be interested in contributing something like that, but right now I'm knee-deep into adding .net 8 support to Grace... so that wouldn't be before a while. |
We could also add a 'flag' argument to |
The issue of Granted it's a weird use case, as |
Oh jeez, of course you're right. I forgot that Yes, in that case we would need a parallel function. Good spot! |
dotnet complete
returns only a list of suggestions. However, there is no way at getting at the help text programmmatically. IDE's likeVSCode
or thePowerShell ISE
enable showing tooltips from the completion results, which usually include a short help text. I am not sure if a--help
switch is the best option but some way of getting at it directly would be great in order to resolve this issue.Environment data
The text was updated successfully, but these errors were encountered: