Skip to content

Add open AppHost source action to VS Code extension#15668

Merged
davidfowl merged 3 commits into
mainfrom
davidfowl/open-apphost
Mar 28, 2026
Merged

Add open AppHost source action to VS Code extension#15668
davidfowl merged 3 commits into
mainfrom
davidfowl/open-apphost

Conversation

@davidfowl
Copy link
Copy Markdown
Contributor

@davidfowl davidfowl commented Mar 28, 2026

Description

Adds an Open AppHost source action to the VS Code extension's Running AppHosts view.

The action uses the trusted appHostPath already provided by the running AppHost data. Non-.csproj AppHosts open directly. For C# AppHosts reported as a .csproj, the command resolves to AppHost.cs, apphost.cs, or Program.cs, and only falls back to the project file if no source file is present.

The change also adds localization, tests for the source path resolution rules, and warning handling when the target file can't be opened or the command is invoked without a tree item.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@davidfowl davidfowl requested a review from adamint as a code owner March 28, 2026 08:25
Copilot AI review requested due to automatic review settings March 28, 2026 08:25
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 28, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15668

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15668"

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread extension/package.nls.json Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “Open AppHost Source” action to the VS Code extension’s Running AppHosts tree so users can jump from a running AppHost entry to the underlying source file (with .csproj paths resolving to source when possible).

Changes:

  • Added an openAppHostSource command and tree-provider handler to open the resolved AppHost source file in the editor.
  • Implemented resolveAppHostSourcePath to prefer opening AppHost.cs (or fall back to Program.cs / .csproj).
  • Added localization entries and unit tests for the resolution rules.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
extension/src/views/AspireAppHostTreeProvider.ts Adds source-path resolution helper and the command handler that opens the resolved file.
extension/src/extension.ts Registers the new aspire-vscode.openAppHostSource command.
extension/src/loc/strings.ts Adds localized warning strings for “not found” and “open failed” cases.
extension/src/test/appHostTreeView.test.ts Adds unit tests for resolveAppHostSourcePath.
extension/package.json Contributes the new command and wires it into the Running AppHosts view item context menu.
extension/package.nls.json Adds manifest-localized strings for the new command and warnings.
extension/loc/xlf/aspire-vscode.xlf Adds XLF entries for the new strings/command title.

Comment thread extension/src/test/appHostTreeView.test.ts Outdated
Comment thread extension/src/views/AspireAppHostTreeProvider.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

@github-actions
Copy link
Copy Markdown
Contributor

🎬 CLI E2E Test Recordings — 52 recordings uploaded (commit 1a2df9b)

View recordings
Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
Banner_NotDisplayedWithNoLogoFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJavaEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateJavaAppHostWithViteApp ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RunWithMissingAwaitShowsHelpfulError ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
TypeScriptAppHostWithProjectReferenceIntegration ▶️ View Recording

📹 Recordings uploaded automatically from CI run #23681447806

@davidfowl davidfowl merged commit 877512c into main Mar 28, 2026
507 of 510 checks passed
@davidfowl davidfowl deleted the davidfowl/open-apphost branch March 28, 2026 15:21
adamint pushed a commit to adamint/aspire that referenced this pull request Mar 28, 2026
* Add open AppHost source action to VS Code extension

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Handle lowercase apphost source file

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address PR review feedback

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@joperezr joperezr added this to the 13.3 milestone Apr 14, 2026
@aspire-repo-bot
Copy link
Copy Markdown
Contributor

Documentation Review — No Docs PR Required

After reviewing the changes in this PR, no documentation update is needed on aspire.dev.

Reason: This PR adds an "Open AppHost source" context menu action to the VS Code extension's Running AppHosts tree view. All changes are internal to the extension/ directory (TypeScript source, localization strings, and tests). The feature is a minor VS Code UX enhancement — a right-click action that opens the AppHost source file — with no public API surface changes, no new configuration options, and no behavioral changes to Aspire's hosting or deployment model. The existing VS Code extension documentation does not need updating for this kind of incremental UI addition.

Generated by PR Documentation Check · ● 130.9K ·

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.

4 participants