✨ Full Screen Mode
This commit is contained in:
parent
9aca475cd3
commit
a1de507850
5 changed files with 80 additions and 35 deletions
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
@ -116,9 +116,9 @@
|
|||
"title": "Debug Terminal"
|
||||
},
|
||||
{
|
||||
"command": "continue.openFullScreen",
|
||||
"command": "continue.toggleFullScreen",
|
||||
"category": "Continue",
|
||||
"title": "Open Full Screen"
|
||||
"title": "Toggle Full Screen"
|
||||
},
|
||||
{
|
||||
"command": "continue.shareSession",
|
||||
|
|
@ -129,11 +129,6 @@
|
|||
"command": "continue.selectFilesAsContext",
|
||||
"category": "Continue",
|
||||
"title": "Continue: Select Files as Context"
|
||||
},
|
||||
{
|
||||
"command": "continue.updateAllReferences",
|
||||
"category": "Continue",
|
||||
"title": "Update All References"
|
||||
}
|
||||
],
|
||||
"keybindings": [
|
||||
|
|
@ -173,9 +168,9 @@
|
|||
"key": "ctrl+shift+r"
|
||||
},
|
||||
{
|
||||
"command": "continue.openFullScreen",
|
||||
"mac": "cmd+l",
|
||||
"key": "ctrl+l"
|
||||
"command": "continue.toggleFullScreen",
|
||||
"mac": "cmd+k cmd+m",
|
||||
"key": "ctrl+k ctrl+m"
|
||||
}
|
||||
],
|
||||
"submenus": [
|
||||
|
|
@ -213,10 +208,6 @@
|
|||
"command": "continue.focusContinueInputWithEdit",
|
||||
"group": "Continue",
|
||||
"when": "editorHasSelection"
|
||||
},
|
||||
{
|
||||
"command": "continue.updateAllReferences",
|
||||
"group": "Continue"
|
||||
}
|
||||
],
|
||||
"explorer/context": [
|
||||
|
|
|
|||
|
|
@ -7,10 +7,7 @@ import { acceptDiffCommand, rejectDiffCommand } from "./diffs";
|
|||
import { debugPanelWebview, getSidebarContent } from "./debugPanel";
|
||||
import { ideProtocolClient } from "./activation/activate";
|
||||
|
||||
let focusedOnContinueInput = false;
|
||||
|
||||
function addHighlightedCodeToContext(edit: boolean) {
|
||||
focusedOnContinueInput = !focusedOnContinueInput;
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
if (editor) {
|
||||
const selection = editor.selection;
|
||||
|
|
@ -41,7 +38,17 @@ function addHighlightedCodeToContext(edit: boolean) {
|
|||
}
|
||||
|
||||
async function addEntireFileToContext(filepath: vscode.Uri, edit: boolean) {
|
||||
focusedOnContinueInput = !focusedOnContinueInput;
|
||||
// If a directory, add all files in the directory
|
||||
const stat = await vscode.workspace.fs.stat(filepath);
|
||||
if (stat.type === vscode.FileType.Directory) {
|
||||
const files = await vscode.workspace.fs.readDirectory(filepath);
|
||||
for (const [filename, type] of files) {
|
||||
if (type === vscode.FileType.File) {
|
||||
addEntireFileToContext(vscode.Uri.joinPath(filepath, filename), edit);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the contents of the file
|
||||
const contents = (await vscode.workspace.fs.readFile(filepath)).toString();
|
||||
|
|
@ -67,10 +74,6 @@ async function addEntireFileToContext(filepath: vscode.Uri, edit: boolean) {
|
|||
});
|
||||
}
|
||||
|
||||
export const setFocusedOnContinueInput = (value: boolean) => {
|
||||
focusedOnContinueInput = value;
|
||||
};
|
||||
|
||||
// Copy everything over from extension.ts
|
||||
const commandsMap: { [command: string]: (...args: any) => any } = {
|
||||
"continue.acceptDiff": acceptDiffCommand,
|
||||
|
|
@ -98,7 +101,6 @@ const commandsMap: { [command: string]: (...args: any) => any } = {
|
|||
debugPanelWebview?.postMessage({
|
||||
type: "focusContinueInputWithEdit",
|
||||
});
|
||||
focusedOnContinueInput = true;
|
||||
},
|
||||
"continue.toggleAuxiliaryBar": () => {
|
||||
vscode.commands.executeCommand("workbench.action.toggleAuxiliaryBar");
|
||||
|
|
@ -185,17 +187,49 @@ const commandsMap: { [command: string]: (...args: any) => any } = {
|
|||
"continue.sendToTerminal": (text: string) => {
|
||||
ideProtocolClient.runCommand(text);
|
||||
},
|
||||
"continue.openFullScreen": () => {
|
||||
"continue.toggleFullScreen": () => {
|
||||
// Check if full screen is already open by checking open tabs
|
||||
const tabs = vscode.window.tabGroups.all.flatMap(
|
||||
(tabGroup) => tabGroup.tabs
|
||||
);
|
||||
|
||||
const fullScreenTab = tabs.find(
|
||||
(tab) => (tab.input as any).viewType?.endsWith("continue.continueGUIView")
|
||||
);
|
||||
|
||||
// Check if the active editor is the Continue GUI View
|
||||
if (fullScreenTab && fullScreenTab.isActive) {
|
||||
vscode.commands.executeCommand("workbench.action.closeActiveEditor");
|
||||
vscode.commands.executeCommand("continue.focusContinueInput");
|
||||
return;
|
||||
}
|
||||
|
||||
if (fullScreenTab) {
|
||||
// Focus the tab
|
||||
const openOptions = {
|
||||
preserveFocus: true,
|
||||
preview: fullScreenTab.isPreview,
|
||||
viewColumn: fullScreenTab.group.viewColumn,
|
||||
};
|
||||
|
||||
vscode.commands.executeCommand(
|
||||
"vscode.open",
|
||||
(fullScreenTab.input as any).uri,
|
||||
openOptions
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Close the sidebars
|
||||
vscode.commands.executeCommand("workbench.action.closeSidebar");
|
||||
// vscode.commands.executeCommand("workbench.action.closeSidebar");
|
||||
vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
|
||||
vscode.commands.executeCommand("workbench.action.toggleZenMode");
|
||||
// vscode.commands.executeCommand("workbench.action.toggleZenMode");
|
||||
const panel = vscode.window.createWebviewPanel(
|
||||
"continue.continueGUIView",
|
||||
"Continue",
|
||||
vscode.ViewColumn.One
|
||||
);
|
||||
panel.webview.html = getSidebarContent(panel);
|
||||
panel.webview.html = getSidebarContent(panel, undefined, undefined, true);
|
||||
},
|
||||
"continue.selectFilesAsContext": (
|
||||
firstUri: vscode.Uri,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import * as vscode from "vscode";
|
||||
import { getContinueServerUrl } from "./bridge";
|
||||
import { getExtensionUri, getNonce, getUniqueId } from "./util/vscode";
|
||||
import { setFocusedOnContinueInput } from "./commands";
|
||||
import { ideProtocolClient, windowId } from "./activation/activate";
|
||||
import * as io from "socket.io-client";
|
||||
import { FileEdit } from "../schema/FileEdit";
|
||||
|
|
@ -12,7 +11,8 @@ export let debugPanelWebview: vscode.Webview | undefined;
|
|||
export function getSidebarContent(
|
||||
panel: vscode.WebviewPanel | vscode.WebviewView,
|
||||
page: string | undefined = undefined,
|
||||
edits: FileEdit[] | undefined = undefined
|
||||
edits: FileEdit[] | undefined = undefined,
|
||||
isFullScreen: boolean = false
|
||||
): string {
|
||||
debugPanelWebview = panel.webview;
|
||||
panel.onDidDispose(() => {
|
||||
|
|
@ -186,12 +186,15 @@ export function getSidebarContent(
|
|||
break;
|
||||
}
|
||||
case "focusEditor": {
|
||||
setFocusedOnContinueInput(false);
|
||||
vscode.commands.executeCommand(
|
||||
"workbench.action.focusActiveEditorGroup"
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "toggleFullScreen": {
|
||||
vscode.commands.executeCommand("continue.toggleFullScreen");
|
||||
break;
|
||||
}
|
||||
case "withProgress": {
|
||||
// This message allows withProgress to be used in the webview
|
||||
if (data.done) {
|
||||
|
|
@ -255,6 +258,7 @@ export function getSidebarContent(
|
|||
(folder) => folder.uri.fsPath
|
||||
) || []
|
||||
)}</script>
|
||||
<script>window.isFullScreen = ${isFullScreen}</script>
|
||||
|
||||
${edits && `<script>window.edits = ${JSON.stringify(edits)}</script>`}
|
||||
${page && `<script>window.location.pathname = "${page}"</script>`}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import { usePostHog } from "posthog-js/react";
|
|||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { RootStore } from "../redux/store";
|
||||
import { postToIde } from "../vscode";
|
||||
import { isMetaEquivalentKeyPressed } from "../util";
|
||||
import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../util";
|
||||
import {
|
||||
setBottomMessage,
|
||||
setDialogEntryOn,
|
||||
|
|
@ -35,6 +35,8 @@ import RingLoader from "../components/RingLoader";
|
|||
import TimelineItem from "../components/TimelineItem";
|
||||
import ErrorStepContainer from "../components/ErrorStepContainer";
|
||||
import {
|
||||
ArrowsPointingInIcon,
|
||||
ArrowsPointingOutIcon,
|
||||
ChatBubbleOvalLeftIcon,
|
||||
CodeBracketSquareIcon,
|
||||
ExclamationTriangleIcon,
|
||||
|
|
@ -579,13 +581,27 @@ function GUI(props: GUIProps) {
|
|||
}}
|
||||
/>
|
||||
<div className="flex gap-2">
|
||||
{localStorage.getItem("ide") === "vscode" && (
|
||||
<HeaderButtonWithText
|
||||
onClick={() => {
|
||||
postToIde("toggleFullScreen", {});
|
||||
}}
|
||||
text={`Toggle Full Screen (${getMetaKeyLabel()}K M)`}
|
||||
>
|
||||
{(window as any).isFullScreen ? (
|
||||
<ArrowsPointingInIcon width="1.4em" height="1.4em" />
|
||||
) : (
|
||||
<ArrowsPointingOutIcon width="1.4em" height="1.4em" />
|
||||
)}
|
||||
</HeaderButtonWithText>
|
||||
)}
|
||||
<HeaderButtonWithText
|
||||
onClick={() => {
|
||||
client?.stopSession();
|
||||
client?.persistSession(sessionState, workspacePaths[0] || "");
|
||||
dispatch(newSession());
|
||||
}}
|
||||
text="New Session (⌥⌘N)"
|
||||
text={`New Session (⌥${getMetaKeyLabel()}N)`}
|
||||
>
|
||||
<PlusIcon width="1.4em" height="1.4em" />
|
||||
</HeaderButtonWithText>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue