full screen now opens in current session

This commit is contained in:
henry 2024-12-12 16:51:57 -06:00
parent 4ba3d98e26
commit dd36a6606d
4 changed files with 20 additions and 1 deletions

View file

@ -73,6 +73,7 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] =
"didChangeAvailableProfiles",
"setTTSActive",
"getWebviewHistoryLength",
"getCurrentSessionId",
"signInToControlPlane",
"openDialogMessage",
"docs/suggestions",

View file

@ -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];

View file

@ -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(

View file

@ -137,6 +137,14 @@ function useSetup() {
[history],
);
useWebviewListener(
"getCurrentSessionId",
async () => {
return sessionId
},
[sessionId],
);
useWebviewListener("setInactive", async () => {
dispatch(setInactive());
});