✨ full-screen, zen mode window

This commit is contained in:
Nate Sesti 2023-11-04 01:33:03 -07:00
parent ef6273371a
commit 9ee5ca6f48
9 changed files with 197 additions and 171 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -109,6 +109,11 @@
"command": "continue.debugTerminal",
"category": "Continue",
"title": "Debug Terminal"
},
{
"command": "continue.openFullScreen",
"category": "Continue",
"title": "Open Full Screen"
}
],
"keybindings": [
@ -146,6 +151,11 @@
"command": "continue.debugTerminal",
"mac": "cmd+shift+r",
"key": "ctrl+shift+r"
},
{
"command": "continue.openFullScreen",
"mac": "cmd+l",
"key": "ctrl+l"
}
],
"menus": {

View file

@ -1,7 +1,10 @@
import * as vscode from "vscode";
import IdeProtocolClient from "../continueIdeClient";
import { getContinueServerUrl } from "../bridge";
import { ContinueGUIWebviewViewProvider } from "../debugPanel";
import {
ContinueGUIWebviewViewProvider,
getSidebarContent,
} from "../debugPanel";
import {
getExtensionVersion,
startContinuePythonServer,

View file

@ -4,7 +4,7 @@ import * as os from "os";
import * as fs from "fs";
import { acceptDiffCommand, rejectDiffCommand } from "./diffs";
import { debugPanelWebview } from "./debugPanel";
import { debugPanelWebview, getSidebarContent } from "./debugPanel";
import { ideProtocolClient } from "./activation/activate";
let focusedOnContinueInput = false;
@ -155,6 +155,18 @@ const commandsMap: { [command: string]: (...args: any) => any } = {
"continue.sendToTerminal": (text: string) => {
ideProtocolClient.runCommand(text);
},
"continue.openFullScreen": () => {
// Close the sidebars
vscode.commands.executeCommand("workbench.action.closeSidebar");
vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
vscode.commands.executeCommand("workbench.action.toggleZenMode");
const panel = vscode.window.createWebviewPanel(
"continue.continueGUIView",
"Continue",
vscode.ViewColumn.One
);
panel.webview.html = getSidebarContent(panel);
},
};
export function registerAllCommands(context: vscode.ExtensionContext) {

View file

@ -1,12 +1,6 @@
import * as vscode from "vscode";
import { getContinueServerUrl } from "./bridge";
import {
getExtensionUri,
getNonce,
getUniqueId,
openEditorAndRevealRange,
} from "./util/vscode";
import { RangeInFileWithContents } from "../schema/RangeInFileWithContents";
import { getExtensionUri, getNonce, getUniqueId } from "./util/vscode";
import { setFocusedOnContinueInput } from "./commands";
import { ideProtocolClient, windowId } from "./activation/activate";
import * as io from "socket.io-client";
@ -14,7 +8,7 @@ import * as io from "socket.io-client";
let sockets: { [url: string]: io.Socket | undefined } = {};
export let debugPanelWebview: vscode.Webview | undefined;
export function setupDebugPanel(
export function getSidebarContent(
panel: vscode.WebviewPanel | vscode.WebviewView
): string {
debugPanelWebview = panel.webview;
@ -257,6 +251,6 @@ export class ContinueGUIWebviewViewProvider
_context: vscode.WebviewViewResolveContext,
_token: vscode.CancellationToken
): void | Thenable<void> {
webviewView.webview.html = setupDebugPanel(webviewView);
webviewView.webview.html = getSidebarContent(webviewView);
}
}

View file

@ -664,171 +664,178 @@ function GUI(props: GUIProps) {
)}
<br />
<StepsDiv>
{sessionState?.history?.map((step: StepDescription, index: number) => {
if (step.hide) return null;
<div className="max-w-3xl mx-auto">
<StepsDiv>
{sessionState?.history?.map(
(step: StepDescription, index: number) => {
if (step.hide) return null;
return (
<Fragment key={index}>
<ErrorBoundary
FallbackComponent={fallbackRender}
onReset={() => {
client?.stopSession();
dispatch(newSession());
}}
>
{step.name === "User Input" ? (
step.hide || (
<ComboBox
isMainInput={false}
value={step.description as string}
active={active && isLastUserInput(index)}
onEnter={(e, value) => {
if (value) {
client?.stopSession();
const newHistory = [
...sessionState.history.slice(0, index),
{
name: "User Input",
description: value,
observations: [],
logs: [],
step_type: "UserInputStep",
params: { user_input: value },
hide: false,
depth: 0,
},
];
dispatch(setHistory(newHistory));
dispatch(setActive(true));
const state = {
history: newHistory,
context_items: sessionState.context_items,
};
console.log("State: ", state);
client.runFromState(state);
}
e?.stopPropagation();
e?.preventDefault();
}}
groupIndices={getStepsInUserInputGroup(index)}
onToggle={(isOpen: boolean) => {
// Collapse all steps in the section
setStepsOpen((prev) => {
const nextStepsOpen = [...prev];
getStepsInUserInputGroup(index).forEach((i) => {
nextStepsOpen[i] = isOpen;
});
return nextStepsOpen;
});
}}
onToggleAll={(isOpen: boolean) => {
// Collapse _all_ steps
setStepsOpen((prev) => {
return prev.map((_) => isOpen);
});
}}
isToggleOpen={
typeof stepsOpen[index] === "undefined"
? true
: stepsOpen[index]!
}
index={index}
onDelete={() => {
// Delete the input and all steps until the next user input
getStepsInUserInputGroup(index).forEach((i) => {
console.log(i);
dispatch(deleteAtIndex(i));
});
}}
/>
)
) : (
<TimelineItem
historyNode={step}
iconElement={
step.step_type === "DefaultModelEditCodeStep" ? (
<CodeBracketSquareIcon width="16px" height="16px" />
) : step.error ? (
<ExclamationTriangleIcon
width="16px"
height="16px"
color="red"
/>
) : (
<ChatBubbleOvalLeftIcon width="16px" height="16px" />
)
}
open={
typeof stepsOpen[index] === "undefined"
? step.error
? false
: true
: stepsOpen[index]!
}
onToggle={() => onToggleAtIndex(index)}
return (
<Fragment key={index}>
<ErrorBoundary
FallbackComponent={fallbackRender}
onReset={() => {
client?.stopSession();
dispatch(newSession());
}}
>
{step.error ? (
<ErrorStepContainer
onClose={() => onToggleAtIndex(index)}
error={step.error}
onDelete={() => {
dispatch(deleteAtIndex(index));
}}
/>
{step.name === "User Input" ? (
step.hide || (
<ComboBox
isMainInput={false}
value={step.description as string}
active={active && isLastUserInput(index)}
onEnter={(e, value) => {
if (value) {
client?.stopSession();
const newHistory = [
...sessionState.history.slice(0, index),
{
name: "User Input",
description: value,
observations: [],
logs: [],
step_type: "UserInputStep",
params: { user_input: value },
hide: false,
depth: 0,
},
];
dispatch(setHistory(newHistory));
dispatch(setActive(true));
const state = {
history: newHistory,
context_items: sessionState.context_items,
};
console.log("State: ", state);
client.runFromState(state);
}
e?.stopPropagation();
e?.preventDefault();
}}
groupIndices={getStepsInUserInputGroup(index)}
onToggle={(isOpen: boolean) => {
// Collapse all steps in the section
setStepsOpen((prev) => {
const nextStepsOpen = [...prev];
getStepsInUserInputGroup(index).forEach((i) => {
nextStepsOpen[i] = isOpen;
});
return nextStepsOpen;
});
}}
onToggleAll={(isOpen: boolean) => {
// Collapse _all_ steps
setStepsOpen((prev) => {
return prev.map((_) => isOpen);
});
}}
isToggleOpen={
typeof stepsOpen[index] === "undefined"
? true
: stepsOpen[index]!
}
index={index}
onDelete={() => {
// Delete the input and all steps until the next user input
getStepsInUserInputGroup(index).forEach((i) => {
console.log(i);
dispatch(deleteAtIndex(i));
});
}}
/>
)
) : (
<StepContainer
index={index}
isLast={index === sessionState.history.length - 1}
isFirst={index === 0}
<TimelineItem
historyNode={step}
iconElement={
step.step_type === "DefaultModelEditCodeStep" ? (
<CodeBracketSquareIcon width="16px" height="16px" />
) : step.error ? (
<ExclamationTriangleIcon
width="16px"
height="16px"
color="red"
/>
) : (
<ChatBubbleOvalLeftIcon
width="16px"
height="16px"
/>
)
}
open={
typeof stepsOpen[index] === "undefined"
? true
? step.error
? false
: true
: stepsOpen[index]!
}
key={index}
onUserInput={(input: string) => {
onStepUserInput(input, index);
}}
step={step}
onReverse={() => {
client?.reverseToIndex(index);
}}
onRetry={() => {
client?.retryAtIndex(index);
setWaitingForSteps(true);
}}
onDelete={() => {
dispatch(deleteAtIndex(index));
}}
noUserInputParent={
getStepsInUserInputGroup(index).length === 0
}
/>
onToggle={() => onToggleAtIndex(index)}
>
{step.error ? (
<ErrorStepContainer
onClose={() => onToggleAtIndex(index)}
error={step.error}
onDelete={() => {
dispatch(deleteAtIndex(index));
}}
/>
) : (
<StepContainer
index={index}
isLast={index === sessionState.history.length - 1}
isFirst={index === 0}
open={
typeof stepsOpen[index] === "undefined"
? true
: stepsOpen[index]!
}
key={index}
onUserInput={(input: string) => {
onStepUserInput(input, index);
}}
step={step}
onReverse={() => {
client?.reverseToIndex(index);
}}
onRetry={() => {
client?.retryAtIndex(index);
setWaitingForSteps(true);
}}
onDelete={() => {
dispatch(deleteAtIndex(index));
}}
noUserInputParent={
getStepsInUserInputGroup(index).length === 0
}
/>
)}
</TimelineItem>
)}
</TimelineItem>
)}
{/* <div className="h-2"></div> */}
</ErrorBoundary>
</Fragment>
);
})}
</StepsDiv>
{/* <div className="h-2"></div> */}
</ErrorBoundary>
</Fragment>
);
}
)}
</StepsDiv>
<div ref={aboveComboBoxDivRef} />
<ComboBox
isMainInput={true}
ref={mainTextInputRef}
onEnter={(e, _) => {
onMainTextInput(e);
e?.stopPropagation();
e?.preventDefault();
}}
onInputValueChange={() => {}}
onToggleAddContext={() => {
client?.toggleAddingHighlightedCode();
}}
/>
<div ref={aboveComboBoxDivRef} />
<ComboBox
isMainInput={true}
ref={mainTextInputRef}
onEnter={(e, _) => {
onMainTextInput(e);
e?.stopPropagation();
e?.preventDefault();
}}
onInputValueChange={() => {}}
onToggleAddContext={() => {
client?.toggleAddingHighlightedCode();
}}
/>
</div>
</TopGuiDiv>
);
}