[release/13.2] VS Code Extension: Add right-click context menu on resource endpoint URLs#15347
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15347Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15347" |
There was a problem hiding this comment.
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.jsonview 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.
| async copyEndpointUrl(element: EndpointUrlItem): Promise<void> { | ||
| await vscode.env.clipboard.writeText(element.url); | ||
| vscode.window.showInformationMessage(copiedUrlToClipboard(element.url)); | ||
| } |
|
@mitchdenny thoughts on @JamesNK comments above? Let me know when this is ready to merge. |
|
The dashboard link item under the AppHost also needs this context menu. After that, lgtm |
cef79c5 to
299d2de
Compare
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>
299d2de to
3d3af6a
Compare
|
🎬 CLI E2E Test Recordings — 52 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #23273754791 |
|
The text wasn't changed. |
I will follow up |
|
I also noticed the commands were not disabled in the command palette |
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>
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>
) * 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>

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:
Introduces an
EndpointUrlItemTreeItem subclass (replacing the genericDetailItemfor URLs) withcontextValue = 'endpointUrl'to enable context menu targeting. Left-click behavior is preserved.Fixes #15345
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: