Skip to content

Commit

Permalink
Merge branch 'preview'
Browse files Browse the repository at this point in the history
  • Loading branch information
sestinj committed Nov 10, 2023
2 parents 0aba228 + 2ee9155 commit 006d310
Show file tree
Hide file tree
Showing 32 changed files with 840 additions and 104 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ jobs:
with:
python-version: "3.11"

- name: Install Pyinstaller
- name: Install dependencies
run: |
pip install pyinstaller
python -m pip install --upgrade pip
pip install poetry
- name: Install Dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions extensions/vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "continue",
"icon": "media/icon.png",
"version": "0.5.1",
"version": "0.5.3",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"
Expand Down Expand Up @@ -115,6 +115,11 @@
"category": "Continue",
"title": "Debug Terminal"
},
{
"command": "continue.toggleFullScreen",
"category": "Continue",
"title": "Toggle Full Screen"
},
{
"command": "continue.shareSession",
"category": "Continue",
Expand Down Expand Up @@ -161,6 +166,11 @@
"command": "continue.debugTerminal",
"mac": "cmd+shift+r",
"key": "ctrl+shift+r"
},
{
"command": "continue.toggleFullScreen",
"mac": "cmd+k cmd+m",
"key": "ctrl+k ctrl+m"
}
],
"submenus": [
Expand All @@ -185,8 +195,7 @@
"editor/context": [
{
"submenu": "continue.continueSubMenu",
"group": "1_debug@1",
"when": "editorHasSelection"
"group": "1_debug@1"
}
],
"continue.continueSubMenu": [
Expand Down
5 changes: 4 additions & 1 deletion extensions/vscode/src/activation/activate.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
77 changes: 67 additions & 10 deletions extensions/vscode/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ 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;

function addHighlightedCodeToContext(edit: boolean) {
focusedOnContinueInput = !focusedOnContinueInput;
const editor = vscode.window.activeTextEditor;
if (editor) {
const selection = editor.selection;
Expand Down Expand Up @@ -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();
Expand All @@ -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,
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -185,6 +187,50 @@ const commandsMap: { [command: string]: (...args: any) => any } = {
"continue.sendToTerminal": (text: string) => {
ideProtocolClient.runCommand(text);
},
"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.closeAuxiliaryBar");
// vscode.commands.executeCommand("workbench.action.toggleZenMode");
const panel = vscode.window.createWebviewPanel(
"continue.continueGUIView",
"Continue",
vscode.ViewColumn.One
);
panel.webview.html = getSidebarContent(panel, undefined, undefined, true);
},
"continue.selectFilesAsContext": (
firstUri: vscode.Uri,
uris: vscode.Uri[]
Expand All @@ -195,6 +241,17 @@ const commandsMap: { [command: string]: (...args: any) => any } = {
addEntireFileToContext(uri, false);
}
},
"continue.updateAllReferences": (filepath: vscode.Uri) => {
// Get the cursor position in the editor
const editor = vscode.window.activeTextEditor;
if (!editor) {
return;
}
const position = editor.selection.active;
ideProtocolClient.sendMainUserInput(
`/references ${filepath.fsPath} ${position.line} ${position.character}`
);
},
};

export function registerAllCommands(context: vscode.ExtensionContext) {
Expand Down
Loading

0 comments on commit 006d310

Please sign in to comment.