From a38ddc6f39e2da1953e586ff067ee6f786929627 Mon Sep 17 00:00:00 2001 From: sibber5 Date: Fri, 12 Jun 2026 17:08:57 +0300 Subject: [PATCH 1/5] Update outdated Nushell completions config --- docs/core/tools/enable-tab-autocomplete.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/core/tools/enable-tab-autocomplete.md b/docs/core/tools/enable-tab-autocomplete.md index 85baf215df6e2..96fb4b6be4ab6 100644 --- a/docs/core/tools/enable-tab-autocomplete.md +++ b/docs/core/tools/enable-tab-autocomplete.md @@ -91,12 +91,7 @@ dotnet completions script fish | source #### Nushell -Add the following to the beginning of your `config.nu` file: - -```nu -dotnet completions script nushell | save -f ~/.local/share/nushell/completions/dotnet.nu -use ~/.local/share/nushell/completions/dotnet.nu * -``` +Run `dotnet completions script nushell` and add the snippet it provides to your `config.nu` file. ## Dynamic completion scripts (all versions) From 8436293b9ffec19960c1f83a35d060e706862e27 Mon Sep 17 00:00:00 2001 From: sibber5 Date: Fri, 12 Jun 2026 17:16:50 +0300 Subject: [PATCH 2/5] Add example to Nushell completions config --- docs/core/tools/enable-tab-autocomplete.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/core/tools/enable-tab-autocomplete.md b/docs/core/tools/enable-tab-autocomplete.md index 96fb4b6be4ab6..b58b8f697cf69 100644 --- a/docs/core/tools/enable-tab-autocomplete.md +++ b/docs/core/tools/enable-tab-autocomplete.md @@ -92,6 +92,22 @@ dotnet completions script fish | source #### Nushell Run `dotnet completions script nushell` and add the snippet it provides to your `config.nu` file. +e.g., if you were not using any external completers, add the following to the end of the file: +```nu +let dotnet_completer = {|spans| + dotnet complete ($spans | str join " ") | lines +} + +let multiple_completers = {|spans| + match $spans.0 { + "dotnet" => $dotnet_completer + _ => { [] } # Fallback to empty list + } | do $in $spans +} + +$env.config.completions.external.enable = true +$env.config.completions.external.completer = $multiple_completers +``` ## Dynamic completion scripts (all versions) From d14ba1dc1cd09fdb217dabf92b077f1260805a5e Mon Sep 17 00:00:00 2001 From: sibber5 Date: Fri, 12 Jun 2026 17:31:20 +0300 Subject: [PATCH 3/5] Update Nushell instructions for dynamic completions --- docs/core/tools/enable-tab-autocomplete.md | 37 ++++++++-------------- 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/docs/core/tools/enable-tab-autocomplete.md b/docs/core/tools/enable-tab-autocomplete.md index b58b8f697cf69..6ae075a1f5ed1 100644 --- a/docs/core/tools/enable-tab-autocomplete.md +++ b/docs/core/tools/enable-tab-autocomplete.md @@ -91,7 +91,7 @@ dotnet completions script fish | source #### Nushell -Run `dotnet completions script nushell` and add the snippet it provides to your `config.nu` file. +Run `dotnet completions script nushell` and follow the instructions it provides in your `config.nu` file. e.g., if you were not using any external completers, add the following to the end of the file: ```nu let dotnet_completer = {|spans| @@ -197,33 +197,22 @@ complete -f -c dotnet -a "(dotnet complete (commandline -cp))" ### nushell -To add tab completion to your **nushell** for .NET CLI, add the following to the beginning of your `config.nu` file: - +To add tab completion to your **nushell** for .NET CLI, run `dotnet completions script nushell` and follow the instructions it provides in your `config.nu` file. +e.g., if you were not using any external completers, add the following to the end of the file: ```nu -let external_completer = { |spans| - { - dotnet: { || - dotnet complete ( - $spans | skip 1 | str join " " - ) | lines - } - } | get $spans.0 | each { || do $in } +let dotnet_completer = {|spans| + dotnet complete ($spans | str join " ") | lines } -``` - -And then in the `config` record, find the `completions` section and add the `external_completer` that was defined earlier to `external`: -```nu -let-env config = { - # your options here - completions: { - # your options here - external: { - # your options here - completer: $external_completer # add it here - } - } +let multiple_completers = {|spans| + match $spans.0 { + "dotnet" => $dotnet_completer + _ => { [] } # Fallback to empty list + } | do $in $spans } + +$env.config.completions.external.enable = true +$env.config.completions.external.completer = $multiple_completers ``` ## Completion examples From e035f5b2d2ffb751af4ca52f628e979108b522c3 Mon Sep 17 00:00:00 2001 From: sibber5 Date: Mon, 15 Jun 2026 22:31:22 +0300 Subject: [PATCH 4/5] Update Nushell and shell completion instructions --- docs/core/tools/enable-tab-autocomplete.md | 53 ++++++++-------------- 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/docs/core/tools/enable-tab-autocomplete.md b/docs/core/tools/enable-tab-autocomplete.md index 6ae075a1f5ed1..d06a28899270e 100644 --- a/docs/core/tools/enable-tab-autocomplete.md +++ b/docs/core/tools/enable-tab-autocomplete.md @@ -91,22 +91,11 @@ dotnet completions script fish | source #### Nushell -Run `dotnet completions script nushell` and follow the instructions it provides in your `config.nu` file. -e.g., if you were not using any external completers, add the following to the end of the file: -```nu -let dotnet_completer = {|spans| - dotnet complete ($spans | str join " ") | lines -} - -let multiple_completers = {|spans| - match $spans.0 { - "dotnet" => $dotnet_completer - _ => { [] } # Fallback to empty list - } | do $in $spans -} +Add the following line(s) to your `config.nu` file: -$env.config.completions.external.enable = true -$env.config.completions.external.completer = $multiple_completers +```nu +mkdir ($nu.data-dir | path join "vendor/autoload") # Only add this line if not already present in your config. +dotnet completions script nushell | save -f ($nu.data-dir | path join "vendor/autoload/dotnet-completions.nu") ``` ## Dynamic completion scripts (all versions) @@ -142,9 +131,9 @@ 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: +Add the following code to your `.bashrc` file: ```bash # bash parameter completion for the dotnet CLI @@ -162,9 +151,9 @@ 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: +Add the following code to your `.zshrc` file: ```zsh # zsh parameter completion for the dotnet CLI @@ -187,32 +176,26 @@ _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: +Add the following code to your `config.fish` file: ```fish complete -f -c dotnet -a "(dotnet complete (commandline -cp))" ``` -### nushell +### Nushell -To add tab completion to your **nushell** for .NET CLI, run `dotnet completions script nushell` and follow the instructions it provides in your `config.nu` file. -e.g., if you were not using any external completers, add the following to the end of the file: -```nu -let dotnet_completer = {|spans| - dotnet complete ($spans | str join " ") | lines -} +Add the following code to your `config.nu` file: -let multiple_completers = {|spans| - match $spans.0 { - "dotnet" => $dotnet_completer - _ => { [] } # Fallback to empty list - } | do $in $spans +```nu +def "nu-complete dotnet" [context: string] { + ^dotnet complete $"($context)" | lines } -$env.config.completions.external.enable = true -$env.config.completions.external.completer = $multiple_completers +export extern "dotnet" [ + ...command: string@"nu-complete dotnet" +] ``` ## Completion examples From bbfbb6c20424b6263621b6847be54c693c274faa Mon Sep 17 00:00:00 2001 From: sibber5 Date: Mon, 15 Jun 2026 23:39:50 +0300 Subject: [PATCH 5/5] Make header sizes consistent --- docs/core/tools/enable-tab-autocomplete.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/core/tools/enable-tab-autocomplete.md b/docs/core/tools/enable-tab-autocomplete.md index d06a28899270e..eae13e9d15431 100644 --- a/docs/core/tools/enable-tab-autocomplete.md +++ b/docs/core/tools/enable-tab-autocomplete.md @@ -115,7 +115,9 @@ 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). -### PowerShell +### Configure shells to use native completions + +#### 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). @@ -131,7 +133,7 @@ Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock { } ``` -### Bash +#### Bash Add the following code to your `.bashrc` file: @@ -151,7 +153,7 @@ function _dotnet_bash_complete() complete -f -F _dotnet_bash_complete dotnet ``` -### Zsh +#### Zsh Add the following code to your `.zshrc` file: @@ -176,7 +178,7 @@ _dotnet_zsh_complete() compdef _dotnet_zsh_complete dotnet ``` -### Fish +#### Fish Add the following code to your `config.fish` file: @@ -184,7 +186,7 @@ Add the following code to your `config.fish` file: complete -f -c dotnet -a "(dotnet complete (commandline -cp))" ``` -### Nushell +#### Nushell Add the following code to your `config.nu` file: