File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed
src/vs/workbench/contrib/chat/browser/actions Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ export function registerNewChatActions() {
58
58
title : localize2 ( 'chat.newChat.label' , "New Chat" ) ,
59
59
category : CHAT_CATEGORY ,
60
60
icon : Codicon . plus ,
61
- precondition : CONTEXT_CHAT_ENABLED ,
61
+ precondition : ContextKeyExpr . and ( CONTEXT_CHAT_ENABLED , CONTEXT_CHAT_LOCATION . notEqualsTo ( ChatAgentLocation . EditingSession ) ) ,
62
62
f1 : true ,
63
63
keybinding : {
64
64
weight : KeybindingWeight . WorkbenchContrib ,
@@ -85,21 +85,15 @@ export function registerNewChatActions() {
85
85
const context = args [ 0 ] ;
86
86
const accessibilitySignalService = accessor . get ( IAccessibilitySignalService ) ;
87
87
const widgetService = accessor . get ( IChatWidgetService ) ;
88
+
89
+ let widget = widgetService . lastFocusedWidget ;
90
+
88
91
if ( isChatViewTitleActionContext ( context ) ) {
89
- const widget = widgetService . getWidgetBySessionId ( context . sessionId ) ;
90
92
// Is running in the Chat view title
91
- announceChatCleared ( accessibilitySignalService ) ;
92
- if ( widget ) {
93
- widget . clear ( ) ;
94
- widget . focusInput ( ) ;
95
- }
96
- } else {
97
- // Is running from f1 or keybinding
98
- const viewsService = accessor . get ( IViewsService ) ;
99
-
100
- const chatView = await viewsService . openView ( CHAT_VIEW_ID ) as ChatViewPane ;
101
- const widget = chatView . widget ;
93
+ widget = widgetService . getWidgetBySessionId ( context . sessionId ) ;
94
+ }
102
95
96
+ if ( widget ) {
103
97
announceChatCleared ( accessibilitySignalService ) ;
104
98
widget . clear ( ) ;
105
99
widget . focusInput ( ) ;
You can’t perform that action at this time.
0 commit comments