Repository navigation
Forward port VS Code extension changes from release/13.2 to main - #15502
Conversation
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 <[email protected]> Co-authored-by: Copilot <[email protected]>
…#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 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
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15502Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15502" |
There was a problem hiding this comment.
Pull request overview
Forward-ports VS Code extension updates from release/13.2 to main, expanding the Aspire panel UX (context menus + loading/welcome states) and adding editor integrations (AppHost CodeLens + gutter decorations) backed by new parsers and tests.
Changes:
- Add richer tree view items + context menu commands (copy/open URLs, copy PIDs/apphost paths, improved dashboard URL handling).
- Introduce AppHost editor features: CodeLens actions + gutter status decorations, plus C#/JS/TS AppHost resource parsers and supporting utilities/tests.
- Update extension packaging/docs (new settings + commands, loading/welcome strings, version bump, README image URL); small playground updates.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| playground/TypeScriptApps/RpsArena/apphost.ts | Adds pgAdmin to the sample Postgres resource chain. |
| playground/TypeScriptApps/RpsArena/.modules/transport.ts | Adds an authentication step to the JSON-RPC connection establishment. |
| extension/src/views/AspireAppHostTreeProvider.ts | New tree item types (endpoint URL + PID), context menu support, resource reveal ancestry support, and clipboard/browser commands. |
| extension/src/views/AppHostDataRepository.ts | Adds loading state/context handling and adjusts workspace/global error/welcome behavior. |
| extension/src/editor/resourceConstants.ts | Centralizes resource state/health/style/type string constants for consistent UI logic. |
| extension/src/editor/resourceStateUtils.ts | Adds helpers to match workspace/runtime resources to source-defined names. |
| extension/src/editor/parsers/AppHostResourceParser.ts | Adds parser registry abstraction and supported language resolution. |
| extension/src/editor/parsers/csharpAppHostParser.ts | Adds regex-based C# AppHost resource parsing + statementStartLine computation. |
| extension/src/editor/parsers/jsTsAppHostParser.ts | Adds regex-based JS/TS AppHost resource parsing + statementStartLine computation. |
| extension/src/editor/AspireCodeLensProvider.ts | Adds CodeLens for pipeline-step debug and resource state/actions/logs. |
| extension/src/editor/AspireGutterDecorationProvider.ts | Adds gutter dot decorations reflecting live resource state (debounced updates). |
| extension/src/extension.ts | Wires up CodeLens + gutter providers and registers new tree/context menu commands. |
| extension/src/loc/strings.ts | Adds localized strings for CodeLens labels/actions. |
| extension/package.json | Adds new contributions: settings, commands, view welcome/loading entries, and view item context menus; bumps version. |
| extension/package.nls.json | Adds localized strings for new settings/commands/welcome messages. |
| extension/loc/xlf/aspire-vscode.xlf | Adds XLF entries for new strings and updated global view title. |
| extension/README.md | Fixes marketplace image rendering by switching to raw GitHub URL. |
| extension/src/test/appHostTreeView.test.ts | Updates tests to use centralized resource constants. |
| extension/src/test/resourceStateUtils.test.ts | Adds coverage for resource matching logic across apphosts/workspace. |
| extension/src/test/codeLens.test.ts | Adds coverage for CodeLens state label mapping. |
| extension/src/test/parsers.test.ts | Adds comprehensive coverage for C#/JS/TS AppHost parsers and registry behavior. |
| const codeLensResourceActionRegistration = vscode.commands.registerCommand('aspire-vscode.codeLensResourceAction', (resourceName: string, action: string, appHostPath: string) => { | ||
| let command = `resource "${resourceName}" ${action}`; | ||
| if (appHostPath) { | ||
| command += ` --apphost "${appHostPath}"`; | ||
| } | ||
| terminalProvider.sendAspireCommandToAspireTerminal(command); |
There was a problem hiding this comment.
The CodeLens resource action handler builds resource "<name>" ${action} without quoting action. For custom resource commands (where the command key may contain spaces or other shell-significant characters), this can produce an invalid CLI command, and it’s also inconsistent with the tree view’s executeResourceCommand path which quotes the selected command. Consider quoting/escaping the action/command name when building the CLI string.
| for (const sibling of siblings) { | ||
| const children = this.getChildren(sibling); | ||
| for (const child of children) { | ||
| if (child.id === target.id) { |
There was a problem hiding this comment.
getParent/_findParent matches children by child.id === target.id, but PidItem and EndpointUrlItem never set id (so both are undefined). That can cause incorrect parent resolution (any undefined-id child will match), which can break TreeView navigation/reveal behavior for those items. Fix by assigning stable unique ids for these item types (e.g. pid:<pid> / endpoint:<url>) or by guarding the comparison (only compare when both ids are defined).
| if (child.id === target.id) { | |
| if (child.id !== undefined && target.id !== undefined && child.id === target.id) { |
| private _updateLoadingContext(): void { | ||
| const isLoading = this._viewMode === 'workspace' ? this._loadingWorkspace : this._loadingGlobal; | ||
| vscode.commands.executeCommand('setContext', 'aspire.loading', isLoading); | ||
| } |
There was a problem hiding this comment.
The new loading context (aspire.loading) is only ever cleared (when data arrives / errors), but it is never set back to true when a new fetch cycle starts (e.g., refresh() restarting describe/polling, or when entering a mode that hasn’t loaded yet). This can leave the UI showing the non-loading welcome state while a refresh is in progress. Consider explicitly setting _loadingWorkspace/_loadingGlobal back to true at the start of refresh/poll start, and calling _updateLoadingContext() immediately so the loading welcome message is shown consistently.
| // Skip lines that are comments (// or /* or * continuation) | ||
| while (line < matchLine) { | ||
| const lineText = document.lineAt(line).text.trimStart(); | ||
| if (lineText.startsWith('//') || lineText.startsWith('/*') || lineText.startsWith('*')) { | ||
| line++; | ||
| } else { | ||
| break; | ||
| } | ||
| } | ||
| return line; |
There was a problem hiding this comment.
_findStatementStartLine stops skipping when it encounters a blank line after comments. In a pattern like // comment\n\nconst x = builder\n .addRedis(...), this will return the blank line, placing CodeLens/decoration above the statement. Consider also skipping blank/whitespace-only lines while advancing past comments (e.g., treat lineText.length === 0 as skippable).
| // Skip lines that are comments (// or /* or * continuation) | ||
| while (line < matchLine) { | ||
| const lineText = document.lineAt(line).text.trimStart(); | ||
| if (lineText.startsWith('//') || lineText.startsWith('/*') || lineText.startsWith('*')) { | ||
| line++; | ||
| } else { | ||
| break; | ||
| } | ||
| } | ||
| return line; |
There was a problem hiding this comment.
_findStatementStartLine stops skipping when it encounters a blank line after comments. If there’s a blank line between comment(s) and the statement, this can return the blank line and place CodeLens/decoration above the statement. Consider skipping blank/whitespace-only lines in the same loop that skips comment lines.
|
🎬 CLI E2E Test Recordings — 52 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #23458121147 |
|
Failing check is unrelated. |
cde51ba
into
main
|
No documentation PR is required for this change. This PR is a forward port of VS Code extension changes from
|
Description
Forward port VS Code extension changes from
release/13.2tomain. These 5 extension-scoped commits were made on the release branch but never merged back to main.Cherry-picked commits:
dotnet/aspire→microsoft/aspireNotes:
extension/README.md) were ported since the non-extension changes from the parallel Update CI workflow owner guards and repo references from dotnet to microsoft #15452 already landed on main.playground/TypeScriptApps/RpsArena/aspire.config.jsonwas resolved by keeping the main version (which has newer SDK version references).Checklist