diff --git a/core/commands/slash/verticalEdit.ts b/core/commands/slash/verticalEdit.ts index 84a013a26..f7c0f3630 100644 --- a/core/commands/slash/verticalEdit.ts +++ b/core/commands/slash/verticalEdit.ts @@ -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"; diff --git a/core/diff/diffLines.ts b/core/diff/diffLines.ts index 7124d9aba..6c2b2d4f0 100644 --- a/core/diff/diffLines.ts +++ b/core/diff/diffLines.ts @@ -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/ */ diff --git a/core/ide/filesystem.ts b/core/ide/filesystem.ts index 174cbcc00..74face6fe 100644 --- a/core/ide/filesystem.ts +++ b/core/ide/filesystem.ts @@ -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, diff --git a/core/ide/index.ts b/core/ide/index.ts index 9867f4827..3a9dc14b1 100644 --- a/core/ide/index.ts +++ b/core/ide/index.ts @@ -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 = {}) { diff --git a/core/index.d.ts b/core/index.d.ts index d4e2ef44e..59b334961 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -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; getConfigJsUrl(): Promise; diff --git a/core/llm/test/edit.test.ts b/core/llm/test/edit.test.ts index 98165bdee..4abf7e018 100644 --- a/core/llm/test/edit.test.ts +++ b/core/llm/test/edit.test.ts @@ -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"; diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 2d540f041..a6c2dfd78 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -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", diff --git a/extensions/vscode/src/debugPanel.ts b/extensions/vscode/src/debugPanel.ts index cb08febe2..c08b18afc 100644 --- a/extensions/vscode/src/debugPanel.ts +++ b/extensions/vscode/src/debugPanel.ts @@ -1,5 +1,4 @@ -import { FileEdit, ModelDescription } from "core"; -import { DiffLine } from "core/diff/diffLines"; +import { DiffLine, FileEdit, ModelDescription } from "core"; import { editConfigJson, getConfigJsonPath, diff --git a/extensions/vscode/src/diff/verticalPerLine.ts b/extensions/vscode/src/diff/verticalPerLine.ts index 43a50e57d..8e79af8fd 100644 --- a/extensions/vscode/src/diff/verticalPerLine.ts +++ b/extensions/vscode/src/diff/verticalPerLine.ts @@ -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"; diff --git a/extensions/vscode/src/ideProtocol.ts b/extensions/vscode/src/ideProtocol.ts index ce799aa57..ec4ce0f03 100644 --- a/extensions/vscode/src/ideProtocol.ts +++ b/extensions/vscode/src/ideProtocol.ts @@ -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"; diff --git a/extensions/vscode/yarn.lock b/extensions/vscode/yarn.lock index 89c8e4d2f..c89e4f28c 100644 --- a/extensions/vscode/yarn.lock +++ b/extensions/vscode/yarn.lock @@ -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" diff --git a/gui/package-lock.json b/gui/package-lock.json index eddc1266e..628d74408 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -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",