Allow editor/terminal dictation to take over an active Chat dictation session - #328830
Conversation
Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Anthony Kim (@anthonykim1)Matched files:
|
There was a problem hiding this comment.
Pull request overview
Enables editor and terminal dictation to take over the shared speech engine from another surface.
Changes:
- Cancels active dictation before starting on another surface.
- Adjusts editor listener ordering to avoid premature teardown.
- Adds editor-to-editor takeover coverage.
Show a summary per file
| File | Description |
|---|---|
terminalVoice.ts |
Adds terminal takeover behavior. |
editorDictation.ts |
Delays editor idle-listener registration. |
dictationSession.ts |
Adds shared-session takeover logic. |
dictationSession.test.ts |
Tests editor takeover and realistic cancellation. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-editor-terminal-issue # Conflicts: # src/vs/workbench/contrib/chat/test/browser/dictationSession.test.ts
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Merge conflicts resolved in c4b13ce. Conflicting hunks in the dictation files were merged (combined |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5acd649-25c6-4115-98a7-6183cbd1a60f
…-editor-terminal-issue
Description
Chat, editor, and terminal dictation share a single on-device speech engine, so only one can run at a time. While Chat dictation was active, "Start Dictation in Editor" and "Start Dictation in Terminal" silently did nothing: the editor path early-returned from
startDictation(the shared_activesession was owned by Chat), and the terminal path aborted when the engine was busy.The fix lets a new surface take over: each surface already tears down its own UI when it observes the engine go
Idle, so a new start just cancels the current session before attaching its own listeners.dictationSession.ts(startDictation) — instead of no-op returning when a session is active, cancel the current session (Chat, another editor, or terminal) and take over; the previous surface cleans up via its ownIdlelistener and keeps whatever transcript it had inserted. Same-editor re-entry still returns early (toggle handled by callers).editorDictation.ts(startBuiltin) — register the "self-teardown onIdle" listener afterstartDictationso the takeover's cancel of the previous surface can't tear down the just-started editor session.terminalVoice.ts(_startBuiltin) — replace the "abort when busy" guard with aservice.cancel()takeover (before subscribing), keeping a defensive bail-out if the engine somehow stays busy.dictationSession.test.ts— added coverage for cross-surface takeover (first editor keeps its text, second becomes active); updated the mockcancel()to emit the realIdletransition.Takeover is now symmetric across the reported directions (Chat → editor, Chat → terminal) as well as editor ↔ terminal, with no cross-contribution imports.