Use VS Code file pickers instead of prompting for strings#14556
Merged
adamint merged 2 commits intodotnet:release/13.2from Mar 2, 2026
Merged
Use VS Code file pickers instead of prompting for strings#14556adamint merged 2 commits intodotnet:release/13.2from
adamint merged 2 commits intodotnet:release/13.2from
Conversation
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14556Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14556" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds native file/directory picker support when Aspire CLI is running under the VS Code extension, using a new IInteractionService.PromptForFilePathAsync API and a negotiated file-pickers.v1 capability between the CLI and extension.
Changes:
- Added
PromptForFilePathAsyncto the CLI interaction abstraction and implemented it in console + extension interaction services (with capability-based fallback to string prompting). - Extended the CLI↔extension backchannel/RPC surface with a new
promptForFilePathendpoint that usesvscode.window.showOpenDialog. - Updated key call sites (agent init / new / update) and test doubles to use the new file path prompt.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Aspire.Cli/Interaction/IInteractionService.cs | Adds the PromptForFilePathAsync interaction API. |
| src/Aspire.Cli/Interaction/ExtensionInteractionService.cs | Routes file path prompting to the extension when file-pickers.v1 is available; falls back to string prompting. |
| src/Aspire.Cli/Interaction/ConsoleInteractionService.cs | Adds console-mode implementation (currently delegates to PromptForStringAsync). |
| src/Aspire.Cli/Backchannel/ExtensionBackchannel.cs | Adds backchannel method to invoke promptForFilePath RPC. |
| src/Aspire.Cli/Utils/ExtensionHelper.cs | Defines the file-pickers.v1 capability constant. |
| src/Aspire.Cli/Commands/NewCommand.cs | Switches output path prompting to PromptForFilePathAsync (directory mode). |
| src/Aspire.Cli/Commands/AgentInitCommand.cs | Switches workspace root prompting to PromptForFilePathAsync (directory mode). |
| src/Aspire.Cli/Projects/ProjectUpdater.cs | Switches NuGet config directory prompting to PromptForFilePathAsync (directory mode). |
| extension/src/server/interactionService.ts | Implements promptForFilePath endpoint via showOpenDialog and wires it up. |
| extension/src/capabilities.ts | Advertises file-pickers.v1. |
| extension/src/loc/strings.ts / extension/package.nls.json / extension/loc/xlf/aspire-vscode.xlf | Adds localized labels for the picker UI. |
| tests/** | Updates test implementations/mocks for the new interaction method. |
Comments suppressed due to low confidence (1)
extension/src/server/interactionService.ts:175
promptForFilePathdoesn’t validatepromptTextthe waypromptForString/promptForSecretStringdo. For consistency (and to avoid showing a dialog with an empty title or logging confusing messages), consider adding the sameif (!promptText) { ...; return null; }guard here as well.
async promptForFilePath(promptText: string, defaultValue: string | null, directory: boolean): Promise<string | null> {
extensionLogOutputChannel.info(`Prompting for file path: ${promptText}, directory: ${directory}, default: ${defaultValue ?? 'null'}`);
963cb6f to
0b6affb
Compare
This was referenced Feb 26, 2026
Add PromptForFilePathAsync to IInteractionService that uses native OS file pickers when the VS Code extension supports the file-pickers.v1 capability. Falls back to PromptForStringAsync for older extensions or console mode. Call sites updated: AgentInitCommand, NewCommand, ProjectUpdater. Fixes dotnet#12758
0b6affb to
b454775
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
eerhardt
approved these changes
Mar 2, 2026
mitchdenny
pushed a commit
that referenced
this pull request
Mar 5, 2026
Add PromptForFilePathAsync to IInteractionService that uses native OS file pickers when the VS Code extension supports the file-pickers.v1 capability. Falls back to PromptForStringAsync for older extensions or console mode. Call sites updated: AgentInitCommand, NewCommand, ProjectUpdater. Fixes #12758 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I've been using
aspire newa lot when creating new projects for 13.2 testing. Needing to actually type out a file path each time instead of being allowed to use the file picker is an aggravating experience, especially because you need to remember that the relative directory of the path is the workspace root - and when no workspace folder is open, it's the home directory.This adds a file picker capability to the CLI and extension that will use the native OS file picker when in extension mode and with the right CLI version. Falls back to the current behavior (prompting string)
Fixes #12758
Checklist