Skip to content

Commit ead28c7

Browse files
feat: add back fullscreen cmd (#7955)
1 parent c7e833d commit ead28c7

File tree

3 files changed

+120
-6
lines changed

3 files changed

+120
-6
lines changed

extensions/vscode/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,12 @@
373373
"category": "Continue",
374374
"title": "Generate Rule",
375375
"group": "Continue"
376+
},
377+
{
378+
"command": "continue.openInNewWindow",
379+
"category": "Continue",
380+
"title": "Open in new window",
381+
"group": "Continue"
376382
}
377383
],
378384
"keybindings": [
@@ -443,6 +449,12 @@
443449
"mac": "cmd+shift+r",
444450
"key": "ctrl+shift+r"
445451
},
452+
{
453+
"command": "continue.openInNewWindow",
454+
"mac": "cmd+k cmd+m",
455+
"key": "ctrl+k ctrl+m",
456+
"when": "!terminalFocus"
457+
},
446458
{
447459
"command": "continue.toggleTabAutocompleteEnabled",
448460
"mac": "cmd+k cmd+a",
@@ -512,6 +524,9 @@
512524
},
513525
{
514526
"command": "continue.generateRule"
527+
},
528+
{
529+
"command": "continue.openInNewWindow"
515530
}
516531
],
517532
"editor/context": [

extensions/vscode/src/commands.ts

Lines changed: 102 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ import { getMetaKeyLabel } from "./util/util";
4646
import { openEditorAndRevealRange } from "./util/vscode";
4747
import { VsCodeIde } from "./VsCodeIde";
4848

49+
let fullScreenPanel: vscode.WebviewPanel | undefined;
50+
51+
function getFullScreenTab() {
52+
const tabs = vscode.window.tabGroups.all.flatMap((tabGroup) => tabGroup.tabs);
53+
return tabs.find((tab) =>
54+
(tab.input as any)?.viewType?.endsWith("continue.continueGUIView"),
55+
);
56+
}
57+
4958
type TelemetryCaptureParams = Parameters<typeof Telemetry.capture>;
5059

5160
/**
@@ -59,15 +68,27 @@ function captureCommandTelemetry(
5968
}
6069

6170
function focusGUI() {
62-
// focus sidebar
63-
vscode.commands.executeCommand("continue.continueGUIView.focus");
64-
// vscode.commands.executeCommand("workbench.action.focusAuxiliaryBar");
71+
const fullScreenTab = getFullScreenTab();
72+
if (fullScreenTab) {
73+
// focus fullscreen
74+
fullScreenPanel?.reveal();
75+
} else {
76+
// focus sidebar
77+
vscode.commands.executeCommand("continue.continueGUIView.focus");
78+
// vscode.commands.executeCommand("workbench.action.focusAuxiliaryBar");
79+
}
6580
}
6681

6782
function hideGUI() {
68-
// focus sidebar
69-
vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
70-
// vscode.commands.executeCommand("workbench.action.toggleAuxiliaryBar");
83+
const fullScreenTab = getFullScreenTab();
84+
if (fullScreenTab) {
85+
// focus fullscreen
86+
fullScreenPanel?.dispose();
87+
} else {
88+
// focus sidebar
89+
vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
90+
// vscode.commands.executeCommand("workbench.action.toggleAuxiliaryBar");
91+
}
7192
}
7293

7394
function waitForSidebarReady(
@@ -602,6 +623,11 @@ const getCommandsMap: (
602623
label: "$(comment) Open chat",
603624
description: getMetaKeyLabel() + " + L",
604625
},
626+
{
627+
label: "$(screen-full) Open full screen chat",
628+
description:
629+
getMetaKeyLabel() + " + K, " + getMetaKeyLabel() + " + M",
630+
},
605631
{
606632
label: quickPickStatusText(targetStatus),
607633
description:
@@ -644,6 +670,8 @@ const getCommandsMap: (
644670
}
645671
} else if (selectedOption === "$(comment) Open chat") {
646672
vscode.commands.executeCommand("continue.focusContinueInput");
673+
} else if (selectedOption === "$(screen-full) Open full screen chat") {
674+
vscode.commands.executeCommand("continue.openInNewWindow");
647675
} else if (selectedOption === "$(gear) Open settings") {
648676
vscode.commands.executeCommand("continue.navigateTo", "/config");
649677
}
@@ -770,6 +798,74 @@ const getCommandsMap: (
770798
vscode.ConfigurationTarget.Global,
771799
);
772800
},
801+
"continue.openInNewWindow": async () => {
802+
focusGUI();
803+
804+
const sessionId = await sidebar.webviewProtocol.request(
805+
"getCurrentSessionId",
806+
undefined,
807+
);
808+
// Check if full screen is already open by checking open tabs
809+
const fullScreenTab = getFullScreenTab();
810+
811+
if (fullScreenTab && fullScreenPanel) {
812+
// Full screen open, but not focused - focus it
813+
fullScreenPanel.reveal();
814+
return;
815+
}
816+
817+
// Clear the sidebar to prevent overwriting changes made in fullscreen
818+
vscode.commands.executeCommand("continue.newSession");
819+
820+
// Full screen not open - open it
821+
captureCommandTelemetry("openInNewWindow");
822+
823+
// Create the full screen panel
824+
let panel = vscode.window.createWebviewPanel(
825+
"continue.continueGUIView",
826+
"Continue",
827+
vscode.ViewColumn.One,
828+
{
829+
retainContextWhenHidden: true,
830+
enableScripts: true,
831+
},
832+
);
833+
fullScreenPanel = panel;
834+
835+
// Add content to the panel
836+
panel.webview.html = sidebar.getSidebarContent(
837+
extensionContext,
838+
panel,
839+
undefined,
840+
undefined,
841+
true,
842+
);
843+
844+
const sessionLoader = panel.onDidChangeViewState(() => {
845+
vscode.commands.executeCommand("continue.newSession");
846+
if (sessionId) {
847+
vscode.commands.executeCommand(
848+
"continue.focusContinueSessionId",
849+
sessionId,
850+
);
851+
}
852+
panel.reveal();
853+
sessionLoader.dispose();
854+
});
855+
856+
// When panel closes, reset the webview and focus
857+
panel.onDidDispose(
858+
() => {
859+
sidebar.resetWebviewProtocolWebview();
860+
vscode.commands.executeCommand("continue.focusContinueInput");
861+
},
862+
null,
863+
extensionContext.subscriptions,
864+
);
865+
866+
vscode.commands.executeCommand("workbench.action.copyEditorToNewWindow");
867+
vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
868+
},
773869
"continue.forceNextEdit": async () => {
774870
captureCommandTelemetry("forceNextEdit");
775871

extensions/vscode/src/extension/VsCodeMessenger.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ export class VsCodeMessenger {
113113
this.onWebview("focusEditor", (msg) => {
114114
vscode.commands.executeCommand("workbench.action.focusActiveEditorGroup");
115115
});
116+
this.onWebview("toggleFullScreen", (msg) => {
117+
vscode.commands.executeCommand("continue.openInNewWindow");
118+
});
116119

117120
this.onWebview("acceptDiff", async ({ data: { filepath, streamId } }) => {
118121
await vscode.commands.executeCommand(

0 commit comments

Comments
 (0)