-
Notifications
You must be signed in to change notification settings - Fork 775
Refactor serverReadyAction handling #13930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13930Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13930" |
@dotnet-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the serverReadyAction handling in the VS Code extension to honor user-specified server ready actions from the Aspire launch configuration, enabling browser debugger attachment (e.g., debugWithChrome, debugWithEdge) and custom URL patterns. Previously, a hard-coded default configuration would overwrite any user-supplied settings.
Changes:
- Added
ServerReadyActiontype definition and exposed it onAspireExtendedDebugConfiguration - Refactored
determineServerReadyActionto accept options and inherit from parent debug configuration - Updated pattern to use capture groups (
(https?://\\S+)) for proper URL substitution with%sformat
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| extension/src/dcp/types.ts | Added ServerReadyAction type and parentDebugConfiguration field to LaunchOptions and AspireExtendedDebugConfiguration |
| extension/src/debugger/launchProfiles.ts | Refactored determineServerReadyAction to accept options object and support parent configuration inheritance |
| extension/src/debugger/languages/dotnet.ts | Updated call to determineServerReadyAction to pass parentDebugConfiguration from launchOptions |
| extension/src/test/launchProfiles.test.ts | Updated tests to use new API and added cross-platform path handling |
| extension/src/test/dotnetDebugger.test.ts | Updated assertions to match new serverReadyAction behavior with capture groups |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
| export function determineServerReadyAction( | ||
| options: ServerReadyActionOptions = {} | ||
| ): ServerReadyAction | undefined { | ||
| if (!options.launchBrowser) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we actually gate this on launchSettings.json's launchBrowser property?
launchSettings.json (IMO) is a relic from Visual Studio
launch.json (IMO) is the "VS Code" way
I know that's an over-simplification and that we are conceptually layering them so launch.json -> launchSettings.json -> target project
I guess my point is it took me a while to realize that both applicationUrl and launchBrowser both needed to be specified before I could have the privilege of using the hardcoded serverReadyAction.
I don't want other VS Code purists to get frustrated that their serverReadyAction isn't working because a setting for Visual Studio isn't specified.
Motivation
Aspire 13 improved debugging for child processes; this change extends that all the way to the browser. Before this PR, a
serverReadyActionsupplied on the Aspire launch config was overwritten by a hard-coded default:{ "action": "openExternally", "pattern": "\\bNow listening on:\\s+https?://\\S+", "uriFormat": "..." }That prevented browser breakpoint debugging and custom URL capture patterns. In this PR we honor the supplied
serverReadyAction, so browser debugging can be triggered correctly (e.g.,debugWithChrome/debugWithEdge) with a custom pattern and uriFormat.Changes
ServerReadyActionto DCP types and expose it onAspireExtendedDebugConfiguration.ServerReadyActionand link to its canonical definition.determineServerReadyAction.parentDebugConfigurationintodetermineServerReadyActionfrom the .NET debugger.Tests
launchProfiles.test.tsdotnetDebugger.test.ts