🚧 WIP on vertical diff

This commit is contained in:
Nate Sesti 2023-12-30 10:14:09 -05:00
parent 4c4b15cb51
commit ce4d3ba8f1
12 changed files with 26 additions and 25 deletions

View file

@ -1,5 +1,5 @@
import { ContextItemWithId, ILLM, SlashCommand } from "../..";
import { DiffLine, streamDiff } from "../../diff/diffLines";
import { ContextItemWithId, DiffLine, ILLM, SlashCommand } from "../..";
import { streamDiff } from "../../diff/diffLines";
import { streamLines } from "../../diff/util";
import { gptEditPrompt } from "../../llm/templates/edit";
import { renderPromptTemplate } from "../../util";

View file

@ -1,16 +1,6 @@
import { DiffLine } from "..";
import { matchLine } from "./util";
interface DiffLineNew {
type: "new";
newLine: string;
}
interface DiffLineOldOrSame {
type: "old" | "same";
}
export type DiffLine = DiffLineNew | DiffLineOldOrSame;
/**
* https://blog.jcoglan.com/2017/02/12/the-myers-diff-algorithm-part-1/
*/

View file

@ -1,6 +1,5 @@
import * as fs from "fs";
import { IDE, SerializedContinueConfig } from "..";
import { DiffLine } from "../diff/diffLines";
import { DiffLine, IDE, SerializedContinueConfig } from "..";
import {
getConfigJsonPath,
getConfigTsPath,

View file

@ -1,4 +1,4 @@
import { DiffLine } from "../diff/diffLines";
import { DiffLine } from "..";
import { IDE, SerializedContinueConfig } from "../index";
import { ideRequest } from "./messaging";
async function r(messageType: string, options: any = {}) {

11
core/index.d.ts vendored
View file

@ -229,6 +229,17 @@ export type CustomLLM = RequireAtLeastOne<
// IDE
interface DiffLineNew {
type: "new";
newLine: string;
}
interface DiffLineOldOrSame {
type: "old" | "same";
}
export type DiffLine = DiffLineNew | DiffLineOldOrSame;
export interface IDE {
getSerializedConfig(): Promise<SerializedContinueConfig>;
getConfigJsUrl(): Promise<string | undefined>;

View file

@ -1,9 +1,7 @@
import * as dotenv from "dotenv";
import { ContinueSDK } from "../..";
import EditSlashCommand, {
contextItemToRangeInFileWithContents,
getPromptParts,
} from "../../commands/slash/edit";
import EditSlashCommand, { getPromptParts } from "../../commands/slash/edit";
import { contextItemToRangeInFileWithContents } from "../../commands/util";
import FileSystemIde from "../../ide/filesystem";
import { dedentAndGetCommonWhitespace } from "../../util";
import FreeTrial from "../llms/FreeTrial";

View file

@ -75,6 +75,7 @@
"license": "Apache-2.0",
"dependencies": {
"dotenv": "^16.3.1",
"fastest-levenshtein": "^1.0.16",
"handlebars": "^4.7.8",
"js-tiktoken": "^1.0.8",
"openai": "^4.20.1",
@ -14904,6 +14905,7 @@
"@types/uuid": "^9.0.7",
"cargo-cp-artifact": "^0.1",
"dotenv": "^16.3.1",
"fastest-levenshtein": "^1.0.16",
"handlebars": "^4.7.8",
"jest": "^29.7.0",
"js-tiktoken": "^1.0.8",

View file

@ -1,5 +1,4 @@
import { FileEdit, ModelDescription } from "core";
import { DiffLine } from "core/diff/diffLines";
import { DiffLine, FileEdit, ModelDescription } from "core";
import {
editConfigJson,
getConfigJsonPath,

View file

@ -1,5 +1,5 @@
import { DiffLine } from "core";
import { streamDiffLines } from "core/commands/slash/verticalEdit";
import { DiffLine } from "core/diff/diffLines";
import * as vscode from "vscode";
import { llmFromTitle } from "../loadConfig";

View file

@ -11,12 +11,11 @@ import * as path from "path";
import * as vscode from "vscode";
import { ideProtocolClient } from "./activation/activate";
import { ContinueConfig, IDE, SerializedContinueConfig } from "core";
import { ContinueConfig, DiffLine, IDE, SerializedContinueConfig } from "core";
import {
intermediateToFinalConfig,
serializedToIntermediateConfig,
} from "core/config/load";
import { DiffLine } from "core/diff/diffLines";
import { verticalPerLineDiffManager } from "./diff/verticalPerLine";
import mergeJson from "./util/merge";

View file

@ -2112,6 +2112,7 @@ core-util-is@~1.0.0, core-util-is@1.0.2:
resolved "file:../../core"
dependencies:
dotenv "^16.3.1"
fastest-levenshtein "^1.0.16"
handlebars "^4.7.8"
js-tiktoken "^1.0.8"
openai "^4.20.1"

2
gui/package-lock.json generated
View file

@ -68,6 +68,7 @@
"license": "Apache-2.0",
"dependencies": {
"dotenv": "^16.3.1",
"fastest-levenshtein": "^1.0.16",
"handlebars": "^4.7.8",
"js-tiktoken": "^1.0.8",
"openai": "^4.20.1",
@ -7483,6 +7484,7 @@
"@types/uuid": "^9.0.7",
"cargo-cp-artifact": "^0.1",
"dotenv": "^16.3.1",
"fastest-levenshtein": "^1.0.16",
"handlebars": "^4.7.8",
"jest": "^29.7.0",
"js-tiktoken": "^1.0.8",