Prevent Aspire view from stealing sidebar focus - #19754
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: db22aff4-7041-426f-989f-c44a072c49a8
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19754Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19754" |
Tests selector (audit mode)The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement. 0 / 102 test projects · 2 jobs, from 4 changed files. Selected test projects (0 / 102)none — no .NET test projects run for this change. Selected jobs (2)
How these were chosen — grouped by what changedJob reasons
Selection computed for commit |
There was a problem hiding this comment.
Pull request overview
Prevents hidden Aspire views from stealing sidebar focus during VS Code reload while preserving single-AppHost auto-expansion.
Changes:
- Defers AppHost reveal until the Aspire view is visible.
- Adds unit coverage for visibility and disposal behavior.
- Adds an E2E reload-focus regression test.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
extension/src/views/AspireAppHostTreeProvider.ts |
Gates auto-expansion on view visibility. |
extension/src/test/appHostTreeView.test.ts |
Tests deferred, one-time expansion. |
extension/src/test-e2e/helpers/vscode.ts |
Adds sidebar observation helper. |
extension/src/test-e2e/appHostTree.e2e.test.ts |
Verifies Explorer retains focus after reload. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
Pull request created: #1598
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1598 targeting Added a note in Note This draft PR needs human review before merging. |
Description
Reloading VS Code while another sidebar view was selected could activate the Aspire view and restore its hidden Activity Bar entry. AppHost discovery was calling
TreeView.reveal()to auto-expand a single AppHost even while the Aspire view was hidden; VS Code activates the view container as part of that reveal.This change preserves single-AppHost auto-expansion but defers
reveal()until the Aspire view is already visible. A visibility listener performs the pending expansion when the user explicitly opens Aspire.User-facing behavior
Selecting Explorer and running Developer: Reload Window now leaves Explorer active. Opening Aspire explicitly still shows the single workspace AppHost expanded.
Reproduction
Before this change, Aspire reappears in the Activity Bar and becomes the active sidebar view. After this change, Aspire remains hidden and Explorer retains focus. Re-enabling and explicitly opening Aspire still auto-expands the single AppHost.
Validation
extension/build.ps1corepack yarn compile-testscorepack yarn compile-e2ecorepack yarn lintAspireAppHostTreeProviderunit testFixes #19746
Checklist
<remarks />and<code />elements on your triple slash comments?