* allow setting apiBase for bedrock provider * ⚡️ better linking * ✨ new prompt file action * ⚡️ strip <COMPLETION> from GPT-4 completion * continue proxy FIM support * warn user if potentially dangerous command is generated * tab autocomplete docs * docs: update PR template (#1531) * chore: add docs to install script (#1533) * fix(extensions): schema for db ctx provider (#1534) * fix(extensions): schema for db ctx provider * fix: invalid enum * prettierignore * docs: add docs and schema for "OS" provider (#1536) * tests (#1501) * 👷 CI for jetbrains * default working dir * changelog * build binaries * binary testing setup * idesettings * core binary testing * run binary tests in ci * remove unused targets * needs build * console.log bin contents * fix ci * fix win32 binary download * test * no linux arm64 * macos latest * macos-12 * binary permissions * upload logs * fix * upload full folder as binary artifact * test * test macos only * set full execute permissions * copy sqlite binary * cd * it worked! * build again in test job * debug * remove timeout * info * log * log2 * more logs * catch * fewer logs * test all platforms * test downloaded artifact * needs build * updates * build * false * release * add tag and upload binaryes * change tag name * proper artifact upload * jest updates * ✅ generate a few unit tests with Continue * fix imports related to IdeSettings * run tsc on PRs * remove shareSession command (unused) * update release process * update plugin version * don't show ghost text when jetbrains completion visible * run jetbrains ci in main * check ts in dev * ignore .env * 🚑 fix constant warnings when onboarding with Ollama --------- Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
235 lines
5.1 KiB
TypeScript
235 lines
5.1 KiB
TypeScript
import * as fs from "node:fs";
|
|
import {
|
|
ContinueRcJson,
|
|
FileType,
|
|
IDE,
|
|
IdeInfo,
|
|
IdeSettings,
|
|
IndexTag,
|
|
Problem,
|
|
Range,
|
|
Thread,
|
|
} from "../index.d.js";
|
|
|
|
import { getContinueGlobalPath } from "./paths.js";
|
|
|
|
class FileSystemIde implements IDE {
|
|
static workspaceDir = "/tmp/continue";
|
|
|
|
constructor() {
|
|
fs.mkdirSync(FileSystemIde.workspaceDir, { recursive: true });
|
|
}
|
|
|
|
async getIdeSettings(): Promise<IdeSettings> {
|
|
return {
|
|
remoteConfigServerUrl: undefined,
|
|
remoteConfigSyncPeriod: 60,
|
|
userToken: "",
|
|
};
|
|
}
|
|
async getGitHubAuthToken(): Promise<string | undefined> {
|
|
return undefined;
|
|
}
|
|
getLastModified(files: string[]): Promise<{ [path: string]: number }> {
|
|
return new Promise((resolve) => {
|
|
resolve({
|
|
[files[0]]: 1234567890,
|
|
});
|
|
});
|
|
}
|
|
getGitRootPath(dir: string): Promise<string | undefined> {
|
|
return Promise.resolve(dir);
|
|
}
|
|
async listDir(dir: string): Promise<[string, FileType][]> {
|
|
const all: [string, FileType][] = fs
|
|
.readdirSync(dir, { withFileTypes: true })
|
|
.map((dirent: any) => [
|
|
dirent.path,
|
|
dirent.isDirectory()
|
|
? FileType.Directory
|
|
: dirent.isSymbolicLink()
|
|
? FileType.SymbolicLink
|
|
: FileType.File,
|
|
]);
|
|
return Promise.resolve(all);
|
|
}
|
|
infoPopup(message: string): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
errorPopup(message: string): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
getRepoName(dir: string): Promise<string | undefined> {
|
|
return Promise.resolve(undefined);
|
|
}
|
|
|
|
getTags(artifactId: string): Promise<IndexTag[]> {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
getIdeInfo(): Promise<IdeInfo> {
|
|
return Promise.resolve({
|
|
ideType: "vscode",
|
|
name: "na",
|
|
version: "0.1",
|
|
remoteName: "na",
|
|
extensionVersion: "na",
|
|
});
|
|
}
|
|
|
|
readRangeInFile(filepath: string, range: Range): Promise<string> {
|
|
return Promise.resolve("");
|
|
}
|
|
|
|
isTelemetryEnabled(): Promise<boolean> {
|
|
return Promise.resolve(true);
|
|
}
|
|
|
|
getUniqueId(): Promise<string> {
|
|
return Promise.resolve("NOT_UNIQUE");
|
|
}
|
|
|
|
getWorkspaceConfigs(): Promise<ContinueRcJson[]> {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
getDiff(): Promise<string> {
|
|
return Promise.resolve("");
|
|
}
|
|
|
|
getTerminalContents(): Promise<string> {
|
|
return Promise.resolve("");
|
|
}
|
|
|
|
async getDebugLocals(threadIndex: number): Promise<string> {
|
|
return Promise.resolve("");
|
|
}
|
|
|
|
async getTopLevelCallStackSources(
|
|
threadIndex: number,
|
|
stackDepth: number,
|
|
): Promise<string[]> {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
async getAvailableThreads(): Promise<Thread[]> {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
showLines(
|
|
filepath: string,
|
|
startLine: number,
|
|
endLine: number,
|
|
): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
|
|
listWorkspaceContents(
|
|
directory?: string,
|
|
useGitIgnore?: boolean,
|
|
): Promise<string[]> {
|
|
return new Promise((resolve, reject) => {
|
|
fs.readdir(FileSystemIde.workspaceDir, (err, files) => {
|
|
if (err) {
|
|
reject(err);
|
|
}
|
|
resolve(files);
|
|
});
|
|
});
|
|
}
|
|
|
|
getWorkspaceDirs(): Promise<string[]> {
|
|
return new Promise((resolve, reject) => {
|
|
fs.mkdtemp(FileSystemIde.workspaceDir, (err, folder) => {
|
|
if (err) {
|
|
reject(err);
|
|
}
|
|
resolve([folder]);
|
|
});
|
|
});
|
|
}
|
|
|
|
listFolders(): Promise<string[]> {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
writeFile(path: string, contents: string): Promise<void> {
|
|
return new Promise((resolve, reject) => {
|
|
fs.writeFile(path, contents, (err) => {
|
|
if (err) {
|
|
reject(err);
|
|
}
|
|
resolve();
|
|
});
|
|
});
|
|
}
|
|
|
|
showVirtualFile(title: string, contents: string): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
|
|
getContinueDir(): Promise<string> {
|
|
return Promise.resolve(getContinueGlobalPath());
|
|
}
|
|
|
|
openFile(path: string): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
|
|
runCommand(command: string): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
|
|
saveFile(filepath: string): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
|
|
readFile(filepath: string): Promise<string> {
|
|
return new Promise((resolve, reject) => {
|
|
fs.readFile(filepath, "utf8", (err, contents) => {
|
|
if (err) {
|
|
reject(err);
|
|
}
|
|
resolve(contents);
|
|
});
|
|
});
|
|
}
|
|
|
|
showDiff(
|
|
filepath: string,
|
|
newContents: string,
|
|
stepIndex: number,
|
|
): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
|
|
getBranch(dir: string): Promise<string> {
|
|
return Promise.resolve("");
|
|
}
|
|
|
|
getOpenFiles(): Promise<string[]> {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
getCurrentFile(): Promise<string | undefined> {
|
|
return Promise.resolve("");
|
|
}
|
|
|
|
getPinnedFiles(): Promise<string[]> {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
async getSearchResults(query: string): Promise<string> {
|
|
return "";
|
|
}
|
|
|
|
async getProblems(filepath?: string | undefined): Promise<Problem[]> {
|
|
return Promise.resolve([]);
|
|
}
|
|
|
|
async subprocess(command: string): Promise<[string, string]> {
|
|
return ["", ""];
|
|
}
|
|
}
|
|
|
|
export default FileSystemIde;
|