From 6cf5bf2f0d86271c4cd213c5ce1068222d941bdb Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 14 Nov 2025 20:11:19 +0000
Subject: [PATCH 1/7] Initial plan
From b4073da25c3924a32dba4dfbc2220a7e9f8f0ec4 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 14 Nov 2025 20:15:43 +0000
Subject: [PATCH 2/7] Add .NET 10+ native shell completion documentation
Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com>
---
docs/core/tools/enable-tab-autocomplete.md | 102 +++++++++++++++++++--
1 file changed, 95 insertions(+), 7 deletions(-)
diff --git a/docs/core/tools/enable-tab-autocomplete.md b/docs/core/tools/enable-tab-autocomplete.md
index 77e90dcad542b..aa97ebbb539ad 100644
--- a/docs/core/tools/enable-tab-autocomplete.md
+++ b/docs/core/tools/enable-tab-autocomplete.md
@@ -4,7 +4,7 @@ description: This article teaches you how to enable tab completion for the .NET
author: adegeo
ms.author: adegeo
ms.topic: how-to
-ms.date: 07/06/2023
+ms.date: 01/14/2025
---
# How to enable tab completion for the .NET CLI
@@ -13,6 +13,94 @@ ms.date: 07/06/2023
This article describes how to configure tab completion for five shells: PowerShell, Bash, zsh, fish, and nushell. For other shells, refer to their documentation on how to configure tab completion.
+## Native shell completion scripts (.NET 10+)
+
+Starting with .NET 10 Preview 3, the .NET CLI includes native shell completion scripts that are much faster than the dynamic completions available in earlier versions. Native completions generate shell-specific scripts that handle the static parts of the CLI grammar directly in the shell, providing a significant performance improvement.
+
+### Generate completion scripts
+
+Use the `dotnet completions generate` command to generate a completion script for your shell:
+
+```console
+dotnet completions generate [SHELL]
+```
+
+The `[SHELL]` parameter accepts one of the following values:
+
+- `bash`
+- `fish`
+- `nushell`
+- `pwsh`
+- `zsh`
+
+If you don't specify a shell, the command infers the correct shell from your environment. On Windows, it defaults to PowerShell (`pwsh`). On other systems, it checks the `SHELL` environment variable.
+
+### Completion capabilities
+
+Native completions provide different levels of support depending on the shell:
+
+| Shell | Completion type | Descriptions in tab completions |
+|------------|-----------------|----------------------------------|
+| bash | hybrid | No |
+| fish | dynamic | No |
+| nushell | dynamic | No |
+| PowerShell | hybrid | Yes |
+| zsh | hybrid | Yes |
+
+**Completion types:**
+
+- **Hybrid**: Generates shell-specific code that handles static parts of the CLI grammar quickly, but falls back to the `dotnet complete` command for dynamic content (such as NuGet package IDs).
+- **Dynamic**: All completions go through the `dotnet complete` command, which might be slower but ensures comprehensive coverage.
+
+### Configure shells to use native completions
+
+Add the appropriate command to your shell's profile to enable native completions:
+
+#### PowerShell
+
+Add the following line to your PowerShell profile (`$PROFILE`):
+
+```powershell
+dotnet completions generate pwsh | Out-String | Invoke-Expression
+```
+
+#### Bash
+
+Add the following line to your `.bashrc` file:
+
+```bash
+eval "$(dotnet completions generate bash)"
+```
+
+#### Zsh
+
+Add the following line to your `.zshrc` file:
+
+```zsh
+eval "$(dotnet completions generate zsh)"
+```
+
+#### Fish
+
+Add the following line to your `config.fish` file:
+
+```fish
+dotnet completions generate fish | source
+```
+
+#### Nushell
+
+Add the following to the beginning of your `config.nu` file:
+
+```nu
+dotnet completions generate nushell | save -f ~/.local/share/nushell/completions/dotnet.nu
+use ~/.local/share/nushell/completions/dotnet.nu *
+```
+
+## Dynamic completion scripts (all versions)
+
+For .NET versions prior to .NET 10, or if you prefer to use dynamic completions, you can configure your shell to use the `dotnet complete` command. Dynamic completions work by sending the current command line to the `dotnet complete` command and processing the results in the shell.
+
Once set up, tab completion for the .NET CLI is triggered by entering a `dotnet` command in the shell and then pressing the Tab key. The current command line is sent to the `dotnet complete` command, and the results are processed by the shell. You can test the results without enabling tab completion by sending something directly to the `dotnet complete` command. For example:
```console
@@ -26,7 +114,7 @@ pack
If that command doesn't work, make sure that .NET Core 2.0 SDK or later is installed. If it's installed but that command still doesn't work, make sure that the `dotnet` command resolves to a version of .NET Core 2.0 SDK or later. Use the `dotnet --version` command to see what version of `dotnet` your current path is resolving to. For more information, see [Select the .NET version to use](../versions/selection.md).
-## Examples
+### Examples
Here are some examples of what tab completion provides:
@@ -38,7 +126,7 @@ Here are some examples of what tab completion provides:
| `dotnet package add Microsoft⇥` | `dotnet package add Microsoft.ApplicationInsights.Web` | Results are returned alphabetically. |
| `dotnet reference remove ⇥` | `dotnet reference remove ..\..\src\OmniSharp.DotNet\OmniSharp.DotNet.csproj` | Tab completion is project file aware. |
-## PowerShell
+### PowerShell
To add tab completion to **PowerShell** for the .NET CLI, create or edit the profile stored in the variable `$PROFILE`. For more information, see [How to create your profile](/powershell/module/microsoft.powershell.core/about/about_profiles#how-to-create-a-profile) and [Profiles and execution policy](/powershell/module/microsoft.powershell.core/about/about_profiles#profiles-and-execution-policy).
@@ -54,7 +142,7 @@ Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
}
```
-## bash
+### bash
To add tab completion to your **bash** shell for the .NET CLI, add the following code to your `.bashrc` file:
@@ -74,7 +162,7 @@ function _dotnet_bash_complete()
complete -f -F _dotnet_bash_complete dotnet
```
-## zsh
+### zsh
To add tab completion to your **zsh** shell for the .NET CLI, add the following code to your `.zshrc` file:
@@ -99,7 +187,7 @@ _dotnet_zsh_complete()
compdef _dotnet_zsh_complete dotnet
```
-## fish
+### fish
To add tab completion to your **fish** shell for the .NET CLI, add the following code to your `config.fish` file:
@@ -107,7 +195,7 @@ To add tab completion to your **fish** shell for the .NET CLI, add the following
complete -f -c dotnet -a "(dotnet complete (commandline -cp))"
```
-## nushell
+### nushell
To add tab completion to your **nushell** for .NET CLI, add the following to the beginning of your `config.nu` file:
From 243dcf671ac7ad9cbdb7cf235932af2a9d9fe686 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 14 Nov 2025 20:19:28 +0000
Subject: [PATCH 3/7] Fix table alignment for markdown linting
Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com>
---
docs/core/tools/enable-tab-autocomplete.md | 26 +++++++++++-----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/docs/core/tools/enable-tab-autocomplete.md b/docs/core/tools/enable-tab-autocomplete.md
index aa97ebbb539ad..fbaad52158ba2 100644
--- a/docs/core/tools/enable-tab-autocomplete.md
+++ b/docs/core/tools/enable-tab-autocomplete.md
@@ -40,12 +40,12 @@ If you don't specify a shell, the command infers the correct shell from your env
Native completions provide different levels of support depending on the shell:
| Shell | Completion type | Descriptions in tab completions |
-|------------|-----------------|----------------------------------|
-| bash | hybrid | No |
-| fish | dynamic | No |
-| nushell | dynamic | No |
-| PowerShell | hybrid | Yes |
-| zsh | hybrid | Yes |
+|------------|-----------------|-------------------------------------|
+| bash | hybrid | No |
+| fish | dynamic | No |
+| nushell | dynamic | No |
+| PowerShell | hybrid | Yes |
+| zsh | hybrid | Yes |
**Completion types:**
@@ -118,13 +118,13 @@ If that command doesn't work, make sure that .NET Core 2.0 SDK or later is insta
Here are some examples of what tab completion provides:
-| Input | Becomes | Because |
-|:----------------|:--------------------|:-----------------------------------------------|
-| `dotnet a⇥` | `dotnet add` | `add` is the first subcommand, alphabetically. |
-| `dotnet add p⇥` | `dotnet add --help` | Tab completion matches substrings, and `--help` comes first alphabetically. |
-| `dotnet add p⇥⇥` | `dotnet add package` | Pressing tab a second time brings up the next suggestion. |
-| `dotnet package add Microsoft⇥` | `dotnet package add Microsoft.ApplicationInsights.Web` | Results are returned alphabetically. |
-| `dotnet reference remove ⇥` | `dotnet reference remove ..\..\src\OmniSharp.DotNet\OmniSharp.DotNet.csproj` | Tab completion is project file aware. |
+| Input | Becomes | Because |
+|---------------------------------|------------------------------------------------------------------------------|------------------------------------------------------------------------------|
+| `dotnet a⇥` | `dotnet add` | `add` is the first subcommand, alphabetically. |
+| `dotnet add p⇥` | `dotnet add --help` | Tab completion matches substrings, and `--help` comes first alphabetically. |
+| `dotnet add p⇥⇥` | `dotnet add package` | Pressing tab a second time brings up the next suggestion. |
+| `dotnet package add Microsoft⇥` | `dotnet package add Microsoft.ApplicationInsights.Web` | Results are returned alphabetically. |
+| `dotnet reference remove ⇥` | `dotnet reference remove ..\..\src\OmniSharp.DotNet\OmniSharp.DotNet.csproj` | Tab completion is project file aware. |
### PowerShell
From a417c5866dff92c21a6aaf8324ce2cb35abe2d7e Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 14 Nov 2025 20:21:13 +0000
Subject: [PATCH 4/7] Add AI-usage metadata to frontmatter
Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com>
---
docs/core/tools/enable-tab-autocomplete.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/core/tools/enable-tab-autocomplete.md b/docs/core/tools/enable-tab-autocomplete.md
index fbaad52158ba2..30c26ff1d5230 100644
--- a/docs/core/tools/enable-tab-autocomplete.md
+++ b/docs/core/tools/enable-tab-autocomplete.md
@@ -5,6 +5,7 @@ author: adegeo
ms.author: adegeo
ms.topic: how-to
ms.date: 01/14/2025
+ai-usage: ai-assisted
---
# How to enable tab completion for the .NET CLI
From 54c7c619eeeb0c7efc063f04371434b29930c1ca Mon Sep 17 00:00:00 2001
From: Meaghan Osagie
Date: Fri, 14 Nov 2025 15:51:03 -0800
Subject: [PATCH 5/7] edit pass
---
docs/core/tools/enable-tab-autocomplete.md | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/docs/core/tools/enable-tab-autocomplete.md b/docs/core/tools/enable-tab-autocomplete.md
index 30c26ff1d5230..a3f610b0fe261 100644
--- a/docs/core/tools/enable-tab-autocomplete.md
+++ b/docs/core/tools/enable-tab-autocomplete.md
@@ -1,22 +1,22 @@
---
title: Enable tab completion
-description: This article teaches you how to enable tab completion for the .NET CLI for PowerShell, Bash, zsh, fish, and nushell.
+description: This article teaches you how to enable tab completion for the .NET CLI for PowerShell (pwsh), Bash, zsh, fish, and nushell.
author: adegeo
ms.author: adegeo
ms.topic: how-to
-ms.date: 01/14/2025
+ms.date: 11/14/2025
ai-usage: ai-assisted
---
# How to enable tab completion for the .NET CLI
-**This article applies to:** ✔️ .NET Core 2.1 SDK and later versions
+**This article applies to:** ✔️ .NET 6 SDK and later versions
-This article describes how to configure tab completion for five shells: PowerShell, Bash, zsh, fish, and nushell. For other shells, refer to their documentation on how to configure tab completion.
+This article describes how to configure tab completion for five shells: PowerShell (pwsh), Bash, zsh, fish, and nushell. For other shells, refer to their documentation on how to configure tab completion.
## Native shell completion scripts (.NET 10+)
-Starting with .NET 10 Preview 3, the .NET CLI includes native shell completion scripts that are much faster than the dynamic completions available in earlier versions. Native completions generate shell-specific scripts that handle the static parts of the CLI grammar directly in the shell, providing a significant performance improvement.
+Starting with .NET 10, the .NET CLI includes native shell completion scripts that are much faster than the dynamic completions available in earlier versions. Native completions generate shell-specific scripts that handle the static parts of the CLI grammar directly in the shell, providing a significant performance improvement.
### Generate completion scripts
@@ -34,7 +34,7 @@ The `[SHELL]` parameter accepts one of the following values:
- `pwsh`
- `zsh`
-If you don't specify a shell, the command infers the correct shell from your environment. On Windows, it defaults to PowerShell (`pwsh`). On other systems, it checks the `SHELL` environment variable.
+If you don't specify a shell, the command infers the correct shell from your environment. On Windows, it defaults to PowerShell (`pwsh`). On other systems, it checks if the file name of the `SHELL` environment variable matches any of the previously specified shell values.
### Completion capabilities
From 11166bbf95a0bfa04cd0709e273ea24def457c31 Mon Sep 17 00:00:00 2001
From: Meaghan Osagie
Date: Fri, 14 Nov 2025 16:01:26 -0800
Subject: [PATCH 6/7] Clarify documentation on shell inference for tab
completion
---
docs/core/tools/enable-tab-autocomplete.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/core/tools/enable-tab-autocomplete.md b/docs/core/tools/enable-tab-autocomplete.md
index a3f610b0fe261..88f9ef510a530 100644
--- a/docs/core/tools/enable-tab-autocomplete.md
+++ b/docs/core/tools/enable-tab-autocomplete.md
@@ -34,7 +34,7 @@ The `[SHELL]` parameter accepts one of the following values:
- `pwsh`
- `zsh`
-If you don't specify a shell, the command infers the correct shell from your environment. On Windows, it defaults to PowerShell (`pwsh`). On other systems, it checks if the file name of the `SHELL` environment variable matches any of the previously specified shell values.
+If you don't specify a shell, the command infers the correct shell from your environment. On Windows, it defaults to PowerShell (`pwsh`). On other systems, it checks if the file name of the `SHELL` environment variable matches any of the supported shell values.
### Completion capabilities
From 129f0b91bf21ba30081ad1f6c9bff956894b98f8 Mon Sep 17 00:00:00 2001
From: Meaghan Osagie
Date: Fri, 14 Nov 2025 16:02:49 -0800
Subject: [PATCH 7/7] use more active verb
---
docs/core/tools/enable-tab-autocomplete.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/core/tools/enable-tab-autocomplete.md b/docs/core/tools/enable-tab-autocomplete.md
index 88f9ef510a530..5ea6ce26c1f26 100644
--- a/docs/core/tools/enable-tab-autocomplete.md
+++ b/docs/core/tools/enable-tab-autocomplete.md
@@ -16,7 +16,7 @@ This article describes how to configure tab completion for five shells: PowerShe
## Native shell completion scripts (.NET 10+)
-Starting with .NET 10, the .NET CLI includes native shell completion scripts that are much faster than the dynamic completions available in earlier versions. Native completions generate shell-specific scripts that handle the static parts of the CLI grammar directly in the shell, providing a significant performance improvement.
+Starting with .NET 10, the .NET CLI includes native shell completion scripts that run much faster than the dynamic completions available in earlier versions. Native completions generate shell-specific scripts that handle the static parts of the CLI grammar directly in the shell, providing a significant performance improvement.
### Generate completion scripts