-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
Type of issue
Missing information
Description
In 10.0.100 preview 3 we added a new command that can generate static completion scripts for the dotnet CLI for various shells we support:
> dotnet completions generate [SHELL]
... lots of shell-specific script emitted here...
The shell argument is one of the following shell names:
- bash
- fish
- nushell
- pwsh
- zsh
If no shell is specified, we will try to infer the correct shell from the current execution environment -
- if Windows, default to pwsh
- otherwise, see if the file name of the SHELL environment variable matches any of the shells above
Capabilities
The primary reason to do this is speed. Native shell completions are much faster than dynamic, dotnet-provided completions.
We have differing levels of support/capabilities for each shell in this release:
hybrid means that we generate shell-specific shims that are fast for the 'static' parts of the CLI grammar, but for dynamic parts of the grammar (NuGet Package Ids, etc) we ask the dotnet CLI for dynamic completions
dynamic means that all completions go through the full dotnet CLI, so completions may be slower
| shell | completion type | support for descriptions in tab completions |
|---|---|---|
| bash | hybrid | no |
| fish | dynamic | no |
| nushell | dynamic | no |
| powershell | hybrid | yes |
| zsh | hybrid | yes |
We'll want to document shell-specific examples of including these generation+registration scripts in each shell's equivalent of the $PROFILE.
For example, for powershell this might look something like adding this to your $PROFILE:
dotnet completions script pwsh | out-String | Invoke-Expression -ErrorAction SilentlyContinue[Enter feedback here]
Page URL
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet
Content source URL
https://github.com/dotnet/docs/blob/main/docs/core/tools/dotnet.md
Document Version Independent Id
0f6c658c-b477-2d2c-2a9a-d74f6ae38d3f
Platform Id
6134b29e-3444-084d-9749-f09de2d8153b
Article author
Metadata
- ID: 0ba6c9b5-64cb-1dc6-21d0-ad8f0a1185fe
- PlatformId: 6134b29e-3444-084d-9749-f09de2d8153b
- Service: dotnet-fundamentals