[release/13.3] Show AppHost code lenses without opening the panel; add Open Dashboard / View Logs lenses#16682
Open
aspire-repo-bot[bot] wants to merge 5 commits intorelease/13.3from
Open
Conversation
When a brand-new C# or TS/JS AppHost file was opened, the resource code
lenses didn't appear and no live data was fetched until the user opened
the Running AppHosts panel. The data repository was gating both
'aspire describe --follow' and 'aspire ps' polling solely on panel
visibility.
Open the gates so they react to either signal:
- Add 'AppHostFilePresenceWatcher' that watches visible text editors and
reports to 'AppHostDataRepository.setAppHostFileOpen' whenever any
visible editor is detected as an AppHost file by the existing parsers.
- 'AppHostDataRepository._dataActive' is true when either the panel is
visible OR an AppHost file is open, so describe/ps lifecycle now
follows the union of both gates.
Also surface AppHost-level actions on the builder statement:
- 'AppHostResourceParser' gains an optional 'findBuilderStatementLine'
hook. C# locates 'DistributedApplication.CreateBuilder' and TS/JS
locates 'createBuilder('.
- 'AspireCodeLensProvider' renders 'Open Dashboard' and 'View Logs'
lenses above the builder line whenever live data is available, routed
through the matching running AppHost (path/dir match) so the right
'--apphost' is targeted in multi-host scenarios.
- New extension commands 'aspire-vscode.codeLensOpenDashboard' and
'aspire-vscode.codeLensViewAppHostLogs' wire the lenses through the
existing tree provider and terminal helpers.
Tighten icon-to-label spacing in CodeLens titles by inserting a HAIR
SPACE (U+200A) between the codicon and the text in all 20 lens strings.
The CodeLens API exposes no other typography control, and U+200A adds
roughly one pixel of breathing room without disturbing translation.
Tests:
- New tests for the dual-gate behavior on 'AppHostDataRepository'.
- New tests for 'findBuilderStatementLine' in both parsers.
- 'findStatementStartLine' now skips '#:'-style file-scoped C# directives
and blank lines so the builder lens lands on the actual statement.
- _resolveAppHostPathForDocument now returns undefined when the document cannot be tied to a running AppHost; the .cs source-path fallback (which the CLI cannot resolve into a project) is removed. - Builder lenses (Open Dashboard / View Logs) only emit when a running AppHost is concretely matched, and emit even when the file has no Add* resource calls. - AppHostFilePresenceWatcher now also reacts to onDidChangeTextDocument (debounced) so toggling AppHost-ness via edits is picked up without a visibility/save round-trip. - 'Open Aspire Dashboard' capitalization aligned with the existing command.openDashboard string. - New tests for AppHostFilePresenceWatcher (9), AspireCodeLensProvider builder lens (9) and AspireAppHostTreeProvider.findAppHostElement (9).
…erminal commands
- Send Ctrl+C (\x03) instead of Ctrl+U/Esc before sending commands to the
Aspire terminal, so a new command interrupts any foreground Aspire process
(e.g. `aspire logs --follow`) instead of being delivered to its stdin.
- Anchor resource code lenses at the resource's own `.AddXyz("name")` call
line instead of the chain's start line, so chained resources like
`builder.AddPostgres("pg").AddDatabase("db")` no longer stack two
state/action lens sets on the same line. Pipeline steps still anchor at
the statement start.
- Dedupe gutter decorations by (line, category) so resources sharing a line
don't double-stack identical icons.
- Replace the pale-green check used for Finished/Exited/Stopped resources
with a clearly distinct icon: a grey hollow circle with a check inside in
the editor gutter, and the `circle-outline` codicon (matching the
`Stopped` code-lens label) in the tree view. Previously the pale-green
and bright-green checks were nearly indistinguishable at gutter icon size,
making stopped resources look like they were still running.
…ed icon assertions - aspireCodeLensProvider.test.ts: build test paths via path.join(path.sep, ...) so vscode.Uri.file().fsPath (which uses backslashes on Windows) matches the hostPath dirname. Previously the Windows CI run failed all 3 'emits builder lenses' tests with 0 !== 2 because '/repo/AppHost' (forward) never equaled '\repo\AppHost' (back). Two other tests were silently passing for the wrong reason; updated them too so they really exercise the no-match branch. - appHostTreeView.test.ts: update the two Finished-state icon assertions to expect 'circle-outline' (the new hollow-circle stopped icon) instead of 'pass'. Mirrors the previous commit's tree-view icon change.
- Skip DistributedApplication.CreateBuilder/createBuilder matches in // and /* */ comment lines so the AppHost-level code-lens anchors on real builder lines. - Use additionalArgs (per-platform escaping) for the codeLensViewAppHostLogs command instead of interpolating the path into a shell command string. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16682Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16682" |
Contributor
|
🎬 CLI E2E Test Recordings — 66 recordings uploaded (commit View all recordings
📹 Recordings uploaded automatically from CI run #25235254717 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #16667 to release/13.3
/cc @adamint
Customer Impact
Testing
Risk
Regression?