@@ -156,7 +156,40 @@ registerActiveXtermAction({
156
156
ContextKeyExpr . or ( TerminalContextKeys . processSupported , TerminalContextKeys . terminalHasBeenCreated ) ,
157
157
TerminalChatContextKeys . requestActive . negate ( ) ,
158
158
TerminalChatContextKeys . agentRegistered ,
159
- TerminalChatContextKeys . responseContainsCodeBlock
159
+ TerminalChatContextKeys . responseContainsCodeBlock ,
160
+ TerminalChatContextKeys . responseContainsMultipleCodeBlocks . negate ( )
161
+ ) ,
162
+ icon : Codicon . play ,
163
+ keybinding : {
164
+ when : TerminalChatContextKeys . requestActive . negate ( ) ,
165
+ weight : KeybindingWeight . WorkbenchContrib ,
166
+ primary : KeyMod . CtrlCmd | KeyCode . Enter ,
167
+ } ,
168
+ menu : {
169
+ id : MENU_TERMINAL_CHAT_WIDGET_STATUS ,
170
+ group : '0_main' ,
171
+ order : 0 ,
172
+ when : ContextKeyExpr . and ( TerminalChatContextKeys . responseContainsCodeBlock , TerminalChatContextKeys . responseContainsMultipleCodeBlocks . negate ( ) , TerminalChatContextKeys . requestActive . negate ( ) )
173
+ } ,
174
+ run : ( _xterm , _accessor , activeInstance ) => {
175
+ if ( isDetachedTerminalInstance ( activeInstance ) ) {
176
+ return ;
177
+ }
178
+ const contr = TerminalChatController . activeChatWidget || TerminalChatController . get ( activeInstance ) ;
179
+ contr ?. acceptCommand ( true ) ;
180
+ }
181
+ } ) ;
182
+
183
+ registerActiveXtermAction ( {
184
+ id : TerminalChatCommandId . RunFirstCommand ,
185
+ title : localize2 ( 'runFirstCommand' , 'Run First Chat Command' ) ,
186
+ shortTitle : localize2 ( 'runFirst' , 'Run First' ) ,
187
+ precondition : ContextKeyExpr . and (
188
+ ContextKeyExpr . has ( `config.${ TerminalSettingId . ExperimentalInlineChat } ` ) ,
189
+ ContextKeyExpr . or ( TerminalContextKeys . processSupported , TerminalContextKeys . terminalHasBeenCreated ) ,
190
+ TerminalChatContextKeys . requestActive . negate ( ) ,
191
+ TerminalChatContextKeys . agentRegistered ,
192
+ TerminalChatContextKeys . responseContainsMultipleCodeBlocks
160
193
) ,
161
194
icon : Codicon . play ,
162
195
keybinding : {
@@ -168,7 +201,7 @@ registerActiveXtermAction({
168
201
id : MENU_TERMINAL_CHAT_WIDGET_STATUS ,
169
202
group : '0_main' ,
170
203
order : 0 ,
171
- when : ContextKeyExpr . and ( TerminalChatContextKeys . responseContainsCodeBlock , TerminalChatContextKeys . requestActive . negate ( ) )
204
+ when : ContextKeyExpr . and ( TerminalChatContextKeys . responseContainsMultipleCodeBlocks , TerminalChatContextKeys . requestActive . negate ( ) )
172
205
} ,
173
206
run : ( _xterm , _accessor , activeInstance ) => {
174
207
if ( isDetachedTerminalInstance ( activeInstance ) ) {
@@ -188,7 +221,39 @@ registerActiveXtermAction({
188
221
ContextKeyExpr . or ( TerminalContextKeys . processSupported , TerminalContextKeys . terminalHasBeenCreated ) ,
189
222
TerminalChatContextKeys . requestActive . negate ( ) ,
190
223
TerminalChatContextKeys . agentRegistered ,
191
- TerminalChatContextKeys . responseContainsCodeBlock
224
+ TerminalChatContextKeys . responseContainsCodeBlock ,
225
+ TerminalChatContextKeys . responseContainsMultipleCodeBlocks . negate ( )
226
+ ) ,
227
+ keybinding : {
228
+ when : TerminalChatContextKeys . requestActive . negate ( ) ,
229
+ weight : KeybindingWeight . WorkbenchContrib ,
230
+ primary : KeyMod . Alt | KeyCode . Enter ,
231
+ } ,
232
+ menu : {
233
+ id : MENU_TERMINAL_CHAT_WIDGET_STATUS ,
234
+ group : '0_main' ,
235
+ order : 1 ,
236
+ when : ContextKeyExpr . and ( TerminalChatContextKeys . responseContainsCodeBlock , TerminalChatContextKeys . responseContainsMultipleCodeBlocks . negate ( ) , TerminalChatContextKeys . requestActive . negate ( ) )
237
+ } ,
238
+ run : ( _xterm , _accessor , activeInstance ) => {
239
+ if ( isDetachedTerminalInstance ( activeInstance ) ) {
240
+ return ;
241
+ }
242
+ const contr = TerminalChatController . activeChatWidget || TerminalChatController . get ( activeInstance ) ;
243
+ contr ?. acceptCommand ( false ) ;
244
+ }
245
+ } ) ;
246
+
247
+ registerActiveXtermAction ( {
248
+ id : TerminalChatCommandId . InsertFirstCommand ,
249
+ title : localize2 ( 'insertFirstCommand' , 'Insert First Chat Command' ) ,
250
+ shortTitle : localize2 ( 'insertFirst' , 'Insert First' ) ,
251
+ precondition : ContextKeyExpr . and (
252
+ ContextKeyExpr . has ( `config.${ TerminalSettingId . ExperimentalInlineChat } ` ) ,
253
+ ContextKeyExpr . or ( TerminalContextKeys . processSupported , TerminalContextKeys . terminalHasBeenCreated ) ,
254
+ TerminalChatContextKeys . requestActive . negate ( ) ,
255
+ TerminalChatContextKeys . agentRegistered ,
256
+ TerminalChatContextKeys . responseContainsMultipleCodeBlocks
192
257
) ,
193
258
keybinding : {
194
259
when : TerminalChatContextKeys . requestActive . negate ( ) ,
@@ -199,7 +264,7 @@ registerActiveXtermAction({
199
264
id : MENU_TERMINAL_CHAT_WIDGET_STATUS ,
200
265
group : '0_main' ,
201
266
order : 1 ,
202
- when : ContextKeyExpr . and ( TerminalChatContextKeys . responseContainsCodeBlock , TerminalChatContextKeys . requestActive . negate ( ) )
267
+ when : ContextKeyExpr . and ( TerminalChatContextKeys . responseContainsMultipleCodeBlocks , TerminalChatContextKeys . requestActive . negate ( ) )
203
268
} ,
204
269
run : ( _xterm , _accessor , activeInstance ) => {
205
270
if ( isDetachedTerminalInstance ( activeInstance ) ) {
0 commit comments