@@ -25,10 +25,9 @@ import { IChatWidgetService } from 'vs/workbench/contrib/chat/browser/chat';
25
25
import { IChatEditorOptions } from 'vs/workbench/contrib/chat/browser/chatEditor' ;
26
26
import { ChatEditorInput } from 'vs/workbench/contrib/chat/browser/chatEditorInput' ;
27
27
import { ChatViewPane } from 'vs/workbench/contrib/chat/browser/chatViewPane' ;
28
- import { ChatAgentLocation , IChatAgentService } from 'vs/workbench/contrib/chat/common/chatAgents' ;
29
- import { CONTEXT_CHAT_INPUT_CURSOR_AT_TOP , CONTEXT_CHAT_INPUT_HAS_AGENT , CONTEXT_CHAT_INPUT_HAS_TEXT , CONTEXT_CHAT_LOCATION , CONTEXT_CHAT_REQUEST_IN_PROGRESS , CONTEXT_IN_CHAT_INPUT , CONTEXT_IN_CHAT_SESSION , CONTEXT_PROVIDER_EXISTS , CONTEXT_REQUEST , CONTEXT_RESPONSE } from 'vs/workbench/contrib/chat/common/chatContextKeys' ;
28
+ import { ChatAgentLocation } from 'vs/workbench/contrib/chat/common/chatAgents' ;
29
+ import { CONTEXT_CHAT_INPUT_CURSOR_AT_TOP , CONTEXT_CHAT_LOCATION , CONTEXT_IN_CHAT_INPUT , CONTEXT_IN_CHAT_SESSION , CONTEXT_PROVIDER_EXISTS , CONTEXT_REQUEST , CONTEXT_RESPONSE } from 'vs/workbench/contrib/chat/common/chatContextKeys' ;
30
30
import { IChatContributionService } from 'vs/workbench/contrib/chat/common/chatContributionService' ;
31
- import { chatAgentLeader } from 'vs/workbench/contrib/chat/common/chatParserTypes' ;
32
31
import { IChatDetail , IChatService } from 'vs/workbench/contrib/chat/common/chatService' ;
33
32
import { IChatWidgetHistoryService } from 'vs/workbench/contrib/chat/common/chatWidgetHistoryService' ;
34
33
import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
@@ -93,86 +92,8 @@ class OpenChatGlobalAction extends Action2 {
93
92
}
94
93
}
95
94
96
- export class ChatSubmitSecondaryAgentEditorAction extends EditorAction2 {
97
- static readonly ID = 'workbench.action.chat.submitSecondaryAgent' ;
98
-
99
- constructor ( ) {
100
- super ( {
101
- id : ChatSubmitSecondaryAgentEditorAction . ID ,
102
- title : localize2 ( { key : 'actions.chat.submitSecondaryAgent' , comment : [ 'Send input from the chat input box to the secondary agent' ] } , "Submit to Secondary Agent" ) ,
103
- precondition : ContextKeyExpr . and ( CONTEXT_CHAT_INPUT_HAS_TEXT , CONTEXT_CHAT_INPUT_HAS_AGENT . negate ( ) , CONTEXT_CHAT_REQUEST_IN_PROGRESS . negate ( ) ) ,
104
- keybinding : {
105
- when : CONTEXT_IN_CHAT_INPUT ,
106
- primary : KeyMod . CtrlCmd | KeyCode . Enter ,
107
- weight : KeybindingWeight . EditorContrib
108
- } ,
109
- menu : {
110
- id : MenuId . ChatExecuteSecondary ,
111
- group : 'group_1' ,
112
- when : CONTEXT_CHAT_INPUT_HAS_AGENT . negate ( ) ,
113
- }
114
- } ) ;
115
- }
116
-
117
- runEditorCommand ( accessor : ServicesAccessor , editor : ICodeEditor ) : void | Promise < void > {
118
- const editorUri = editor . getModel ( ) ?. uri ;
119
- if ( editorUri ) {
120
- const agentService = accessor . get ( IChatAgentService ) ;
121
- const secondaryAgent = agentService . getSecondaryAgent ( ) ;
122
- if ( ! secondaryAgent ) {
123
- return ;
124
- }
125
-
126
- const widgetService = accessor . get ( IChatWidgetService ) ;
127
- const widget = widgetService . getWidgetByInputUri ( editorUri ) ;
128
- if ( ! widget ) {
129
- return ;
130
- }
131
-
132
- if ( widget . getInput ( ) . match ( / ^ \s * @ / ) ) {
133
- widget . acceptInput ( ) ;
134
- } else {
135
- widget . acceptInputWithPrefix ( `${ chatAgentLeader } ${ secondaryAgent . name } ` ) ;
136
- }
137
- }
138
- }
139
- }
140
-
141
- export class ChatSubmitEditorAction extends EditorAction2 {
142
- static readonly ID = 'workbench.action.chat.acceptInput' ;
143
-
144
- constructor ( ) {
145
- super ( {
146
- id : ChatSubmitEditorAction . ID ,
147
- title : localize2 ( { key : 'actions.chat.submit' , comment : [ 'Apply input from the chat input box' ] } , "Submit" ) ,
148
- precondition : CONTEXT_CHAT_INPUT_HAS_TEXT ,
149
- keybinding : {
150
- when : CONTEXT_IN_CHAT_INPUT ,
151
- primary : KeyCode . Enter ,
152
- weight : KeybindingWeight . EditorContrib
153
- } ,
154
- menu : {
155
- id : MenuId . ChatExecuteSecondary ,
156
- when : CONTEXT_CHAT_REQUEST_IN_PROGRESS . negate ( ) ,
157
- group : 'group_1' ,
158
- } ,
159
- } ) ;
160
- }
161
-
162
- runEditorCommand ( accessor : ServicesAccessor , editor : ICodeEditor ) : void | Promise < void > {
163
- const editorUri = editor . getModel ( ) ?. uri ;
164
- if ( editorUri ) {
165
- const widgetService = accessor . get ( IChatWidgetService ) ;
166
- widgetService . getWidgetByInputUri ( editorUri ) ?. acceptInput ( ) ;
167
- }
168
- }
169
- }
170
-
171
95
export function registerChatActions ( ) {
172
96
registerAction2 ( OpenChatGlobalAction ) ;
173
- registerAction2 ( ChatSubmitEditorAction ) ;
174
-
175
- registerAction2 ( ChatSubmitSecondaryAgentEditorAction ) ;
176
97
177
98
registerAction2 ( class ClearChatInputHistoryAction extends Action2 {
178
99
constructor ( ) {
0 commit comments