From f0e544bbfdccd383e2d6618f08ad38c847a4a5c8 Mon Sep 17 00:00:00 2001 From: "Andy (Steve) De George" <67293991+adegeo@users.noreply.github.com> Date: Thu, 13 Oct 2022 12:21:54 -0700 Subject: [PATCH] Update enable-tab-autocomplete.md --- docs/core/tools/enable-tab-autocomplete.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/core/tools/enable-tab-autocomplete.md b/docs/core/tools/enable-tab-autocomplete.md index a132e17d9add4..d050bbb7fc349 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: 11/03/2019 +ms.date: 10/13/2022 --- # 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 ```zsh # zsh parameter completion for the dotnet CLI -_dotnet_zsh_complete() +_dotnet_zsh_complete() { local completions=("$(dotnet complete "$words")") - reply=( "${(ps:\n:)completions}" ) + # If the completion list is empty, just continue with filename selection + if [ -z "$completions" ] + then + _arguments '*::arguments: _normal' + return + fi + + # This is not a variable assigment, don't remove spaces! + _values = "${(ps:\n:)completions}" } -compctl -K _dotnet_zsh_complete dotnet +compdef _dotnet_zsh_complete dotnet ``` ## fish