From dd36a6606dcd3c166a3f8566629a064293ddfebd Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 12 Dec 2024 16:51:57 -0600 Subject: [PATCH] full screen now opens in current session --- core/protocol/passThrough.ts | 1 + core/protocol/webview.ts | 1 + extensions/vscode/src/commands.ts | 11 ++++++++++- gui/src/hooks/useSetup.ts | 8 ++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index d5299614f..95ceb9885 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -73,6 +73,7 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] = "didChangeAvailableProfiles", "setTTSActive", "getWebviewHistoryLength", + "getCurrentSessionId", "signInToControlPlane", "openDialogMessage", "docs/suggestions", diff --git a/core/protocol/webview.ts b/core/protocol/webview.ts index fb6a8837c..27fd2fc38 100644 --- a/core/protocol/webview.ts +++ b/core/protocol/webview.ts @@ -24,6 +24,7 @@ export type ToWebviewFromIdeOrCoreProtocol = { ]; setTTSActive: [boolean, void]; getWebviewHistoryLength: [undefined, number]; + getCurrentSessionId: [undefined, string]; signInToControlPlane: [undefined, void]; openDialogMessage: ["account", void]; "docs/suggestions": [PackageDocsResult[], void]; diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 5f843153c..943072271 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -754,9 +754,10 @@ const getCommandsMap: ( "continue.applyCodeFromChat": () => { void sidebar.webviewProtocol.request("applyCodeFromChat", undefined); }, - "continue.toggleFullScreen": () => { + "continue.toggleFullScreen": async () => { focusGUI(); + const sessionId = await sidebar.webviewProtocol.request("getCurrentSessionId", undefined); // Check if full screen is already open by checking open tabs const fullScreenTab = getFullScreenTab(); @@ -777,6 +778,7 @@ const getCommandsMap: ( vscode.ViewColumn.One, { retainContextWhenHidden: true, + enableScripts: true, }, ); fullScreenPanel = panel; @@ -789,6 +791,13 @@ const getCommandsMap: ( undefined, true, ); + + panel.onDidChangeViewState(() => { + vscode.commands.executeCommand("continue.newSession"); + if(sessionId){ + vscode.commands.executeCommand("continue.focusContinueSessionId", sessionId); + } + }); // When panel closes, reset the webview and focus panel.onDidDispose( diff --git a/gui/src/hooks/useSetup.ts b/gui/src/hooks/useSetup.ts index 0e97965bb..2db1252ab 100644 --- a/gui/src/hooks/useSetup.ts +++ b/gui/src/hooks/useSetup.ts @@ -137,6 +137,14 @@ function useSetup() { [history], ); + useWebviewListener( + "getCurrentSessionId", + async () => { + return sessionId + }, + [sessionId], + ); + useWebviewListener("setInactive", async () => { dispatch(setInactive()); });