Repository navigation
ux(vscode): quick-pick workspace root for ambiguous multi-root starts (#2077) - #2180
Conversation
…#2077) A multi-root workspace with no active file editor refused server start with workspaceAmbiguous and told the user to 'select one workspace folder' — with no in-product way to do so. ripr: Select Workspace Root now offers a quick pick over the workspace folders (name + path); the pick is session state consulted only when the document-driven root state is ambiguous (the active-document disambiguation always wins, and a stale pick falls back to ambiguous). The blocked start path also offers the same flow from a warning action. One server for one folder; the single-server model is unchanged.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Warning Review limit reached
Next review available in: 2 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThe VS Code extension adds a ChangesWorkspace Root Selection
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant VSCode
participant RiprClientController
User->>VSCode: Run ripr.selectWorkspaceRoot
VSCode->>RiprClientController: selectWorkspaceRoot()
RiprClientController-->>VSCode: Show workspace folders
User->>VSCode: Pick workspace folder
VSCode->>RiprClientController: Selected root
RiprClientController->>RiprClientController: Restart server with selected cwd
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e14f2cb7b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…2077) Review (codex P2): awaiting the warning notification inside start() blocked start — and extension activation, which awaits it — until the user answered, which may never happen. The warning is now fire-and- forget; accepting the action still runs the picker flow.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
editors/vscode/src/client.ts (1)
294-322: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winUn-awaited
offerWorkspaceRootSelection()promise has no observable outcome — root cause of both an error-handling gap and a racy test assertion.Both sites stem from the same root cause:
void this.offerWorkspaceRootSelection();discards its promise, so nothing can attach error handling to it and nothing can await its completion.
editors/vscode/src/client.ts#L294-L322: attach a.catch()to the fire-and-forget call (mirroring the existingwarnWithOutputpattern elsewhere in this file) so a failure deep in the deferred restart chain (e.g.client.start()rejecting) is logged instead of becoming a silent unhandled rejection.editors/vscode/test/suite/workspace_root_picker.test.ts#L167-L183: the assertion onharness.serverCwdsat line 182 depends on that same un-awaited chain reachingcreateLanguageClient; verify (or restructure the test to explicitly wait on) that chain's completion before asserting, sinceawait controller.start()can resolve well before it.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@editors/vscode/src/client.ts` around lines 294 - 322, Attach a rejection handler to the fire-and-forget offerWorkspaceRootSelection() call in editors/vscode/src/client.ts lines 294-322, following the existing warnWithOutput pattern so deferred restart failures are logged. In editors/vscode/test/suite/workspace_root_picker.test.ts lines 167-183, explicitly wait for the workspace-root selection/restart chain to reach createLanguageClient before asserting harness.serverCwds.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@editors/vscode/src/client.ts`:
- Around line 467-539: Update selectWorkspaceRoot() and the active-document
resolution path around resolveWorkspaceRootState() to detect when the newly
stored selectedWorkspaceRoot differs from the runtime-selected root and is
therefore superseded. Emit a clear output or user-facing notice explaining that
the active document determines the workspace root, while preserving the existing
preference for active-document resolution and the current ambiguousMultiRoot
selection behavior.
---
Outside diff comments:
In `@editors/vscode/src/client.ts`:
- Around line 294-322: Attach a rejection handler to the fire-and-forget
offerWorkspaceRootSelection() call in editors/vscode/src/client.ts lines
294-322, following the existing warnWithOutput pattern so deferred restart
failures are logged. In editors/vscode/test/suite/workspace_root_picker.test.ts
lines 167-183, explicitly wait for the workspace-root selection/restart chain to
reach createLanguageClient before asserting harness.serverCwds.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 64e95107-14ef-41da-b7d6-e9a2feb027d8
📒 Files selected for processing (11)
docs/CONFIGURATION.mddocs/TESTING.mdeditors/vscode/README.mdeditors/vscode/package.jsoneditors/vscode/src/client.tseditors/vscode/src/extension.tseditors/vscode/test/suite/extension.test.tseditors/vscode/test/suite/show_output_action.test.tseditors/vscode/test/suite/workspace_root_picker.test.tseditors/vscode/test/suite/workspace_trust_runtime.test.tseditors/vscode/test/suite/workspace_trust_transition.test.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
EffortlessMetrics/ripr(auto-detected)EffortlessMetrics/perl-lsp(auto-detected)EffortlessMetrics/unsafe-review(auto-detected)EffortlessMetrics/ub-review(auto-detected)
…ring it silently (#2077) Review: a session pick whose folder left the workspace was ignored with no signal. It now logs why the pick is not applied and clears it, so a later ambiguous resolution does not keep skipping a dead selection.
Summary
Fixes #2077: a multi-root workspace with no active file editor (or an untitled buffer focused) refused server start with
workspaceAmbiguousand told the user to "select one workspace folder" — with no in-product way to do so. The only escape hatch (open a Rust file from one folder) was undocumented in the README.ripr: Select Workspace Root(palette +contributes.commands): quick-pick overworkspace.workspaceFolders(name + fsPath via the pure, testableworkspaceRootPickItems()).ambiguousMultiRoot— the active-document disambiguation always wins, and a stale pick (folder removed from the workspace) falls back to ambiguous.ripr: Restart Serverafter picking reuses the pick through the SAME single-server start path.nextStepstrings (status bar + server status) name the new command instead of only "open a Rust file".onCommandactivationEvents entry (commented in extension.ts): VS Code ≥1.74 auto-activates on contributed commands and engines is ^1.90.0.Closes #2077
Test evidence
Six new fake-runtime tests (
test/suite/workspace_root_picker.test.ts, the suite the runner actually executes): pick-list shape; palette pick starts server withcwd= picked root; ambiguous-start warning action starts for the picked root; dismissal keeps the server stopped; restart reuses the pick without re-showing; stale pick falls back to ambiguous.showQuickPickis unstubbable in test-electron, so coverage goes through the runtime seam + pure function (stated in the file header).e2e (
xvfb-run -a npm run test:e2e, real VS Code): branch 92 passing / 5 failing; baseline at origin/main 84 passing / 7 failing — all 5 branch failures are pre-existing harness/environment failures on main (same test names), confirmed by the baseline run; zero new failures. Logs verified by the integrator (/tmp/e2e-2077-rerun.log,/tmp/e2e-baseline.log).Validation
npm ci+cargo xtask vscode-compile— cleancargo xtask check-file-policy/check-static-language/check-doc-index— exit 0Noted follow-up
src/test/multiroot.test.tscompiles toout/src/test/but is never executed by the test runner (the live suite istest/suite/) — dead test code flagged for separate cleanup.