Skip to content

dotnet-suggest: keep dotted global tool names in the list output - #2890

Open
menes97 wants to merge 1 commit into
dotnet:mainfrom
menes97:fix/2887-dotted-tool-names
Open

menes97 wants to merge 1 commit into
dotnet:mainfrom
menes97:fix/2887-dotted-tool-names

Conversation

@menes97

@menes97 menes97 commented Nov 16, 2026

Copy link
Copy Markdown

Fixes #2887

dotnet-suggest list shortened dotted global tool commands: Example.Tools.StatusMonitor.Console was listed as Example.Tools, so the PowerShell shim registered its completer for the wrong name.

Two places called Path.GetFileNameWithoutExtension:

  • FileEnumerator.EnumerateFilesWithoutExtension, when discovering the shims under ~/.dotnet/tools. On Linux and macOS the shim has no extension, so this removed .Console.
  • SuggestionDispatcher.ShellPrefixesToMatch, when writing the list output, which removed .StatusMonitor from the already shortened path. This one also affects Windows, because the global tools registration builds its paths from the names without .exe.

Both now use a small FileEnumerator.GetCommandName helper that takes the file name and removes only an .exe extension. Undotted names and Windows .exe paths give the same result as before.

Tests (in dotnet-suggest.Tests):

  • FileEnumeratorTests.EnumerateFilesWithoutExtension_keeps_dotted_names_and_removes_only_exe_extension
  • SuggestionDispatcherTests.List_command_keeps_dotted_global_tool_names, through GlobalToolsSuggestionRegistration

Both fail without the change. dotnet-suggest.Tests: 32 passed, 3 skipped. I built with the 11.0.100 RC SDK locally (global.json pins a 12.0 alpha I don't have; that change is not part of this PR).

The fix and tests were written with Claude Code (AI assistance); I reviewed and ran them.

🤖 Generated with Claude Code

Global tool discovery and the list command both called
Path.GetFileNameWithoutExtension, so a dotted command such as
Example.Tools.StatusMonitor.Console lost a segment each time and was listed
as Example.Tools. Only an .exe extension is removed now.

Fixes dotnet#2887

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotnet-suggest list truncates dotted global tool names

1 participant