feat(vscode-companion): enable Plan Mode toggle and approval UI#2551
feat(vscode-companion): enable Plan Mode toggle and approval UI#2551yiliang114 wants to merge 1 commit intomainfrom
Conversation
- Add Plan Mode to the approval mode cycle (plan → default → auto-edit → yolo → plan) - Add Tab key shortcut to cycle approval modes in the input field - Fix cancel handling for exit_plan_mode: reject plan without aborting agent session - Add plan approval UI in PermissionDrawer with markdown content rendering Closes #1985 Made-with: Cursor
📋 Review SummaryThis PR enables Plan Mode in the VSCode Companion extension, achieving feature parity with the CLI. The implementation includes four key changes: updating the approval mode cycle, adding Tab key shortcut for mode cycling, fixing a bug where cancelling 🔍 General Feedback
🎯 Specific Feedback🟡 High
🟢 Medium
🔵 Low
✅ Highlights
|
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
TLDR
Enable Plan Mode in the VSCode Companion extension, achieving feature parity with the CLI:
plan → default → auto-edit → yolo → plan)exit_plan_modeincorrectly aborted the agent sessionScreenshots / Video Demo
N/A — draft PR, pending manual verification.
Dive Deeper
1.
acpTypes.ts— Mode cycle mappingUpdated
NEXT_APPROVAL_MODEfromdefault → auto-edit → yolo → default(skipping plan) to the fullplan → default → auto-edit → yolo → plancycle so users can enter Plan Mode via the UI toggle button.2.
App.tsx— Tab key shortcutAdded
handleInputKeyDownhandler that cycles approval modes when Tab is pressed while the input field is focused and the completion menu is closed, aligning with the CLI's Shift+Tab behavior.3.
WebViewProvider.ts— Cancel handling fixWhen the
exit_plan_modetool presents the plan approval prompt and the user selects "No, keep planning", acanceloptionId is sent. Previously, all cancel responses triggeredcancelCurrentPrompt()+streamEnd, terminating the agent session. However, forswitch_modekind tool calls (i.e.exit_plan_mode), cancel means "reject the plan and stay in plan mode" — the agent should keep running. Added anisSwitchModeguard to prevent incorrectly aborting the agent.4.
PermissionDrawer.tsx— Plan approval UIswitch_modekind tool callstoolCall.contentand renders it viaMarkdownRenderermax-h-[60vh]to ensure option buttons remain visibleReviewer Test Plan
exit_plan_mode, verify the PermissionDrawer shows:Testing Matrix
Linked issues / bugs
Closes #1985