@@ -19,7 +19,7 @@ import {
19
19
quickPickStatusText ,
20
20
setupStatusBar ,
21
21
} from "./autocomplete/statusBar" ;
22
- import { ContinueGUIWebviewViewProvider } from "./debugPanel " ;
22
+ import { ContinueGUIWebviewViewProvider } from "./ContinueGUIWebviewViewProvider " ;
23
23
import { DiffManager } from "./diff/horizontal" ;
24
24
import { VerticalPerLineDiffManager } from "./diff/verticalPerLine/manager" ;
25
25
import { QuickEdit } from "./quickEdit/QuickEdit" ;
@@ -82,7 +82,6 @@ function addCodeToContextFromRange(
82
82
}
83
83
84
84
async function addHighlightedCodeToContext (
85
- edit : boolean ,
86
85
webviewProtocol : VsCodeWebviewProtocol | undefined ,
87
86
) {
88
87
const editor = vscode . window . activeTextEditor ;
@@ -322,19 +321,42 @@ const commandsMap: (
322
321
fullScreenPanel ?. reveal ( ) ;
323
322
}
324
323
sidebar . webviewProtocol ?. request ( "focusContinueInput" , undefined ) ;
325
- await addHighlightedCodeToContext ( false , sidebar . webviewProtocol ) ;
324
+ await addHighlightedCodeToContext ( sidebar . webviewProtocol ) ;
326
325
} ,
327
326
"continue.focusContinueInputWithoutClear" : async ( ) => {
328
- if ( ! getFullScreenTab ( ) ) {
329
- vscode . commands . executeCommand ( "continue.continueGUIView.focus" ) ;
330
- }
331
- sidebar . webviewProtocol ?. request (
332
- "focusContinueInputWithoutClear" ,
327
+ const fullScreenTab = getFullScreenTab ( ) ;
328
+
329
+ const isContinueInputFocused = await sidebar . webviewProtocol . request (
330
+ "isContinueInputFocused" ,
333
331
undefined ,
334
332
) ;
335
- await addHighlightedCodeToContext ( true , sidebar . webviewProtocol ) ;
333
+
334
+ if ( isContinueInputFocused ) {
335
+ // Handle closing the GUI only if we are focused on the input
336
+ if ( fullScreenTab ) {
337
+ fullScreenPanel ?. dispose ( ) ;
338
+ } else {
339
+ vscode . commands . executeCommand ( "workbench.action.closeAuxiliaryBar" ) ;
340
+ }
341
+ } else {
342
+ // Handle opening the GUI otherwise
343
+ if ( ! fullScreenTab ) {
344
+ // focus sidebar
345
+ vscode . commands . executeCommand ( "continue.continueGUIView.focus" ) ;
346
+ } else {
347
+ // focus fullscreen
348
+ fullScreenPanel ?. reveal ( ) ;
349
+ }
350
+
351
+ sidebar . webviewProtocol ?. request (
352
+ "focusContinueInputWithoutClear" ,
353
+ undefined ,
354
+ ) ;
355
+
356
+ await addHighlightedCodeToContext ( sidebar . webviewProtocol ) ;
357
+ }
336
358
} ,
337
- "continue.quickEdit" : ( injectedPrompt ?: string ) => {
359
+ "continue.quickEdit" : async ( injectedPrompt ?: string ) => {
338
360
captureCommandTelemetry ( "quickEdit" ) ;
339
361
quickEdit . run ( injectedPrompt ) ;
340
362
} ,
0 commit comments