-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
cli/subsvcdotnet-fundamentals/svcokr-qualityContent-quality KR: Concerns article defects (bugs), freshness, or build warnings.Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
Description
Following the instructions for Tab Completion with Zsh, I realized that the suggestions aren't correct when I'm looking for suggestions inside a command.
Example: dotnet add p
suggests pack
and publish
instead of package
.
After digging into it, I realized that the $words variables only capture the last word on the terminal instead of the complete expression.
To fix it, I have updated the snippet to:
# zsh parameter completion for the dotnet CLI
_dotnet_zsh_complete()
{
local words
read -Ac words
local completions=("$(dotnet complete "$words")")
reply=( "${(ps:\n:)completions}" )
}
compctl -K _dotnet_zsh_complete dotnet
I'm more than happy to open a PR if you agree with the solution.
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: 341f0255-aa31-8e76-9b17-1232b7a910a9
- Version Independent ID: f30f63dc-0d90-7dba-ef39-b0148c637c1a
- Content: Enable tab completion - .NET CLI
- Content Source: docs/core/tools/enable-tab-autocomplete.md
- Product: dotnet-fundamentals
- Technology: dotnet-cli
- GitHub Login: @adegeo
- Microsoft Alias: adegeo
Metadata
Metadata
Assignees
Labels
cli/subsvcdotnet-fundamentals/svcokr-qualityContent-quality KR: Concerns article defects (bugs), freshness, or build warnings.Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.