File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
src/vs/workbench/contrib/chat/browser/actions Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -157,19 +157,26 @@ export class CancelAction extends Action2 {
157
157
id : MenuId . ChatExecute ,
158
158
when : CONTEXT_CHAT_REQUEST_IN_PROGRESS ,
159
159
group : 'navigation' ,
160
+ } ,
161
+ keybinding : {
162
+ weight : KeybindingWeight . WorkbenchContrib ,
163
+ primary : KeyMod . CtrlCmd | KeyCode . Escape ,
160
164
}
161
165
} ) ;
162
166
}
163
167
164
168
run ( accessor : ServicesAccessor , ...args : any [ ] ) {
165
- const context : IChatExecuteActionContext = args [ 0 ] ;
166
- if ( ! context . widget ) {
169
+ const context : IChatExecuteActionContext | undefined = args [ 0 ] ;
170
+
171
+ const widgetService = accessor . get ( IChatWidgetService ) ;
172
+ const widget = context ?. widget ?? widgetService . lastFocusedWidget ;
173
+ if ( ! widget ) {
167
174
return ;
168
175
}
169
176
170
177
const chatService = accessor . get ( IChatService ) ;
171
- if ( context . widget . viewModel ) {
172
- chatService . cancelCurrentRequestForSession ( context . widget . viewModel . sessionId ) ;
178
+ if ( widget . viewModel ) {
179
+ chatService . cancelCurrentRequestForSession ( widget . viewModel . sessionId ) ;
173
180
}
174
181
}
175
182
}
You can’t perform that action at this time.
0 commit comments