From 8ed0323f159129bd8813f1b922f4c90cc50bae8a Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 29 May 2024 09:46:08 +0200 Subject: [PATCH] `Ctrl + I` does not work when chat input field has focus (fix #213637) (#213776) * `Ctrl + I` does not work when chat input field has focus (fix #213637) * simplify --- .../contrib/chat/common/voiceChatService.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/chat/common/voiceChatService.ts b/src/vs/workbench/contrib/chat/common/voiceChatService.ts index ac140ad3c6b9a..88ec821567bb9 100644 --- a/src/vs/workbench/contrib/chat/common/voiceChatService.ts +++ b/src/vs/workbench/contrib/chat/common/voiceChatService.ts @@ -152,7 +152,8 @@ export class VoiceChatService extends Disposable implements IVoiceChatService { disposables.add(session.onDidChange(e => { switch (e.status) { case SpeechToTextStatus.Recognizing: - case SpeechToTextStatus.Recognized: + case SpeechToTextStatus.Recognized: { + let massagedEvent: IVoiceChatTextEvent = e; if (e.text) { const startsWithAgent = e.text.startsWith(VoiceChatService.PHRASES_UPPER[VoiceChatService.AGENT_PREFIX]) || e.text.startsWith(VoiceChatService.PHRASES_LOWER[VoiceChatService.AGENT_PREFIX]); const startsWithSlashCommand = e.text.startsWith(VoiceChatService.PHRASES_UPPER[VoiceChatService.COMMAND_PREFIX]) || e.text.startsWith(VoiceChatService.PHRASES_LOWER[VoiceChatService.COMMAND_PREFIX]); @@ -208,15 +209,16 @@ export class VoiceChatService extends Disposable implements IVoiceChatService { } } - emitter.fire({ + massagedEvent = { status: e.status, text: (transformedWords ?? originalWords).join(' '), waitingForInput - }); - - break; + }; } } + emitter.fire(massagedEvent); + break; + } case SpeechToTextStatus.Started: this.activeVoiceChatSessions++; this.voiceChatInProgress.set(true); @@ -226,7 +228,7 @@ export class VoiceChatService extends Disposable implements IVoiceChatService { onSessionStoppedOrCanceled(false); emitter.fire(e); break; - default: + case SpeechToTextStatus.Error: emitter.fire(e); break; }