dotnet / dotnet/command-line-api

zsh completion shim does not work as expected

Open
#1,849 3 comments 2 reactions 0 assignees View on GitHub
Area-Completions bug
Dominant language
C#
Stars
3.7k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

As the title says the zsh completion shim doesn't work as expected or rather doesn't work _at all_ in some cases.

The problem stems from the fact that dotnet-suggest on my system gives the following for ```dotnet-suggest list```
```
dotnet-ef
dotnet ef
security-scan
dotnet-grpc-cli
dotnet grpc-cli
dotnet-suggest
dotnet suggest
dotnet-grpc
dotnet grpc
reportgenerator
```
So for all the dotnet prefixed global commands there is always the one with a space included as well. This leads to the situation where dotnet-suggest is registered as a completion provider for ```dotnet```.

Resulting in this issue:
```
_values:compvalues:11: not enough arguments
```

Because there is no completion returned by dotnet-suggest for ```dotnet```

If I understand the issue correctly this stems from this line: https://github.com/dotnet/command-line-api/blob/1d98a75ce2b109a2d7c18d81fac3f279be095e4e/src/System.CommandLine.Suggest/dotnet-suggest-shim.zsh#L32

In general if there is _no_ completion returned there shouldn't even be a _values object that is set as far as I understand.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.