`dotnet-suggest list` truncates dotted global tool names

Aberta Para iniciantes
#2,887 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 3 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
76/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
csharp
Domínio
cli

Direção de pesquisa

Comece por FileEnumerator.EnumerateFilesWithoutExtension em FileEnumerator.cs e SuggestionDispatcher.ShellPrefixesToMatch em SuggestionDispatcher.cs; acompanhe como cada um trata os nomes de executáveis do Linux e verifique os testes relacionados. Execute os testes relevantes e, em seguida, verifique se dotnet-suggest list preserva os nomes completos das ferramentas com pontos para que o shim do PowerShell possa registrar completadores para elas.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

The tool names below are anonymized. They retain the same number of dotted segments as the original names.

Environment
  • OS: Linux
  • dotnet-suggest: 3.0.0
  • Shell: PowerShell
Steps to reproduce
  1. Install a .NET global tool with a dotted command name, for example Example.Tools.StatusMonitor.Console.
  2. Verify that dotnet tool list -g shows the full name in the Commands column.
  3. Run dotnet-suggest list.
Expected behavior

The list contains Example.Tools.StatusMonitor.Console, so the PowerShell shim can register a completer for the full command name.

Actual behavior

The list shows Example.Tools. A second tool, SampleUi.Automation.TestClient, appears as SampleUi.

Tab completion for the full name fails with the standard PowerShell shim. Passing the full executable path directly returns the expected options:

$name = 'Example.Tools.StatusMonitor.Console'
$exe = (Get-Command $name -CommandType Application).Source
$line = "$name --"
dotnet-suggest get -e $exe --position $line.Length -- $line

Explicitly registering the full name with Register-ArgumentCompleter -Native restores tab completion.

Likely cause

In v3.0.0, global-tool discovery calls Path.GetFileNameWithoutExtension in FileEnumerator.EnumerateFilesWithoutExtension, removing .Console from the Linux executable name. SuggestionDispatcher.ShellPrefixesToMatch calls the same method again when producing list output, removing .StatusMonitor. The PowerShell shim uses the resulting name to register the completer.

Background

We use the same name for a C# project, its assembly, and its installed command. This makes it easier to trace a command in a deployment script or log back to the project that builds it. Our project names follow the dotted naming convention we use across our C# codebase, so preserving the dots in the command name is important to us.

Linguagem predominante
C#
Estrelas
3.7k
Forks
439
Merge médio
4d 8h
PRs com merge (30d)
9

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de dotnet/command-line-api

Todas as issues de dotnet/command-line-api

Issues semelhantes

Mais issues de C#

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.