Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Footer #2978

Merged
merged 15 commits into from
Nov 21, 2024
13 changes: 13 additions & 0 deletions core/config/ConfigHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from "../index.js";
import Ollama from "../llm/llms/Ollama.js";
import { GlobalContext } from "../util/GlobalContext.js";
import { getConfigJsonPath } from "../util/paths.js";

import { ConfigResult } from "./load.js";
import {
Expand Down Expand Up @@ -84,6 +85,18 @@ export class ConfigHandler {
return this.profiles.filter((p) => p.profileId !== this.selectedProfileId);
}

async openConfigProfile(profileId?: string) {
let openProfileId = profileId || this.selectedProfileId;
if (openProfileId === "local") {
await this.ide.openFile(getConfigJsonPath());
} else {
await this.ide.openUrl(
"https://app.continue.dev/",
// `https://app.continue.dev/workspaces/${openProfileId}/chat`,
);
}
}

private async fetchControlPlaneProfiles() {
// Get the profiles and create their lifecycle managers
this.controlPlaneClient
Expand Down
10 changes: 9 additions & 1 deletion core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ import { DevDataSqliteDb } from "./util/devdataSqlite";
import { fetchwithRequestOptions } from "./util/fetchWithOptions";
import { GlobalContext } from "./util/GlobalContext";
import historyManager from "./util/history";
import { editConfigJson, setupInitialDotContinueDirectory } from "./util/paths";
import {
editConfigJson,
getConfigJsonPath,
setupInitialDotContinueDirectory,
} from "./util/paths";
import { Telemetry } from "./util/posthog";
import { getSymbolsForManyFiles } from "./util/treeSitter";
import { TTS } from "./util/tts";
Expand Down Expand Up @@ -264,6 +268,10 @@ export class Core {
await this.configHandler.reloadConfig();
});

on("config/openProfile", async (msg) => {
await this.configHandler.openConfigProfile(msg.data.profileId);
});

on("config/reload", (msg) => {
void this.configHandler.reloadConfig();
return this.configHandler.getSerializedConfig();
Expand Down
1 change: 1 addition & 0 deletions core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ export interface IDE {
showVirtualFile(title: string, contents: string): Promise<void>;
getContinueDir(): Promise<string>;
openFile(path: string): Promise<void>;
openUrl(url: string): Promise<void>;
runCommand(command: string): Promise<void>;
saveFile(filepath: string): Promise<void>;
readFile(filepath: string): Promise<string>;
Expand Down
1 change: 1 addition & 0 deletions core/protocol/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
"config/deleteModel": [{ title: string }, void];
"config/reload": [undefined, BrowserSerializedContinueConfig];
"config/listProfiles": [undefined, ProfileDescription[]];
"config/openProfile": [{ profileId: string | undefined }, void];
"context/getContextItems": [
{
name: string;
Expand Down
17 changes: 12 additions & 5 deletions core/protocol/ide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type ToIdeFromWebviewOrCoreProtocol = {
showVirtualFile: [{ name: string; content: string }, void];
getContinueDir: [undefined, string];
openFile: [{ path: string }, void];
openUrl: [string, void];
runCommand: [{ command: string }, void];
getSearchResults: [{ query: string }, string];
subprocess: [{ command: string; cwd?: string }, [string, string]];
Expand All @@ -49,11 +50,17 @@ export type ToIdeFromWebviewOrCoreProtocol = {
];
getProblems: [{ filepath: string }, Problem[]];
getOpenFiles: [undefined, string[]];
getCurrentFile: [undefined, undefined | {
isUntitled: boolean;
path: string;
contents: string;
}];
getCurrentFile: [
undefined,
(
| undefined
| {
isUntitled: boolean;
path: string;
contents: string;
}
),
];
getPinnedFiles: [undefined, string[]];
showLines: [{ filepath: string; startLine: number; endLine: number }, void];
readRangeInFile: [{ filepath: string; range: Range }, string];
Expand Down
2 changes: 0 additions & 2 deletions core/protocol/ideWebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & {
overwriteFile: [{ filepath: string; prevFileContent: string | null }, void];
showTutorial: [undefined, void];
showFile: [{ filepath: string }, void];
openConfigJson: [undefined, void];
toggleDevTools: [undefined, void];
reloadWindow: [undefined, void];
focusEditor: [undefined, void];
Expand Down Expand Up @@ -101,7 +100,6 @@ export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & {
navigateTo: [{ path: string; toggle?: boolean }, void];
addModel: [undefined, void];

openSettings: [undefined, void];
/**
* @deprecated Use navigateTo with a path instead.
*/
Expand Down
5 changes: 4 additions & 1 deletion core/protocol/passThrough.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] =
"config/getSerializedProfileInfo",
"config/deleteModel",
"config/reload",
"config/listProfiles",
"config/openProfile",
"context/getContextItems",
"context/getSymbolsForFiles",
"context/loadSubmenuItems",
Expand Down Expand Up @@ -53,7 +55,6 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] =
//
"completeOnboarding",
"addAutocompleteModel",
"config/listProfiles",
"profiles/switch",
"didChangeSelectedProfile",
];
Expand All @@ -71,4 +72,6 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] =
"didChangeAvailableProfiles",
"setTTSActive",
"getWebviewHistoryLength",
"signInToControlPlane",
"openDialogMessage",
];
2 changes: 2 additions & 0 deletions core/protocol/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ export type ToWebviewFromIdeOrCoreProtocol = {
];
setTTSActive: [boolean, void];
getWebviewHistoryLength: [undefined, number];
signInToControlPlane: [undefined, void];
openDialogMessage: ["account", void];
};
4 changes: 4 additions & 0 deletions core/util/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ class FileSystemIde implements IDE {
return Promise.resolve();
}

openUrl(url: string): Promise<void> {
return Promise.resolve();
}

runCommand(command: string): Promise<void> {
return Promise.resolve();
}
Expand Down
4 changes: 4 additions & 0 deletions core/util/messageIde.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ export class MessageIde implements IDE {
await this.request("openFile", { path });
}

async openUrl(url: string): Promise<void> {
await this.request("openUrl", url);
}

async runCommand(command: string): Promise<void> {
await this.request("runCommand", { command });
}
Expand Down
13 changes: 12 additions & 1 deletion core/util/paths.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from "fs";
import * as os from "os";
import { pathToFileURL } from "url";
import * as path from "path";

import * as JSONC from "comment-json";
import dotenv from "dotenv";

Expand Down Expand Up @@ -41,6 +41,9 @@ export function getGlobalContinueIgnorePath(): string {
return continueIgnorePath;
}

/*
Deprecated, replace with getContinueGlobalUri where possible
*/
export function getContinueGlobalPath(): string {
// This is ~/.continue on mac/linux
const continuePath = CONTINUE_GLOBAL_DIR;
Expand All @@ -50,6 +53,10 @@ export function getContinueGlobalPath(): string {
return continuePath;
}

export function getContinueGlobalUri(): string {
return pathToFileURL(CONTINUE_GLOBAL_DIR).href;
}

export function getSessionsFolderPath(): string {
const sessionsPath = path.join(getContinueGlobalPath(), "sessions");
if (!fs.existsSync(sessionsPath)) {
Expand Down Expand Up @@ -94,6 +101,10 @@ export function getConfigJsonPath(ideType: IdeType = "vscode"): string {
return p;
}

export function getConfigJsonUri(): string {
return getContinueGlobalUri() + "/config.json";
}

export function getConfigTsPath(): string {
const p = path.join(getContinueGlobalPath(), "config.ts");
if (!fs.existsSync(p)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,6 @@ class ContinueBrowser(val project: Project, url: String) {
}

"reloadWindow" -> {}
"openConfigJson" -> {
ide?.setFileOpen(getConfigJsonPath())
}

"readRangeInFile" -> {
val data = data.asJsonObject
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.

52 changes: 50 additions & 2 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,10 @@
"group": "Continue"
},
{
"command": "continue.openConfigJson",
"command": "continue.openConfig",
"category": "Continue",
"title": "Open config.json",
"title": "Open Continue Config",
"icon": "$(gear)",
"group": "Continue"
},
{
Expand Down Expand Up @@ -250,12 +251,25 @@
"icon": "$(history)",
"group": "Continue"
},
{
"command": "continue.viewLogs",
"category": "Continue",
"title": "View History",
"group": "Continue"
},
{
"command": "continue.navigateTo",
"category": "Continue",
"title": "Navigate to a path",
"group": "Continue"
},
{
"command": "continue.openMorePage",
"category": "Continue",
"title": "More",
"icon": "$(ellipsis)",
"group": "Continue"
},
{
"command": "continue.writeCommentsForCode",
"category": "Continue",
Expand Down Expand Up @@ -315,6 +329,20 @@
"category": "Continue",
"title": "Focus Continue Chat",
"group": "Continue"
},
{
"command": "continue.signInToControlPlane",
"title": "Sign In",
"category": "Continue",
"group": "Continue",
"icon": "$(account)"
},
{
"command": "continue.openAccountDialog",
"title": "Account",
"category": "Continue",
"group": "Continue",
"icon": "$(account)"
}
],
"keybindings": [
Expand Down Expand Up @@ -492,6 +520,26 @@
"command": "continue.toggleFullScreen",
"group": "navigation@3",
"when": "view == continue.continueGUIView"
},
{
"command": "continue.openConfig",
"group": "navigation@4",
"when": "view == continue.continueGUIView"
},
{
"command": "continue.signInToControlPlane",
"group": "navigation@5",
"when": "(view == continue.continueGUIView) && config.continue.enableContinueForTeams && !continue.isSignedInToControlPlane"
},
{
"command": "continue.openAccountDialog",
"group": "navigation@5",
"when": "(view == continue.continueGUIView) && config.continue.enableContinueForTeams && continue.isSignedInToControlPlane"
},
{
"command": "continue.openMorePage",
"group": "navigation@6",
"when": "view == continue.continueGUIView"
}
],
"editor/title": [
Expand Down
5 changes: 5 additions & 0 deletions extensions/vscode/src/VsCodeIde.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
} from "./util/vscode";
import { VsCodeWebviewProtocol } from "./webviewProtocol";

import type {

Check warning on line 27 in extensions/vscode/src/VsCodeIde.ts

View workflow job for this annotation

GitHub Actions / tsc-check

There should be at least one empty line between import groups

Check warning on line 27 in extensions/vscode/src/VsCodeIde.ts

View workflow job for this annotation

GitHub Actions / tsc-check

There should be at least one empty line between import groups
ContinueRcJson,
FileType,
IDE,
Expand All @@ -36,7 +36,7 @@
RangeInFile,
Thread,
} from "core";
import { text } from "stream/consumers";

Check warning on line 39 in extensions/vscode/src/VsCodeIde.ts

View workflow job for this annotation

GitHub Actions / tsc-check

`stream/consumers` import should occur before import of `core`

Check warning on line 39 in extensions/vscode/src/VsCodeIde.ts

View workflow job for this annotation

GitHub Actions / tsc-check

`stream/consumers` import should occur before import of `core`

class VsCodeIde implements IDE {
ideUtils: VsCodeIdeUtils;
Expand Down Expand Up @@ -436,7 +436,7 @@
await this.ideUtils.saveFile(filepath);
}

private static MAX_BYTES = 100000;

Check warning on line 439 in extensions/vscode/src/VsCodeIde.ts

View workflow job for this annotation

GitHub Actions / tsc-check

Class Property name `MAX_BYTES` must match one of the following formats: camelCase

Check warning on line 439 in extensions/vscode/src/VsCodeIde.ts

View workflow job for this annotation

GitHub Actions / tsc-check

Class Property name `MAX_BYTES` must match one of the following formats: camelCase

async readFile(filepath: string): Promise<string> {
try {
Expand Down Expand Up @@ -485,6 +485,11 @@
return "";
}
}

async openUrl(url: string): Promise<void> {
await vscode.env.openExternal(vscode.Uri.parse(url));
}

async showDiff(
filepath: string,
newContents: string,
Expand Down
25 changes: 16 additions & 9 deletions extensions/vscode/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,10 +580,6 @@ const getCommandsMap: (
vscode.commands.executeCommand("continue.continueGUIView.focus");
sidebar.webviewProtocol?.request("addModel", undefined);
},
"continue.openSettingsUI": () => {
vscode.commands.executeCommand("continue.continueGUIView.focus");
sidebar.webviewProtocol?.request("openSettings", undefined);
},
"continue.sendMainUserInput": (text: string) => {
sidebar.webviewProtocol?.request("userInput", {
input: text,
Expand Down Expand Up @@ -683,8 +679,10 @@ const getCommandsMap: (

vscode.commands.executeCommand("workbench.action.copyEditorToNewWindow");
},
"continue.openConfigJson": () => {
ide.openFile(getConfigJsonPath());
"continue.openConfig": () => {
core.invoke("config/openProfile", {
profileId: undefined,
});
},
"continue.selectFilesAsContext": async (
firstUri: vscode.Uri,
Expand Down Expand Up @@ -857,7 +855,7 @@ const getCommandsMap: (
vscode.commands.executeCommand("continue.toggleFullScreen");
} else if (selectedOption === "$(question) Open help center") {
focusGUI();
vscode.commands.executeCommand("continue.navigateTo", "/more");
vscode.commands.executeCommand("continue.navigateTo", "/more", true);
}
quickPick.dispose();
});
Expand All @@ -877,10 +875,19 @@ const getCommandsMap: (
client.sendFeedback(feedback, lastLines);
}
},
"continue.navigateTo": (path: string) => {
sidebar.webviewProtocol?.request("navigateTo", { path });
"continue.openMorePage": () => {
vscode.commands.executeCommand("continue.navigateTo", "/more", true);
},
"continue.navigateTo": (path: string, toggle: boolean) => {
sidebar.webviewProtocol?.request("navigateTo", { path, toggle });
focusGUI();
},
"continue.signInToControlPlane": () => {
sidebar.webviewProtocol?.request("signInToControlPlane", undefined);
},
"continue.openAccountDialog": () => {
sidebar.webviewProtocol?.request("openDialogMessage", "account");
},
};
};

Expand Down
Loading
Loading