Skip to content

[release/13.2] VS Code Extension: Add right-click context menu on resource endpoint URLs#15347

Merged
joperezr merged 1 commit intorelease/13.2from
feature/endpoint-context-menu
Mar 19, 2026
Merged

[release/13.2] VS Code Extension: Add right-click context menu on resource endpoint URLs#15347
joperezr merged 1 commit intorelease/13.2from
feature/endpoint-context-menu

Conversation

@mitchdenny
Copy link
Member

Description

Add a right-click context menu on resource endpoint URLs in the VS Code extension's Running AppHosts tree view. Previously, right-clicking on an endpoint URL did nothing — the only interaction was left-clicking to open in the external browser.

This PR adds three context menu actions for endpoint URL tree items:

  • Copy URL — copies the raw URL to the clipboard
  • Open in External Browser — opens in the system default browser (same as current left-click)
  • Open in Simple Browser — opens in VS Code's built-in Simple Browser panel

Introduces an EndpointUrlItem TreeItem subclass (replacing the generic DetailItem for URLs) with contextValue = 'endpointUrl' to enable context menu targeting. Left-click behavior is preserved.

Fixes #15345

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?

Copilot AI review requested due to automatic review settings March 18, 2026 04:35
@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 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/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15347

Or

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

Copy link
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 dedicated tree item type for resource endpoint URLs in the Aspire VS Code extension’s Running AppHosts view so those URL nodes can be targeted by a right‑click context menu (copy/open actions), while preserving existing left‑click behavior.

Changes:

  • Introduces EndpointUrlItem (contextValue = 'endpointUrl') and uses it for resource URL children.
  • Adds commands for copying the URL, opening externally, and opening in VS Code’s Simple Browser; wires them up via package.json view item context menus.
  • Adds localized command titles and a new user-facing “copied to clipboard” message.

Reviewed changes

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

Show a summary per file
File Description
extension/src/views/AspireAppHostTreeProvider.ts Adds EndpointUrlItem and implements the 3 endpoint URL commands.
extension/src/loc/strings.ts Adds a localized “Copied {0} to clipboard” message helper.
extension/src/extension.ts Registers the new endpoint URL commands on activation.
extension/package.nls.json Adds localized display names for the new commands.
extension/package.json Contributes the new commands and adds context menu entries targeting viewItem == endpointUrl.
extension/loc/xlf/aspire-vscode.xlf Adds XLF entries for the new command titles.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +444 to +447
async copyEndpointUrl(element: EndpointUrlItem): Promise<void> {
await vscode.env.clipboard.writeText(element.url);
vscode.window.showInformationMessage(copiedUrlToClipboard(element.url));
}
Copy link
Member

@JamesNK JamesNK left a comment

Choose a reason for hiding this comment

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

This is what I see when I right click on a link in a browser:

Image

IMO, change text to:

  • Open in browser
  • Open in VS Code
  • Copy URL

@joperezr joperezr added the Servicing-approved Approved for servicing release label Mar 18, 2026
@joperezr
Copy link
Member

@mitchdenny thoughts on @JamesNK comments above? Let me know when this is ready to merge.

@adamint
Copy link
Member

adamint commented Mar 18, 2026

The dashboard link item under the AppHost also needs this context menu. After that, lgtm

@mitchdenny mitchdenny force-pushed the feature/endpoint-context-menu branch from cef79c5 to 299d2de Compare March 18, 2026 23:31
Add three context menu actions for endpoint URL tree items in the
Running AppHosts tree view:
- Copy URL to Clipboard
- Open in External Browser
- Open in Simple Browser

Introduces EndpointUrlItem TreeItem subclass with contextValue
'endpointUrl' to enable context menu targeting, replacing the
generic DetailItem for endpoint URLs.

Fixes #15345

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mitchdenny mitchdenny force-pushed the feature/endpoint-context-menu branch from 299d2de to 3d3af6a Compare March 19, 2026 00:25
@github-actions
Copy link
Contributor

🎬 CLI E2E Test Recordings — 52 recordings uploaded (commit 3d3af6a)

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
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndPublishToKubernetes ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ 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 #23273754791

@mitchdenny mitchdenny changed the title VS Code Extension: Add right-click context menu on resource endpoint URLs [release/13.2] VS Code Extension: Add right-click context menu on resource endpoint URLs Mar 19, 2026
@joperezr joperezr merged commit dee5e32 into release/13.2 Mar 19, 2026
257 checks passed
@joperezr joperezr deleted the feature/endpoint-context-menu branch March 19, 2026 01:37
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Mar 19, 2026
@JamesNK
Copy link
Member

JamesNK commented Mar 19, 2026

The text wasn't changed.

@adamint
Copy link
Member

adamint commented Mar 19, 2026

The text wasn't changed.

I will follow up

@adamint
Copy link
Member

adamint commented Mar 19, 2026

I also noticed the commands were not disabled in the command palette

Copilot AI pushed a commit that referenced this pull request Mar 19, 2026
Add three context menu actions for endpoint URL tree items in the
Running AppHosts tree view:
- Copy URL to Clipboard
- Open in External Browser
- Open in Simple Browser

Introduces EndpointUrlItem TreeItem subclass with contextValue
'endpointUrl' to enable context menu targeting, replacing the
generic DetailItem for endpoint URLs.

Fixes #15345

Co-authored-by: Mitch Denny <mitch@mitchdeny.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
adamint pushed a commit that referenced this pull request Mar 23, 2026
Add three context menu actions for endpoint URL tree items in the
Running AppHosts tree view:
- Copy URL to Clipboard
- Open in External Browser
- Open in Simple Browser

Introduces EndpointUrlItem TreeItem subclass with contextValue
'endpointUrl' to enable context menu targeting, replacing the
generic DetailItem for endpoint URLs.

Fixes #15345

Co-authored-by: Mitch Denny <mitch@mitchdeny.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
joperezr pushed a commit that referenced this pull request Mar 23, 2026
)

* Add right-click context menu on resource endpoint URLs (#15347)

Add three context menu actions for endpoint URL tree items in the
Running AppHosts tree view:
- Copy URL to Clipboard
- Open in External Browser
- Open in Simple Browser

Introduces EndpointUrlItem TreeItem subclass with contextValue
'endpointUrl' to enable context menu targeting, replacing the
generic DetailItem for endpoint URLs.

Fixes #15345

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

* Clean up Aspire panel: context menus, loading state, welcome messages (#15375)

* Clean up Aspire panel: context menus, loading state, welcome messages

Adds initial 'loading' screen, new context menus for resources, endpoints,
apphost, and PID nodes. Consolidates previous 3 commits into one for clean
rebase onto main.

* remove unused strings

* remove comands on resources node, update string

* Add AppHost CodeLens and gutter decoration support (#15397)

* Add CodeLens and gutter decoration support for AppHost resources

* wip

* remove status bar strings from branch

* Add CodeLens, gutter decorations, and AppHost resource parsers for VS Code extension

- Add CodeLens provider showing resource state, actions (start/stop/restart), and view logs
- Add gutter decoration provider with colored status circles for resources
- Add C# and JS/TS AppHost resource parsers with registry pattern
- Add statementStartLine for multi-line fluent chain CodeLens positioning
- Add comment-skipping logic so CodeLens appears below comments, above code
- Extract shared resource state utilities and resource constants
- Add enableCodeLens and enableGutterDecorations settings
- Add comprehensive test coverage (parsers, CodeLens, resourceStateUtils)
- Only match parent resources (Add* calls), not implicit child resources (With* calls)

* Address Copilot review: conditional appHostPath, displayName preference, Unhealthy as error

- Guard --apphost flag when appHostPath is falsy in CodeLens commands
- Prefer displayName over name in two-pass resource matching
- Classify Unhealthy health status as error (not warning) to align with tree view

* bump extension version

* update config json

* Fix dashboard image in marketplace README and bump version to 1.0.6 (#15379)

* Fix dashboard image URL: dotnet -> microsoft (#15466 partial)

---------

Co-authored-by: Mitch Denny <midenn@microsoft.com>
Co-authored-by: Mitch Denny <mitch@mitchdeny.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants