dotnet: set up tab completions for SDK 10+#1596
dotnet: set up tab completions for SDK 10+#1596sliekens wants to merge 2 commits intodevcontainers:mainfrom
Conversation
a335f8f to
2930611
Compare
There was a problem hiding this comment.
Pull request overview
Adds system-wide tab-completion script installation for .NET SDK 10+ by generating shell completion files via the new dotnet completions script command during feature installation.
Changes:
- Introduces an SDK-major-version gate helper (
is_at_least_sdk_version) to detect SDK 10+ (and skip runtime-only installs). - Adds
install_completionsto generate and install Bash/Zsh/Fish completion scripts into standard system directories. - Invokes
install_completionsfrom the main .NET feature install script after installing and linkingdotnet.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/dotnet/scripts/dotnet-helpers.sh | Adds SDK version detection and completion-script generation/installation logic. |
| src/dotnet/install.sh | Calls completion installation after ensuring dotnet is available system-wide. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
2930611 to
b2cb1f4
Compare
Generate bash, zsh, and fish completion scripts using 'dotnet completions script' and place them in the standard system-wide completion directories: - /usr/share/bash-completion/completions/dotnet - /usr/share/zsh/site-functions/_dotnet - /usr/share/fish/vendor_completions.d/dotnet.fish Gated behind SDK 10+ via version check since the 'dotnet completions script' command is only available starting with .NET 10. Skipped for runtime-only installs. Reference: https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete
b2cb1f4 to
dc43177
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Summary
Set up dotnet tab completions for .NET SDK 10+ installs using the new
dotnet completions scriptcommand.Changes
src/dotnet/scripts/dotnet-helpers.shis_at_least_sdk_versionhelper function that checks if the installed SDK meets a minimum major version threshold. Returns false for runtime-only installs (no SDK available).install_completionsfunction that generates completion scripts and drops them into standard system-wide directories:/usr/share/bash-completion/completions/dotnet/usr/share/zsh/site-functions/_dotnet/usr/share/fish/vendor_completions.d/dotnet.fishsrc/dotnet/install.shinstall_completionsafter SDK installation.Design decisions
dotnet completions scriptcommand is only available starting with .NET 10. Older versions use a different approach. The version check usesdotnet --versionto parse the major version.versionis set tonone, no SDK is installed, anddotnet --versionwill fail, causing the function to skip gracefully.Reference
https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete