Skip to content

Commit fbee381

Browse files
authored
Update enable-tab-autocomplete.md (dotnet#31764)
1 parent 1b8227c commit fbee381

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

docs/core/tools/enable-tab-autocomplete.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: This article teaches you how to enable tab completion for the .NET
44
author: adegeo
55
ms.author: adegeo
66
ms.topic: how-to
7-
ms.date: 11/03/2019
7+
ms.date: 10/13/2022
88
---
99

1010
# How to enable TAB completion for the .NET CLI
@@ -81,14 +81,22 @@ To add tab completion to your **zsh** shell for the .NET CLI, add the following
8181
```zsh
8282
# zsh parameter completion for the dotnet CLI
8383

84-
_dotnet_zsh_complete()
84+
_dotnet_zsh_complete()
8585
{
8686
local completions=("$(dotnet complete "$words")")
8787

88-
reply=( "${(ps:\n:)completions}" )
88+
# If the completion list is empty, just continue with filename selection
89+
if [ -z "$completions" ]
90+
then
91+
_arguments '*::arguments: _normal'
92+
return
93+
fi
94+
95+
# This is not a variable assigment, don't remove spaces!
96+
_values = "${(ps:\n:)completions}"
8997
}
9098

91-
compctl -K _dotnet_zsh_complete dotnet
99+
compdef _dotnet_zsh_complete dotnet
92100
```
93101

94102
## fish

0 commit comments

Comments
 (0)