@@ -21,8 +21,6 @@ import { IChatService } from 'vs/workbench/contrib/chat/common/chatService';
21
21
import { CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST , MENU_INLINE_CHAT_INPUT } from 'vs/workbench/contrib/inlineChat/common/inlineChat' ;
22
22
import { CONTEXT_CHAT_REQUEST_IN_PROGRESS , CONTEXT_PROVIDER_EXISTS } from 'vs/workbench/contrib/chat/common/chatContextKeys' ;
23
23
import { InlineChatController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController' ;
24
- import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
25
- import { getCodeEditor } from 'vs/editor/browser/editorBrowser' ;
26
24
import { CommandsRegistry , ICommandService } from 'vs/platform/commands/common/commands' ;
27
25
import { ActiveEditorContext } from 'vs/workbench/common/contextkeys' ;
28
26
import { IViewsService } from 'vs/workbench/services/views/common/viewsService' ;
@@ -46,6 +44,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
46
44
import { IConfigurationRegistry , Extensions } from 'vs/platform/configuration/common/configurationRegistry' ;
47
45
import { IStatusbarEntry , IStatusbarEntryAccessor , IStatusbarService , StatusbarAlignment } from 'vs/workbench/services/statusbar/browser/statusbar' ;
48
46
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService' ;
47
+ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService' ;
49
48
50
49
const CONTEXT_VOICE_CHAT_GETTING_READY = new RawContextKey < boolean > ( 'voiceChatGettingReady' , false , { type : 'boolean' , description : localize ( 'voiceChatGettingReady' , "True when getting ready for receiving voice input from the microphone for voice chat." ) } ) ;
51
50
const CONTEXT_VOICE_CHAT_IN_PROGRESS = new RawContextKey < boolean > ( 'voiceChatInProgress' , false , { type : 'boolean' , description : localize ( 'voiceChatInProgress' , "True when voice recording from microphone is in progress for voice chat." ) } ) ;
@@ -84,7 +83,7 @@ class VoiceChatSessionControllerFactory {
84
83
const chatService = accessor . get ( IChatService ) ;
85
84
const viewsService = accessor . get ( IViewsService ) ;
86
85
const chatContributionService = accessor . get ( IChatContributionService ) ;
87
- const editorService = accessor . get ( IEditorService ) ;
86
+ const codeEditorService = accessor . get ( ICodeEditorService ) ;
88
87
const quickChatService = accessor . get ( IQuickChatService ) ;
89
88
const layoutService = accessor . get ( IWorkbenchLayoutService ) ;
90
89
@@ -114,7 +113,7 @@ class VoiceChatSessionControllerFactory {
114
113
}
115
114
116
115
// Try with the inline chat
117
- const activeCodeEditor = getCodeEditor ( editorService . activeTextEditorControl ) ;
116
+ const activeCodeEditor = codeEditorService . getFocusedCodeEditor ( ) ;
118
117
if ( activeCodeEditor ) {
119
118
const inlineChat = InlineChatController . get ( activeCodeEditor ) ;
120
119
if ( inlineChat ?. hasFocus ( ) ) {
@@ -136,7 +135,7 @@ class VoiceChatSessionControllerFactory {
136
135
137
136
// Inline Chat
138
137
if ( context === 'inline' ) {
139
- const activeCodeEditor = getCodeEditor ( editorService . activeTextEditorControl ) ;
138
+ const activeCodeEditor = codeEditorService . getFocusedCodeEditor ( ) ;
140
139
if ( activeCodeEditor ) {
141
140
const inlineChat = InlineChatController . get ( activeCodeEditor ) ;
142
141
if ( inlineChat ) {
@@ -772,7 +771,8 @@ export class KeywordActivationContribution extends Disposable implements IWorkbe
772
771
@IConfigurationService private readonly configurationService : IConfigurationService ,
773
772
@ICommandService private readonly commandService : ICommandService ,
774
773
@IEditorGroupsService private readonly editorGroupService : IEditorGroupsService ,
775
- @IInstantiationService instantiationService : IInstantiationService
774
+ @IInstantiationService instantiationService : IInstantiationService ,
775
+ @ICodeEditorService private readonly codeEditorService : ICodeEditorService
776
776
) {
777
777
super ( ) ;
778
778
@@ -879,7 +879,9 @@ export class KeywordActivationContribution extends Disposable implements IWorkbe
879
879
case KeywordActivationContribution . SETTINGS_VALUE . QUICK_CHAT :
880
880
return QuickVoiceChatAction . ID ;
881
881
case KeywordActivationContribution . SETTINGS_VALUE . CHAT_IN_CONTEXT :
882
- return StartVoiceChatAction . ID ;
882
+ if ( this . codeEditorService . getFocusedCodeEditor ( ) ) {
883
+ return InlineVoiceChatAction . ID ;
884
+ }
883
885
default :
884
886
return VoiceChatInChatViewAction . ID ;
885
887
}
0 commit comments