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() {
5858 title : localize2 ( 'chat.newChat.label' , "New Chat" ) ,
5959 category : CHAT_CATEGORY ,
6060 icon : Codicon . plus ,
61- precondition : CONTEXT_CHAT_ENABLED ,
61+ precondition : ContextKeyExpr . and ( CONTEXT_CHAT_ENABLED , CONTEXT_CHAT_LOCATION . notEqualsTo ( ChatAgentLocation . EditingSession ) ) ,
6262 f1 : true ,
6363 keybinding : {
6464 weight : KeybindingWeight . WorkbenchContrib ,
@@ -85,21 +85,15 @@ export function registerNewChatActions() {
8585 const context = args [ 0 ] ;
8686 const accessibilitySignalService = accessor . get ( IAccessibilitySignalService ) ;
8787 const widgetService = accessor . get ( IChatWidgetService ) ;
88+
89+ let widget = widgetService . lastFocusedWidget ;
90+
8891 if ( isChatViewTitleActionContext ( context ) ) {
89- const widget = widgetService . getWidgetBySessionId ( context . sessionId ) ;
9092 // 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+ }
10295
96+ if ( widget ) {
10397 announceChatCleared ( accessibilitySignalService ) ;
10498 widget . clear ( ) ;
10599 widget . focusInput ( ) ;
You can’t perform that action at this time.
0 commit comments