microsoft / microsoft/aspire

[VS Code] "Add Aspire to this workspace" is still offered when Aspire is already present

Open
#20,022 1 comment 0 reactions 0 assignees View on GitHub
area-vscode
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?
- [x] I have searched the existing issues

### Describe the bug
The Aspire pane's **Create with Aspire…** action (`aspire-vscode.createWithAspire`) always offers both **Create a new Aspire app** and **Add Aspire to this workspace**, even when the workspace already has an AppHost. Offering `aspire init` again in that case doesn't make sense — Aspire is already set up.

Confirmed on `origin/main` (`extension/src/commands/createWithAspire.ts`): the quick-pick items array is built unconditionally with both entries and never checks whether an AppHost already exists in the workspace before showing them.

This was called out as an explicit acceptance criterion in #19499 ("Initialization is only offered for applicable workspace folders without an AppHost") but was never implemented when that feature shipped in #19539. The PR's own E2E test (`workspaceTargetProof.e2e.test.ts`) only exercises a 3-folder workspace where two folders lack an AppHost, so the always-both-options behavior went unnoticed.

### Expected Behavior
**Add Aspire to this workspace** should be hidden from the picker when every workspace folder already contains an AppHost. It should remain visible when the workspace is empty, or when at least one folder (in a multi-root workspace) still lacks an AppHost.

### Steps To Reproduce
1. Open a workspace/folder that already has an AppHost (e.g. run `aspire new` first).
2. Open the Aspire pane and click **Create with Aspire…** (or run "Aspire: Create with Aspire..." from the Command Palette).
3. Observe that **Add Aspire to this workspace** is still offered alongside **Create a new Aspire app**, even though the workspace already has Aspire set up.

### Additional context
- Component: VS Code extension (`extension/src/commands/createWithAspire.ts`, `extension/src/activation/registerCliCommands.ts`)
- Related: #19499 (original feature request with the unmet acceptance criterion), #19539 (implementation PR)
- Fix in progress on branch `ellahathaway-hide-init-when-apphost-exists`: hides the "Add Aspire to this workspace" option by checking each workspace folder's AppHost status via `AspireEditorCommandProvider.getAppHostPath()` before building the quick-pick items.

Contributor guide

Open the contributing guide

Research direction

Start in extension/src/commands/createWithAspire.ts and inspect how AspireEditorCommandProvider.getAppHostPath() is used; then review extension/src/activation/registerCliCommands.ts and workspaceTargetProof.e2e.test.ts. Verify the picker for empty, mixed, and all-AppHost workspaces, with the Add Aspire option hidden only when every folder already has an AppHost.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.