Skip to content

Commit

Permalink
Merge pull request #3344 from HD787/openCurrentSession
Browse files Browse the repository at this point in the history
full screen now opens the current session
  • Loading branch information
sestinj authored Dec 13, 2024
2 parents 05796ea + dd36a66 commit 331b274
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/protocol/passThrough.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] =
"didChangeAvailableProfiles",
"setTTSActive",
"getWebviewHistoryLength",
"getCurrentSessionId",
"signInToControlPlane",
"openDialogMessage",
"docs/suggestions",
Expand Down
1 change: 1 addition & 0 deletions core/protocol/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
11 changes: 10 additions & 1 deletion extensions/vscode/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -777,6 +778,7 @@ const getCommandsMap: (
vscode.ViewColumn.One,
{
retainContextWhenHidden: true,
enableScripts: true,
},
);
fullScreenPanel = panel;
Expand All @@ -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(
Expand Down
8 changes: 8 additions & 0 deletions gui/src/hooks/useSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ function useSetup() {
[history],
);

useWebviewListener(
"getCurrentSessionId",
async () => {
return sessionId
},
[sessionId],
);

useWebviewListener("setInactive", async () => {
dispatch(setInactive());
});
Expand Down

0 comments on commit 331b274

Please sign in to comment.