chore: apply eslint to vscode and core
This commit is contained in:
parent
cc0e7c280d
commit
b5cab4609b
234 changed files with 678 additions and 350 deletions
|
|
@ -1,17 +1,19 @@
|
|||
import { ConfigHandler } from "../config/ConfigHandler.js";
|
||||
import { TRIAL_FIM_MODEL } from "../config/onboarding.js";
|
||||
import { IDE, ILLM } from "../index.js";
|
||||
import OpenAI from "../llm/llms/OpenAI.js";
|
||||
import { DEFAULT_AUTOCOMPLETE_OPTS } from "../util/parameters.js";
|
||||
|
||||
import { shouldCompleteMultiline } from "./classification/shouldCompleteMultiline.js";
|
||||
import { AutocompleteLanguageInfo } from "./constants/AutocompleteLanguageInfo.js";
|
||||
import { constructAutocompletePrompt } from "./constructPrompt.js";
|
||||
import { AutocompleteSnippet } from "./context/ranking/index.js";
|
||||
import { postprocessCompletion } from "./postprocessing/index.js";
|
||||
// @prettier-ignore
|
||||
import { TRIAL_FIM_MODEL } from "../config/onboarding.js";
|
||||
import OpenAI from "../llm/llms/OpenAI.js";
|
||||
import { shouldCompleteMultiline } from "./classification/shouldCompleteMultiline.js";
|
||||
|
||||
import { ContextRetrievalService } from "./context/ContextRetrievalService.js";
|
||||
import { AutocompleteSnippet } from "./context/ranking/index.js";
|
||||
import { BracketMatchingService } from "./filtering/BracketMatchingService.js";
|
||||
import { CompletionStreamer } from "./generation/CompletionStreamer.js";
|
||||
import { postprocessCompletion } from "./postprocessing/index.js";
|
||||
import { shouldPrefilter } from "./prefiltering/index.js";
|
||||
import { renderPrompt } from "./templating/index.js";
|
||||
import { AutocompleteDebouncer } from "./util/AutocompleteDebouncer.js";
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export const Python = {
|
|||
name: "Python",
|
||||
// """"#" is for .ipynb files, where we add '"""' surrounding markdown blocks.
|
||||
// This stops the model from trying to complete the start of a new markdown block
|
||||
topLevelKeywords: ["def", "class", '"""#'],
|
||||
topLevelKeywords: ["def", "class", "\"\"\"#"],
|
||||
singleLineComment: "#",
|
||||
endOfLine: [],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { Position, Range } from "../index.js";
|
||||
|
||||
import { ContextRetrievalService } from "./context/ContextRetrievalService.js";
|
||||
import {
|
||||
fillPromptWithSnippets,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { IDE } from "../..";
|
||||
import { HelperVars } from "../util/HelperVars";
|
||||
import { RecentlyEditedRange } from "../util/types";
|
||||
|
||||
import { ImportDefinitionsService } from "./ImportDefinitionsService";
|
||||
import { AutocompleteSnippet, getSymbolsForSnippet } from "./ranking";
|
||||
import { RootPathContextService } from "./root-path-context/RootPathContextService";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { IDE, Location } from "../..";
|
||||
import { LANGUAGES } from "../constants/AutocompleteLanguageInfo";
|
||||
|
||||
import { getSymbolsForSnippet } from "./ranking";
|
||||
|
||||
interface FileInfo {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { RangeInFileWithContents } from "../../../commands/util.js";
|
||||
|
||||
import { AutocompleteSnippet, jaccardSimilarity } from "./index.js";
|
||||
|
||||
function* slidingWindow(
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
import { Range } from "../../..";
|
||||
import { testIde } from "../../../test/util/fixtures";
|
||||
import { getAst, getTreePathAtCursor } from "../../util/ast";
|
||||
import { ImportDefinitionsService } from "../ImportDefinitionsService";
|
||||
|
||||
import { RootPathContextService } from "./RootPathContextService";
|
||||
|
||||
function splitTextAtRange(fileContent: string, range: Range): [string, string] {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { createHash } from "crypto";
|
||||
|
||||
import { LRUCache } from "lru-cache";
|
||||
import Parser from "web-tree-sitter";
|
||||
|
||||
import { IDE } from "../../..";
|
||||
import { getQueryForFile, TSQueryType } from "../../../util/treeSitter";
|
||||
import { AstPath } from "../../util/ast";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { streamLines } from "../../../diff/util";
|
||||
import { DEFAULT_AUTOCOMPLETE_OPTS } from "../../../util/parameters";
|
||||
import { HelperVars } from "../../util/HelperVars";
|
||||
|
||||
import { stopAtStopTokens } from "./charStream";
|
||||
import {
|
||||
avoidEmptyComments,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { jest } from "@jest/globals";
|
||||
|
||||
import * as lineStream from "./lineStream";
|
||||
|
||||
describe("lineStream", () => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { distance } from "fastest-levenshtein";
|
||||
|
||||
import { DiffLine } from "../../..";
|
||||
import { LineStream } from "../../../diff/util";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { setUpTestDir, tearDownTestDir } from "../../../test/util/testDir";
|
||||
|
||||
import { TEST_CASES_WITH_DIFF, TEST_CASES_WITHOUT_DIFF } from "./testCases";
|
||||
import {
|
||||
AutocompleteFileringTestInput,
|
||||
testAutocompleteFiltering,
|
||||
} from "./util";
|
||||
import { TEST_CASES_WITH_DIFF, TEST_CASES_WITHOUT_DIFF } from "./testCases";
|
||||
import { setUpTestDir, tearDownTestDir } from "../../../test/util/testDir";
|
||||
|
||||
const filterTestCases = (tests: AutocompleteFileringTestInput[]) => {
|
||||
if (tests.some((test) => test.options?.only)) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { dedent } from "../../../util";
|
||||
|
||||
import { AutocompleteFileringTestInput } from "./util";
|
||||
|
||||
export const TEST_CASES_WITH_DIFF: AutocompleteFileringTestInput[] = [
|
||||
|
|
@ -62,7 +63,7 @@ function sayHello() {
|
|||
`,
|
||||
llmOutput: `world!");
|
||||
`,
|
||||
expectedCompletion: `world!");`,
|
||||
expectedCompletion: "world!\");",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete Java when inside a block",
|
||||
|
|
@ -375,8 +376,8 @@ button {
|
|||
border: 2px solid #000;
|
||||
border-radius<|fim|>
|
||||
}`,
|
||||
llmOutput: `: 5px;`,
|
||||
expectedCompletion: `: 5px;`,
|
||||
llmOutput: ": 5px;",
|
||||
expectedCompletion: ": 5px;",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -391,8 +392,8 @@ button {
|
|||
border-bottom-right-radius: 8px;
|
||||
}
|
||||
`,
|
||||
llmOutput: `8`,
|
||||
expectedCompletion: `8`,
|
||||
llmOutput: "8",
|
||||
expectedCompletion: "8",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -404,8 +405,8 @@ input:focus {
|
|||
border: 2px solid <|fim|>;
|
||||
}
|
||||
`,
|
||||
llmOutput: `#4CAF50;`,
|
||||
expectedCompletion: `#4CAF50;`,
|
||||
llmOutput: "#4CAF50;",
|
||||
expectedCompletion: "#4CAF50;",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -422,8 +423,8 @@ input:focus {
|
|||
padding: var(--padding);
|
||||
}
|
||||
`,
|
||||
llmOutput: `--primary-color`,
|
||||
expectedCompletion: `--primary-color`,
|
||||
llmOutput: "--primary-color",
|
||||
expectedCompletion: "--primary-color",
|
||||
},
|
||||
{
|
||||
description: "Should complete CSS grid template columns",
|
||||
|
|
@ -435,8 +436,8 @@ input:focus {
|
|||
grid-gap: 10px;
|
||||
}
|
||||
`,
|
||||
llmOutput: `3, 1fr`,
|
||||
expectedCompletion: `3, 1fr`,
|
||||
llmOutput: "3, 1fr",
|
||||
expectedCompletion: "3, 1fr",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -476,8 +477,8 @@ function calculateArea($length, $width) {
|
|||
}
|
||||
|
||||
echo calculateArea(5, 3);`,
|
||||
llmOutput: `return $length * $width;`,
|
||||
expectedCompletion: `return $length * $width;`,
|
||||
llmOutput: "return $length * $width;",
|
||||
expectedCompletion: "return $length * $width;",
|
||||
filename: "areaCalculator.php",
|
||||
},
|
||||
|
||||
|
|
@ -488,8 +489,8 @@ echo calculateArea(5, 3);`,
|
|||
$colors = array("Red", "Green", <|fim|>);
|
||||
|
||||
echo "First color is: " . $colors[0];`,
|
||||
llmOutput: `"Blue"`,
|
||||
expectedCompletion: `"Blue"`,
|
||||
llmOutput: "\"Blue\"",
|
||||
expectedCompletion: "\"Blue\"",
|
||||
filename: "colors.php",
|
||||
},
|
||||
{
|
||||
|
|
@ -529,8 +530,8 @@ export const Counter = () => {
|
|||
</div>
|
||||
);
|
||||
};`,
|
||||
llmOutput: `0`,
|
||||
expectedCompletion: `0`,
|
||||
llmOutput: "0",
|
||||
expectedCompletion: "0",
|
||||
filename: "Counter.tsx",
|
||||
},
|
||||
|
||||
|
|
@ -557,8 +558,8 @@ export const Timer = () => {
|
|||
</div>
|
||||
);
|
||||
};`,
|
||||
llmOutput: `return () => clearInterval(interval);`,
|
||||
expectedCompletion: `return () => clearInterval(interval);`,
|
||||
llmOutput: "return () => clearInterval(interval);",
|
||||
expectedCompletion: "return () => clearInterval(interval);",
|
||||
filename: "Timer.tsx",
|
||||
},
|
||||
|
||||
|
|
@ -593,8 +594,8 @@ class Form extends React.Component {
|
|||
);
|
||||
}
|
||||
}`,
|
||||
llmOutput: `this.setState({ name: event.target.value });`,
|
||||
expectedCompletion: `this.setState({ name: event.target.value });`,
|
||||
llmOutput: "this.setState({ name: event.target.value });",
|
||||
expectedCompletion: "this.setState({ name: event.target.value });",
|
||||
filename: "Form.tsx",
|
||||
},
|
||||
{
|
||||
|
|
@ -646,8 +647,8 @@ print(even_squares)
|
|||
odd_squares = [<|fim|>
|
||||
print(odd_squares)
|
||||
`,
|
||||
llmOutput: `x for x in squares if x % 2 != 0`,
|
||||
expectedCompletion: `x for x in squares if x % 2 != 0`,
|
||||
llmOutput: "x for x in squares if x % 2 != 0",
|
||||
expectedCompletion: "x for x in squares if x % 2 != 0",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete a simple Go function declaration",
|
||||
|
|
@ -731,8 +732,8 @@ func main() {
|
|||
WHERE release_year > 2000 AND director = 'Christopher Nolan'
|
||||
GROUP BY name
|
||||
HAVING avg_rating > <|fim|>`,
|
||||
llmOutput: `8.5)`,
|
||||
expectedCompletion: `8.5)`,
|
||||
llmOutput: "8.5)",
|
||||
expectedCompletion: "8.5)",
|
||||
},
|
||||
{
|
||||
description:
|
||||
|
|
@ -774,8 +775,8 @@ func main() {
|
|||
FROM users u
|
||||
WHERE u.active = 1
|
||||
<|fim|>`,
|
||||
llmOutput: ` AND EXISTS (SELECT 1 FROM transactions t WHERE t.user_id = u.id AND t.amount > 100)`,
|
||||
expectedCompletion: ` AND EXISTS (SELECT 1 FROM transactions t WHERE t.user_id = u.id AND t.amount > 100)`,
|
||||
llmOutput: " AND EXISTS (SELECT 1 FROM transactions t WHERE t.user_id = u.id AND t.amount > 100)",
|
||||
expectedCompletion: " AND EXISTS (SELECT 1 FROM transactions t WHERE t.user_id = u.id AND t.amount > 100)",
|
||||
},
|
||||
{
|
||||
description:
|
||||
|
|
@ -790,8 +791,8 @@ func main() {
|
|||
ELSE 'Unknown'
|
||||
END as order_status
|
||||
FROM orders`,
|
||||
llmOutput: `WHEN status = 'cancelled' THEN 'Cancelled'`,
|
||||
expectedCompletion: `WHEN status = 'cancelled' THEN 'Cancelled'`,
|
||||
llmOutput: "WHEN status = 'cancelled' THEN 'Cancelled'",
|
||||
expectedCompletion: "WHEN status = 'cancelled' THEN 'Cancelled'",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete HTML paragraph content",
|
||||
|
|
@ -803,8 +804,8 @@ func main() {
|
|||
<p><|fim|></p>
|
||||
</body>
|
||||
</html>`,
|
||||
llmOutput: `This is a paragraph with some sample text.`,
|
||||
expectedCompletion: `This is a paragraph with some sample text.`,
|
||||
llmOutput: "This is a paragraph with some sample text.",
|
||||
expectedCompletion: "This is a paragraph with some sample text.",
|
||||
filename: "test.html",
|
||||
},
|
||||
{
|
||||
|
|
@ -816,8 +817,8 @@ func main() {
|
|||
<p>Description text.</p>
|
||||
</div>
|
||||
</div>`,
|
||||
llmOutput: `alt="Description of image"`,
|
||||
expectedCompletion: `alt="Description of image"`,
|
||||
llmOutput: "alt=\"Description of image\"",
|
||||
expectedCompletion: "alt=\"Description of image\"",
|
||||
filename: "test.html",
|
||||
},
|
||||
{
|
||||
|
|
@ -827,8 +828,8 @@ func main() {
|
|||
<li>Item 2</li>
|
||||
<li>Item 3</li>
|
||||
<li<|fim|></ul>`,
|
||||
llmOutput: `>Item 4</li>`,
|
||||
expectedCompletion: `>Item 4</li>`,
|
||||
llmOutput: ">Item 4</li>",
|
||||
expectedCompletion: ">Item 4</li>",
|
||||
filename: "test.html",
|
||||
},
|
||||
|
||||
|
|
@ -874,8 +875,8 @@ end
|
|||
numbers = [1, 2, 3, 4, 5]
|
||||
squared_numbers = numbers.<|fim|>
|
||||
`,
|
||||
llmOutput: `map { |n| n ** 2 }`,
|
||||
expectedCompletion: `map { |n| n ** 2 }`,
|
||||
llmOutput: "map { |n| n ** 2 }",
|
||||
expectedCompletion: "map { |n| n ** 2 }",
|
||||
filename: "array_methods.rb",
|
||||
},
|
||||
{
|
||||
|
|
@ -888,8 +889,8 @@ public class App {
|
|||
System.out.println(message);
|
||||
}
|
||||
}`,
|
||||
llmOutput: `World`,
|
||||
expectedCompletion: `World`,
|
||||
llmOutput: "World",
|
||||
expectedCompletion: "World",
|
||||
},
|
||||
{
|
||||
description:
|
||||
|
|
@ -929,8 +930,8 @@ public class App {
|
|||
<|fim|>
|
||||
]
|
||||
}`,
|
||||
llmOutput: `, { "id": 3, "name": "Charlie" }`,
|
||||
expectedCompletion: `, { "id": 3, "name": "Charlie" }`,
|
||||
llmOutput: ", { \"id\": 3, \"name\": \"Charlie\" }",
|
||||
expectedCompletion: ", { \"id\": 3, \"name\": \"Charlie\" }",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete within a CSV record",
|
||||
|
|
@ -938,8 +939,8 @@ public class App {
|
|||
input: `Name, Age, City
|
||||
John Doe, 30, New York
|
||||
Jane Smith<|fim|>`,
|
||||
llmOutput: `, 25, Los Angeles`,
|
||||
expectedCompletion: `, 25, Los Angeles`,
|
||||
llmOutput: ", 25, Los Angeles",
|
||||
expectedCompletion: ", 25, Los Angeles",
|
||||
},
|
||||
{
|
||||
description:
|
||||
|
|
@ -948,8 +949,8 @@ Jane Smith<|fim|>`,
|
|||
input: `Product, Price, Quantity
|
||||
Laptop, 1200, 5
|
||||
Smart<|fim|>`,
|
||||
llmOutput: `phone, 800, 10`,
|
||||
expectedCompletion: `phone, 800, 10`,
|
||||
llmOutput: "phone, 800, 10",
|
||||
expectedCompletion: "phone, 800, 10",
|
||||
},
|
||||
{
|
||||
description: "Should complete CSV structure adding closing brackets",
|
||||
|
|
@ -957,8 +958,8 @@ Smart<|fim|>`,
|
|||
input: `ID, Name, JoiningDate
|
||||
1, Alice, 2023-01-10
|
||||
2, B<|fim|>`,
|
||||
llmOutput: `ob, 2023-02-10`,
|
||||
expectedCompletion: `ob, 2023-02-10`,
|
||||
llmOutput: "ob, 2023-02-10",
|
||||
expectedCompletion: "ob, 2023-02-10",
|
||||
},
|
||||
{
|
||||
description: "Should complete YAML list item and preserve structure",
|
||||
|
|
@ -1125,8 +1126,8 @@ sumTree (Node left right) =
|
|||
let leftSum = <|fim|>
|
||||
rightSum = sumTree right
|
||||
in leftSum + rightSum`,
|
||||
llmOutput: `sumTree left`,
|
||||
expectedCompletion: `sumTree left`,
|
||||
llmOutput: "sumTree left",
|
||||
expectedCompletion: "sumTree left",
|
||||
},
|
||||
{
|
||||
description: "Haskell: Complex function with where clause and guards",
|
||||
|
|
@ -1142,8 +1143,8 @@ solveQuadratic a b c
|
|||
sqrtD = sqrt discriminant
|
||||
x1 = (-b + sqrtD) / (2*a)
|
||||
<|fim|> = (-b - sqrtD) / (2*a)`,
|
||||
llmOutput: `x2`,
|
||||
expectedCompletion: `x2`,
|
||||
llmOutput: "x2",
|
||||
expectedCompletion: "x2",
|
||||
},
|
||||
{
|
||||
description: "Haskell: List comprehension with complex filter",
|
||||
|
|
@ -1153,8 +1154,8 @@ solveQuadratic a b c
|
|||
primesUpTo :: Int -> [Int]
|
||||
primesUpTo n = [x | x <- [2..n], isPrime x]
|
||||
where isPrime num = <|fim|> && all (\d -> num \`mod\` d /= 0) [2..(floor . sqrt $ fromIntegral num)]`,
|
||||
llmOutput: `num > 1`,
|
||||
expectedCompletion: `num > 1`,
|
||||
llmOutput: "num > 1",
|
||||
expectedCompletion: "num > 1",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete Dart class methods",
|
||||
|
|
@ -1192,8 +1193,8 @@ void main() {
|
|||
var name = "World";
|
||||
print('Hello, <|fim|>!');
|
||||
}`,
|
||||
llmOutput: `\${name}`,
|
||||
expectedCompletion: `\${name}`,
|
||||
llmOutput: "${name}",
|
||||
expectedCompletion: "${name}",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete within a Dart function body",
|
||||
|
|
@ -1213,8 +1214,8 @@ class Counter {
|
|||
count = 0;
|
||||
}
|
||||
}`,
|
||||
llmOutput: `count--;`,
|
||||
expectedCompletion: `count--;`,
|
||||
llmOutput: "count--;",
|
||||
expectedCompletion: "count--;",
|
||||
},
|
||||
{
|
||||
description:
|
||||
|
|
@ -1223,8 +1224,8 @@ class Counter {
|
|||
(let [sum (+ a b)]
|
||||
(println "The sum is" sum)
|
||||
sum<|fim|>`,
|
||||
llmOutput: `))`,
|
||||
expectedCompletion: `))`,
|
||||
llmOutput: "))",
|
||||
expectedCompletion: "))",
|
||||
filename: "test.clj",
|
||||
},
|
||||
{
|
||||
|
|
@ -1236,8 +1237,8 @@ class Counter {
|
|||
:age 30
|
||||
<|fim|>
|
||||
(println "User information loaded"))`,
|
||||
llmOutput: `:location "Unknown"}`,
|
||||
expectedCompletion: `:location "Unknown"}`,
|
||||
llmOutput: ":location \"Unknown\"}",
|
||||
expectedCompletion: ":location \"Unknown\"}",
|
||||
filename: "test.clj",
|
||||
},
|
||||
{
|
||||
|
|
@ -1248,8 +1249,8 @@ class Counter {
|
|||
(when (seq nums)
|
||||
(println (first nums))
|
||||
(recur (rest nums)))))`,
|
||||
llmOutput: ` 7,`,
|
||||
expectedCompletion: ` 7,`,
|
||||
llmOutput: " 7,",
|
||||
expectedCompletion: " 7,",
|
||||
filename: "test.clj",
|
||||
},
|
||||
{
|
||||
|
|
@ -1273,8 +1274,8 @@ numbers <- c(1, 2, 3, 4, 5)
|
|||
for (number in numbers) {
|
||||
print(<|fim|>)
|
||||
}`,
|
||||
llmOutput: `number)`,
|
||||
expectedCompletion: `number)`,
|
||||
llmOutput: "number)",
|
||||
expectedCompletion: "number)",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete R data frame creation",
|
||||
|
|
@ -1285,8 +1286,8 @@ data <- data.frame(
|
|||
Age = c(25, 30, 35),
|
||||
<|fim|>
|
||||
)`,
|
||||
llmOutput: `Height = c(165, 180, 175)`,
|
||||
expectedCompletion: `Height = c(165, 180, 175)`,
|
||||
llmOutput: "Height = c(165, 180, 175)",
|
||||
expectedCompletion: "Height = c(165, 180, 175)",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete R if-else statement",
|
||||
|
|
@ -1300,8 +1301,8 @@ if (grade >= 90) {
|
|||
} else {
|
||||
print("C")
|
||||
}`,
|
||||
llmOutput: `print("B")`,
|
||||
expectedCompletion: `print("B")`,
|
||||
llmOutput: "print(\"B\")",
|
||||
expectedCompletion: "print(\"B\")",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete R ggplot2 plot structure",
|
||||
|
|
@ -1312,8 +1313,8 @@ library(ggplot2)
|
|||
ggplot(data=mtcars, aes(x=wt, y=mpg)) +
|
||||
geom_point() +
|
||||
<|fim|>`,
|
||||
llmOutput: `geom_smooth(method='lm', se=FALSE)`,
|
||||
expectedCompletion: `geom_smooth(method='lm', se=FALSE)`,
|
||||
llmOutput: "geom_smooth(method='lm', se=FALSE)",
|
||||
expectedCompletion: "geom_smooth(method='lm', se=FALSE)",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete Scala class with a method",
|
||||
|
|
@ -1323,8 +1324,8 @@ ggplot(data=mtcars, aes(x=wt, y=mpg)) +
|
|||
<|fim|>
|
||||
}
|
||||
}`,
|
||||
llmOutput: `s"Hello, my name is $name and I am $age years old."`,
|
||||
expectedCompletion: `s"Hello, my name is $name and I am $age years old."`,
|
||||
llmOutput: "s\"Hello, my name is $name and I am $age years old.\"",
|
||||
expectedCompletion: "s\"Hello, my name is $name and I am $age years old.\"",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1334,8 +1335,8 @@ ggplot(data=mtcars, aes(x=wt, y=mpg)) +
|
|||
case class Person(name: String, age: Int, address: Address)
|
||||
|
||||
val alice = Person("Alice", 30, Address("Wonderland", <|fim|>))`,
|
||||
llmOutput: `"12345")`,
|
||||
expectedCompletion: `"12345")`,
|
||||
llmOutput: "\"12345\")",
|
||||
expectedCompletion: "\"12345\")",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1380,8 +1381,8 @@ int main() {
|
|||
printf("Result: %d", add(2, 3));
|
||||
return 0;
|
||||
}`,
|
||||
llmOutput: `return a - b;`,
|
||||
expectedCompletion: `return a - b;`,
|
||||
llmOutput: "return a - b;",
|
||||
expectedCompletion: "return a - b;",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1400,8 +1401,8 @@ int main() {
|
|||
printf("Name: %s, Age: %d, Height: %.2f", alice.name, alice.age, alice.height);
|
||||
return 0;
|
||||
}`,
|
||||
llmOutput: `5.5`,
|
||||
expectedCompletion: `5.5`,
|
||||
llmOutput: "5.5",
|
||||
expectedCompletion: "5.5",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1453,8 +1454,8 @@ data class User(
|
|||
val email: String,
|
||||
<|fim|>
|
||||
)`,
|
||||
llmOutput: `val age: Int`,
|
||||
expectedCompletion: `val age: Int`,
|
||||
llmOutput: "val age: Int",
|
||||
expectedCompletion: "val age: Int",
|
||||
},
|
||||
{
|
||||
description:
|
||||
|
|
@ -1490,8 +1491,8 @@ contract SimpleStorage {
|
|||
}
|
||||
}
|
||||
`,
|
||||
llmOutput: `return data;`,
|
||||
expectedCompletion: `return data;`,
|
||||
llmOutput: "return data;",
|
||||
expectedCompletion: "return data;",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1508,8 +1509,8 @@ contract EventExample {
|
|||
}
|
||||
}
|
||||
`,
|
||||
llmOutput: `id, content`,
|
||||
expectedCompletion: `id, content`,
|
||||
llmOutput: "id, content",
|
||||
expectedCompletion: "id, content",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1582,8 +1583,8 @@ const multiplyNumbers = (a: number, b: number): number => {
|
|||
|
||||
console.log(multiplyNumbers(2, 3));
|
||||
`,
|
||||
llmOutput: `turn a * b;`,
|
||||
expectedCompletion: `turn a * b;`,
|
||||
llmOutput: "turn a * b;",
|
||||
expectedCompletion: "turn a * b;",
|
||||
},
|
||||
|
||||
// TODO
|
||||
|
|
@ -1677,8 +1678,8 @@ public class Person
|
|||
{
|
||||
void <|fim|>
|
||||
}`,
|
||||
llmOutput: `Greet();`,
|
||||
expectedCompletion: `Greet();`,
|
||||
llmOutput: "Greet();",
|
||||
expectedCompletion: "Greet();",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete inside C# method with if condition",
|
||||
|
|
@ -1696,8 +1697,8 @@ public class Calculator
|
|||
return 0;
|
||||
}
|
||||
}`,
|
||||
llmOutput: `a > 0 && b > 0`,
|
||||
expectedCompletion: `a > 0 && b > 0`,
|
||||
llmOutput: "a > 0 && b > 0",
|
||||
expectedCompletion: "a > 0 && b > 0",
|
||||
},
|
||||
{
|
||||
description: "Should complete a simple Julia function",
|
||||
|
|
@ -1706,8 +1707,8 @@ public class Calculator
|
|||
<|fim|>
|
||||
end
|
||||
`,
|
||||
llmOutput: `return length * width`,
|
||||
expectedCompletion: `return length * width`,
|
||||
llmOutput: "return length * width",
|
||||
expectedCompletion: "return length * width",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete Julia for loop",
|
||||
|
|
@ -1721,8 +1722,8 @@ end
|
|||
|
||||
println(squared_numbers)
|
||||
`,
|
||||
llmOutput: `push!(squared_numbers, num^2)`,
|
||||
expectedCompletion: `push!(squared_numbers, num^2)`,
|
||||
llmOutput: "push!(squared_numbers, num^2)",
|
||||
expectedCompletion: "push!(squared_numbers, num^2)",
|
||||
},
|
||||
{
|
||||
description: "Should complete a Julia struct definition",
|
||||
|
|
@ -1756,8 +1757,8 @@ end
|
|||
|
||||
println(get_grade("Alice")) # Should print 90
|
||||
`,
|
||||
llmOutput: `student_name`,
|
||||
expectedCompletion: `student_name`,
|
||||
llmOutput: "student_name",
|
||||
expectedCompletion: "student_name",
|
||||
},
|
||||
{
|
||||
description: "Should complete a Julia module declaration",
|
||||
|
|
@ -1776,8 +1777,8 @@ end
|
|||
|
||||
<|fim|>
|
||||
`,
|
||||
llmOutput: `end`,
|
||||
expectedCompletion: `end`,
|
||||
llmOutput: "end",
|
||||
expectedCompletion: "end",
|
||||
},
|
||||
{
|
||||
description: "Should complete F# let-binding with function definition",
|
||||
|
|
@ -1786,8 +1787,8 @@ end
|
|||
|
||||
let calculateArea length width =
|
||||
<|fim|>`,
|
||||
llmOutput: `length * width`,
|
||||
expectedCompletion: `length * width`,
|
||||
llmOutput: "length * width",
|
||||
expectedCompletion: "length * width",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1828,8 +1829,8 @@ let john = { FirstName = "John"; LastName = "Doe"; Age = 30 }`,
|
|||
input: `let squares = [ for x in 1..10 -> x * x ]
|
||||
let evenSquares = [ for x in squares do if x % 2 = 0 then yield x ]
|
||||
let oddSquares = [<|fim|>]`,
|
||||
llmOutput: ` for x in squares do if x % 2 <> 0 then yield x ]`,
|
||||
expectedCompletion: ` for x in squares do if x % 2 <> 0 then yield x ]`,
|
||||
llmOutput: " for x in squares do if x % 2 <> 0 then yield x ]",
|
||||
expectedCompletion: " for x in squares do if x % 2 <> 0 then yield x ]",
|
||||
},
|
||||
{
|
||||
description: "Should complete an F# recursive function",
|
||||
|
|
@ -1837,8 +1838,8 @@ let oddSquares = [<|fim|>]`,
|
|||
input: `let rec factorial n =
|
||||
if n <= 1 then 1
|
||||
else n <|fim|> factorial (n - 1)`,
|
||||
llmOutput: `*`,
|
||||
expectedCompletion: `*`,
|
||||
llmOutput: "*",
|
||||
expectedCompletion: "*",
|
||||
},
|
||||
{
|
||||
description: "Should complete F# member method inside a class type",
|
||||
|
|
@ -1919,8 +1920,8 @@ let oddSquares = [<|fim|>]`,
|
|||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}`,
|
||||
llmOutput: ` transition(all 0.3s ease);`,
|
||||
expectedCompletion: ` transition(all 0.3s ease);`,
|
||||
llmOutput: " transition(all 0.3s ease);",
|
||||
expectedCompletion: " transition(all 0.3s ease);",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1937,8 +1938,8 @@ $secondary-color: #6c757d;
|
|||
color: #fff;
|
||||
border-radius: 4px;
|
||||
}`,
|
||||
llmOutput: `$primary-`,
|
||||
expectedCompletion: `$primary-`,
|
||||
llmOutput: "$primary-",
|
||||
expectedCompletion: "$primary-",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete Vue component method",
|
||||
|
|
@ -2027,8 +2028,8 @@ export default {
|
|||
};
|
||||
</script>
|
||||
`,
|
||||
llmOutput: `this.completed`,
|
||||
expectedCompletion: `this.completed`,
|
||||
llmOutput: "this.completed",
|
||||
expectedCompletion: "this.completed",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete Svelte reactive statement",
|
||||
|
|
@ -2048,8 +2049,8 @@ export default {
|
|||
Clicked {count} times
|
||||
</button>
|
||||
`,
|
||||
llmOutput: `doubledCount = count * 2`,
|
||||
expectedCompletion: `doubledCount = count * 2`,
|
||||
llmOutput: "doubledCount = count * 2",
|
||||
expectedCompletion: "doubledCount = count * 2",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -2065,8 +2066,8 @@ export default {
|
|||
<ChildComponent <|fim|> />
|
||||
</main>
|
||||
`,
|
||||
llmOutput: `name="World"`,
|
||||
expectedCompletion: `name="World"`,
|
||||
llmOutput: "name=\"World\"",
|
||||
expectedCompletion: "name=\"World\"",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -2083,7 +2084,7 @@ export default {
|
|||
{/each<|fim|>
|
||||
</ul>
|
||||
`,
|
||||
llmOutput: `}`,
|
||||
expectedCompletion: `}`,
|
||||
llmOutput: "}",
|
||||
expectedCompletion: "}",
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import Mock from "../../../llm/llms/Mock";
|
||||
import { testConfigHandler, testIde } from "../../../test/util/fixtures";
|
||||
import { CompletionProvider } from "../../CompletionProvider";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { CompletionOptions, ILLM } from "../..";
|
||||
import { StreamTransformPipeline } from "../filtering/streamTransforms/StreamTransformPipeline";
|
||||
import { HelperVars } from "../util/HelperVars";
|
||||
|
||||
import { GeneratorReuseManager } from "./GeneratorReuseManager";
|
||||
|
||||
export class CompletionStreamer {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import type { ILLM } from "../../index.js";
|
||||
import { longestCommonSubsequence } from "../../util/lcs.js";
|
||||
import { lineIsRepeated } from "../filtering/streamTransforms/lineStream.js";
|
||||
|
||||
import type { ILLM } from "../../index.js";
|
||||
|
||||
function rewritesLineAbove(completion: string, prefix: string): boolean {
|
||||
const lineAbove = prefix
|
||||
.split("\n")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import path from "node:path";
|
||||
|
||||
import { IDE } from "../..";
|
||||
import { getBasename } from "../../util";
|
||||
import { getConfigJsonPath } from "../../util/paths";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { IDE } from "../..";
|
||||
import { getRangeInString } from "../../util/ranges";
|
||||
import { languageForFilepath } from "../constants/AutocompleteLanguageInfo";
|
||||
|
||||
import { AutocompleteInput } from "../util/types";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import Handlebars from "handlebars";
|
||||
|
||||
import { CompletionOptions } from "../..";
|
||||
import { getBasename, getLastNPathParts } from "../../util";
|
||||
import { AutocompleteLanguageInfo } from "../constants/AutocompleteLanguageInfo";
|
||||
import { AutocompleteSnippet } from "../context/ranking";
|
||||
import { HelperVars } from "../util/HelperVars";
|
||||
|
||||
import {
|
||||
AutocompleteTemplate,
|
||||
getTemplateForModel,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { logDevData } from "../../util/devdata";
|
||||
import { COUNT_COMPLETION_REJECTED_AFTER } from "../../util/parameters";
|
||||
import { Telemetry } from "../../util/posthog";
|
||||
|
||||
import { AutocompleteOutcome } from "./types";
|
||||
|
||||
export class AutocompleteLoggingService {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Mutex } from "async-mutex";
|
||||
import { open } from "sqlite";
|
||||
import sqlite3 from "sqlite3";
|
||||
|
||||
import {
|
||||
DatabaseConnection,
|
||||
truncateSqliteLikePattern,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {
|
|||
languageForFilepath,
|
||||
} from "../constants/AutocompleteLanguageInfo";
|
||||
import { constructInitialPrefixSuffix } from "../templating/constructPrefixSuffix";
|
||||
|
||||
import { AstPath, getAst, getTreePathAtCursor } from "./ast";
|
||||
import { AutocompleteInput } from "./types";
|
||||
|
||||
|
|
@ -38,7 +39,7 @@ export class HelperVars {
|
|||
|
||||
private async init() {
|
||||
// Don't do anything if already initialized
|
||||
if (this._fileContents !== undefined) return;
|
||||
if (this._fileContents !== undefined) {return;}
|
||||
|
||||
this._fileContents =
|
||||
this.input.manuallyPassFileContents ??
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import Parser from "web-tree-sitter";
|
||||
|
||||
import { RangeInFileWithContents } from "../../commands/util.js";
|
||||
import { getParserForFile } from "../../util/treeSitter.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { CustomCommand, SlashCommand, SlashCommandDescription } from "../";
|
||||
import { stripImages } from "../llm/images";
|
||||
import { renderTemplatedString } from "../promptFiles/v1/renderTemplatedString";
|
||||
|
||||
import SlashCommands from "./slash";
|
||||
|
||||
export function slashFromCustomCommand(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { SlashCommand } from "../../";
|
||||
|
||||
import EditSlashCommand from "./edit";
|
||||
|
||||
const CommentSlashCommand: SlashCommand = {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
import { IDE, SlashCommand } from "../..";
|
||||
import * as fs from "fs/promises";
|
||||
import * as path from "path";
|
||||
import { stripImages } from "../../llm/images";
|
||||
|
||||
import ignore from "ignore";
|
||||
|
||||
import { IDE, SlashCommand } from "../..";
|
||||
import {
|
||||
defaultIgnoreDir,
|
||||
defaultIgnoreFile,
|
||||
gitIgArrayFromFile,
|
||||
} from "../../indexing/ignore";
|
||||
import { stripImages } from "../../llm/images";
|
||||
|
||||
const LANGUAGE_DEP_MGMT_FILENAMES = [
|
||||
"package.json", // JavaScript (Node.js)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import * as fs from "node:fs";
|
||||
import { homedir } from "node:os";
|
||||
import path from "path";
|
||||
|
||||
import { languageForFilepath } from "../../autocomplete/constants/AutocompleteLanguageInfo.js";
|
||||
import { SlashCommand } from "../../index.js";
|
||||
import { stripImages } from "../../llm/images.js";
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import { testConfigHandler } from "../test/util/fixtures";
|
||||
import { TEST_DIR } from "../test/util/testDir";
|
||||
import { getConfigTsPath } from "../util/paths";
|
||||
|
||||
import { defaultConfig } from "./default";
|
||||
|
||||
describe.skip("Test the ConfigHandler and E2E config loading", () => {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import {
|
|||
} from "../index.js";
|
||||
import Ollama from "../llm/llms/Ollama.js";
|
||||
import { GlobalContext } from "../util/GlobalContext.js";
|
||||
|
||||
import { ConfigResult } from "./load.js";
|
||||
import {
|
||||
LOCAL_ONBOARDING_CHAT_MODEL,
|
||||
|
|
@ -19,7 +20,6 @@ import {
|
|||
} from "./onboarding.js";
|
||||
import ControlPlaneProfileLoader from "./profile/ControlPlaneProfileLoader.js";
|
||||
import LocalProfileLoader from "./profile/LocalProfileLoader.js";
|
||||
|
||||
import {
|
||||
ProfileDescription,
|
||||
ProfileLifecycleManager,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { config } from "dotenv";
|
||||
|
||||
import {
|
||||
BrowserSerializedContinueConfig,
|
||||
ContinueConfig,
|
||||
|
|
@ -6,7 +7,6 @@ import {
|
|||
} from "../index.js";
|
||||
|
||||
import { ConfigResult, finalToBrowserConfig } from "./load.js";
|
||||
|
||||
import { IProfileLoader } from "./profile/IProfileLoader.js";
|
||||
|
||||
export interface ProfileDescription {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import { execSync } from "child_process";
|
||||
import * as JSONC from "comment-json";
|
||||
import * as fs from "fs";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
|
||||
import * as JSONC from "comment-json";
|
||||
import * as tar from "tar";
|
||||
|
||||
import {
|
||||
BrowserSerializedContinueConfig,
|
||||
Config,
|
||||
|
|
@ -32,6 +34,7 @@ import ContinueProxyContextProvider from "../context/providers/ContinueProxyCont
|
|||
import CustomContextProviderClass from "../context/providers/CustomContextProvider";
|
||||
import FileContextProvider from "../context/providers/FileContextProvider";
|
||||
import { contextProviderClassFromName } from "../context/providers/index";
|
||||
import PromptFilesContextProvider from "../context/providers/PromptFilesContextProvider";
|
||||
import { AllRerankers } from "../context/rerankers/index";
|
||||
import { LLMReranker } from "../context/rerankers/llm";
|
||||
import { allEmbeddingsProviders } from "../indexing/embeddings";
|
||||
|
|
@ -42,6 +45,7 @@ import CustomLLMClass from "../llm/llms/CustomLLM";
|
|||
import FreeTrial from "../llm/llms/FreeTrial";
|
||||
import { copyOf } from "../util";
|
||||
import { fetchwithRequestOptions } from "../util/fetchWithOptions";
|
||||
import { GlobalContext } from "../util/GlobalContext";
|
||||
import mergeJson from "../util/merge";
|
||||
import {
|
||||
DEFAULT_CONFIG_TS_CONTENTS,
|
||||
|
|
@ -54,6 +58,7 @@ import {
|
|||
getEsbuildBinaryPath,
|
||||
readAllGlobalPromptFiles,
|
||||
} from "../util/paths";
|
||||
|
||||
import {
|
||||
defaultContextProvidersJetBrains,
|
||||
defaultContextProvidersVsCode,
|
||||
|
|
@ -67,8 +72,6 @@ import {
|
|||
} from "./promptFile.js";
|
||||
import { ConfigValidationError, validateConfig } from "./validation.js";
|
||||
|
||||
import PromptFilesContextProvider from "../context/providers/PromptFilesContextProvider";
|
||||
import { GlobalContext } from "../util/GlobalContext";
|
||||
|
||||
export interface ConfigResult<T> {
|
||||
config: T | undefined;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { SerializedContinueConfig } from "../";
|
||||
|
||||
import { FREE_TRIAL_MODELS } from "./default";
|
||||
|
||||
export const TRIAL_FIM_MODEL = "codestral-latest";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { ConfigJson } from "@continuedev/config-types";
|
||||
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import {
|
||||
ContinueConfig,
|
||||
|
|
@ -7,8 +8,9 @@ import {
|
|||
SerializedContinueConfig,
|
||||
} from "../../index.js";
|
||||
import { ConfigResult } from "../load.js";
|
||||
import { IProfileLoader } from "./IProfileLoader.js";
|
||||
|
||||
import doLoadConfig from "./doLoadConfig.js";
|
||||
import { IProfileLoader } from "./IProfileLoader.js";
|
||||
|
||||
export default class ControlPlaneProfileLoader implements IProfileLoader {
|
||||
private static RELOAD_INTERVAL = 1000 * 60 * 15; // every 15 minutes
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { ContinueConfig, IDE, IdeSettings } from "../../index.js";
|
||||
import { ConfigResult } from "../load.js";
|
||||
|
||||
import doLoadConfig from "./doLoadConfig.js";
|
||||
import { IProfileLoader } from "./IProfileLoader.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
import Handlebars from "handlebars";
|
||||
import path from "path";
|
||||
|
||||
import Handlebars from "handlebars";
|
||||
import * as YAML from "yaml";
|
||||
import type { ChatHistory, ChatHistoryItem, ChatMessage, ContextItem, ContinueSDK, IContextProvider, IDE, SlashCommand } from "..";
|
||||
|
||||
import { BaseContextProvider } from "../context";
|
||||
import { walkDir } from "../indexing/walkDir";
|
||||
import { stripImages } from "../llm/images";
|
||||
import { renderTemplatedString } from "../promptFiles/v1/renderTemplatedString";
|
||||
import { getBasename } from "../util/index";
|
||||
import { BaseContextProvider } from "../context";
|
||||
|
||||
import type { ChatHistory, ChatHistoryItem, ChatMessage, ContextItem, ContinueSDK, IContextProvider, IDE, SlashCommand } from "..";
|
||||
|
||||
export const DEFAULT_PROMPTS_FOLDER = ".prompts";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { BaseContextProvider } from "../";
|
||||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
ContextProviderExtras,
|
||||
} from "../../";
|
||||
import { BaseContextProvider } from "../";
|
||||
import { retrieveContextItemsFromEmbeddings } from "../retrieval/retrieval";
|
||||
|
||||
class CodebaseContextProvider extends BaseContextProvider {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { BaseContextProvider } from "../";
|
||||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
ContextProviderExtras,
|
||||
} from "../../";
|
||||
import { getBasename } from "../../util/";
|
||||
import { BaseContextProvider } from "../";
|
||||
|
||||
class CurrentFileContextProvider extends BaseContextProvider {
|
||||
static description: ContextProviderDescription = {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { getDatabaseAdapter } from "dbinfoz";
|
||||
|
||||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
|
|
@ -6,7 +8,6 @@ import {
|
|||
LoadSubmenuItemsArgs,
|
||||
} from "../../index.js";
|
||||
import { BaseContextProvider } from "../index.js";
|
||||
import { getDatabaseAdapter } from "dbinfoz";
|
||||
|
||||
class DatabaseContextProvider extends BaseContextProvider {
|
||||
static description: ContextProviderDescription = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { INSTRUCTIONS_BASE_ITEM } from "./utils";
|
||||
import { BaseContextProvider } from "../";
|
||||
import {
|
||||
Chunk,
|
||||
|
|
@ -12,6 +11,8 @@ import DocsService from "../../indexing/docs/DocsService";
|
|||
import preIndexedDocs from "../../indexing/docs/preIndexedDocs";
|
||||
import { Telemetry } from "../../util/posthog";
|
||||
|
||||
import { INSTRUCTIONS_BASE_ITEM } from "./utils";
|
||||
|
||||
class DocsContextProvider extends BaseContextProvider {
|
||||
static nRetrieve = 30;
|
||||
static nFinal = 15;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { AxiosError, AxiosInstance } from "axios";
|
||||
|
||||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
import { execSync } from "child_process";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
|
||||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
ContextProviderExtras,
|
||||
} from "../../index.js";
|
||||
import { BaseContextProvider } from "../index.js";
|
||||
import { execSync } from "child_process";
|
||||
import * as path from "path";
|
||||
import * as fs from "fs";
|
||||
|
||||
|
||||
class GreptileContextProvider extends BaseContextProvider {
|
||||
static description: ContextProviderDescription = {
|
||||
|
|
@ -35,7 +37,7 @@ import {
|
|||
throw new Error("Failed to determine the workspace directory.");
|
||||
}
|
||||
|
||||
var remoteUrl = getRemoteUrl(absPath)
|
||||
var remoteUrl = getRemoteUrl(absPath);
|
||||
remoteUrl = getRemoteUrl(absPath);
|
||||
const repoName = extractRepoName(remoteUrl);
|
||||
const branch = getCurrentBranch(absPath);
|
||||
|
|
@ -46,11 +48,11 @@ import {
|
|||
}
|
||||
|
||||
const options = {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${greptileToken}`,
|
||||
'X-GitHub-Token': githubToken,
|
||||
'Content-Type': 'application/json',
|
||||
"X-GitHub-Token": githubToken,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
messages: [{ id: "<string>", content: query, role: "user" }],
|
||||
|
|
@ -66,7 +68,7 @@ import {
|
|||
};
|
||||
|
||||
try {
|
||||
const response = await extras.fetch('https://api.greptile.com/v2/query', options);
|
||||
const response = await extras.fetch("https://api.greptile.com/v2/query", options);
|
||||
const rawText = await response.text();
|
||||
|
||||
// Check for HTTP errors
|
||||
|
|
@ -84,7 +86,7 @@ import {
|
|||
}));
|
||||
} catch (error) {
|
||||
console.error("Error getting context items from Greptile:", error);
|
||||
throw new Error(`Error getting context items from Greptile`);
|
||||
throw new Error("Error getting context items from Greptile");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -102,34 +104,34 @@ import {
|
|||
if (workspaceDirs && workspaceDirs.length > 0) {
|
||||
return workspaceDirs[0];
|
||||
} else {
|
||||
console.warn(`extras.ide.getWorkspaceDirs() returned undefined or empty array.`);
|
||||
console.warn("extras.ide.getWorkspaceDirs() returned undefined or empty array.");
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(`Failed to get workspace directories from extras.ide.getWorkspaceDirs():`);
|
||||
console.warn("Failed to get workspace directories from extras.ide.getWorkspaceDirs():");
|
||||
}
|
||||
|
||||
// Fallback to using Git commands
|
||||
try {
|
||||
const currentDir = process.cwd();
|
||||
if (this.isGitRepository(currentDir)) {
|
||||
const workspaceDir = execSync('git rev-parse --show-toplevel').toString().trim();
|
||||
const workspaceDir = execSync("git rev-parse --show-toplevel").toString().trim();
|
||||
return workspaceDir;
|
||||
} else {
|
||||
console.warn(`Current directory is not a Git repository: ${currentDir}`);
|
||||
return null;
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(`Failed to get workspace directory using Git commands: `);
|
||||
console.warn("Failed to get workspace directory using Git commands: ");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private isGitRepository(dir: string): boolean {
|
||||
try {
|
||||
const gitDir = path.join(dir, '.git');
|
||||
const gitDir = path.join(dir, ".git");
|
||||
return fs.existsSync(gitDir);
|
||||
} catch (err) {
|
||||
console.warn(`Failed to check if directory is a Git repository:`);
|
||||
console.warn("Failed to check if directory is a Git repository:");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -141,7 +143,7 @@ import {
|
|||
const remote = execSync(`git -C ${absPath} remote get-url origin`).toString().trim();
|
||||
return remote;
|
||||
} catch (err) {
|
||||
console.warn(`Failed to get remote URL`);
|
||||
console.warn("Failed to get remote URL");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -151,7 +153,7 @@ import {
|
|||
const branch = execSync(`git -C ${absPath} rev-parse --abbrev-ref HEAD`).toString().trim();
|
||||
return branch;
|
||||
} catch (err) {
|
||||
console.warn(`Failed to get current branch`);
|
||||
console.warn("Failed to get current branch");
|
||||
return "master"; // Default to 'master' if the current branch cannot be determined
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import adf2md from "adf-to-md";
|
||||
|
||||
import { RequestOptions } from "../../../";
|
||||
// @ts-ignore
|
||||
import adf2md from "adf-to-md";
|
||||
|
||||
interface JiraClientOptions {
|
||||
domain: string;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {
|
|||
LoadSubmenuItemsArgs,
|
||||
} from "../../../index.js";
|
||||
import { BaseContextProvider } from "../../index.js";
|
||||
|
||||
import { JiraClient } from "./JiraClient.js";
|
||||
|
||||
class JiraIssuesContextProvider extends BaseContextProvider {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import os from "os";
|
||||
|
||||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Readability } from "@mozilla/readability";
|
||||
import { JSDOM } from "jsdom";
|
||||
import { NodeHtmlMarkdown } from "node-html-markdown";
|
||||
|
||||
import { BaseContextProvider } from "../";
|
||||
import {
|
||||
ContextItem,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { BaseContextProvider } from "../";
|
||||
import { ContextProviderName } from "../../";
|
||||
|
||||
import CodeContextProvider from "./CodeContextProvider";
|
||||
import ContinueProxyContextProvider from "./ContinueProxyContextProvider";
|
||||
import CurrentFileContextProvider from "./CurrentFileContextProvider";
|
||||
|
|
@ -16,8 +17,8 @@ import GoogleContextProvider from "./GoogleContextProvider";
|
|||
import GreptileContextProvider from "./GreptileContextProvider";
|
||||
import HttpContextProvider from "./HttpContextProvider";
|
||||
import JiraIssuesContextProvider from "./JiraIssuesContextProvider/";
|
||||
import OSContextProvider from "./OSContextProvider";
|
||||
import OpenFilesContextProvider from "./OpenFilesContextProvider";
|
||||
import OSContextProvider from "./OSContextProvider";
|
||||
import PostgresContextProvider from "./PostgresContextProvider";
|
||||
import ProblemsContextProvider from "./ProblemsContextProvider";
|
||||
import RepoMapContextProvider from "./RepoMapContextProvider";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import fetch from "node-fetch";
|
||||
|
||||
import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js";
|
||||
import { Chunk, Reranker } from "../../index.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import fetch from "node-fetch";
|
||||
|
||||
import { Chunk, Reranker } from "../../index.js";
|
||||
|
||||
export class CohereReranker implements Reranker {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import fetch from "node-fetch";
|
||||
|
||||
import { getHeaders } from "../../continueServer/stubs/headers.js";
|
||||
import { TRIAL_PROXY_URL } from "../../control-plane/client.js";
|
||||
import { Chunk, Reranker } from "../../index.js";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { RerankerName } from "../../index.js";
|
||||
|
||||
import { CohereReranker } from "./cohere.js";
|
||||
import { ContinueProxyReranker } from "./ContinueProxyReranker.js";
|
||||
import { FreeTrialReranker } from "./freeTrial.js";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import fetch from "node-fetch";
|
||||
|
||||
import { Chunk, Reranker } from "../../index.js";
|
||||
|
||||
export class HuggingFaceTEIReranker implements Reranker {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import fetch from "node-fetch";
|
||||
|
||||
import { Chunk, Reranker } from "../../index.js";
|
||||
|
||||
export class VoyageReranker implements Reranker {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import QuickLRU from "quick-lru";
|
||||
|
||||
import { ToWebviewOrCoreFromIdeProtocol } from "../../protocol/ide.js";
|
||||
|
||||
// The cache key and value are both a filepath string
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import { Analytics } from "@continuedev/config-types";
|
||||
import os from "node:os";
|
||||
|
||||
import { Analytics } from "@continuedev/config-types";
|
||||
|
||||
import ContinueProxyAnalyticsProvider from "./analytics/ContinueProxyAnalyticsProvider.js";
|
||||
import {
|
||||
ControlPlaneProxyInfo,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { Analytics } from "@continuedev/config-types";
|
||||
import fetch from "node-fetch";
|
||||
|
||||
import { ControlPlaneClient } from "../client.js";
|
||||
|
||||
import {
|
||||
ControlPlaneProxyInfo,
|
||||
IAnalyticsProvider,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import { Analytics } from "@continuedev/config-types";
|
||||
import net from "node:net";
|
||||
|
||||
import { Analytics } from "@continuedev/config-types";
|
||||
|
||||
import {
|
||||
ControlPlaneProxyInfo,
|
||||
IAnalyticsProvider,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { Analytics } from "@continuedev/config-types";
|
||||
|
||||
import {
|
||||
ControlPlaneProxyInfo,
|
||||
IAnalyticsProvider,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { ConfigJson } from "@continuedev/config-types";
|
||||
import fetch, { RequestInit, Response } from "node-fetch";
|
||||
|
||||
import { ModelDescription } from "../index.js";
|
||||
|
||||
import { controlPlaneEnv } from "./env.js";
|
||||
|
||||
export interface ControlPlaneSessionInfo {
|
||||
|
|
|
|||
13
core/core.ts
13
core/core.ts
|
|
@ -1,7 +1,8 @@
|
|||
import ignore from "ignore";
|
||||
import path from "path";
|
||||
|
||||
import ignore from "ignore";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import type { ContextItemId, IDE, IndexingProgressUpdate } from ".";
|
||||
|
||||
import { CompletionProvider } from "./autocomplete/CompletionProvider";
|
||||
import { ConfigHandler } from "./config/ConfigHandler";
|
||||
import {
|
||||
|
|
@ -21,18 +22,20 @@ import DocsService from "./indexing/docs/DocsService";
|
|||
import { defaultIgnoreFile } from "./indexing/ignore.js";
|
||||
import Ollama from "./llm/llms/Ollama";
|
||||
import { createNewPromptFileV2 } from "./promptFiles/v2/createNewPromptFile";
|
||||
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
||||
import { GlobalContext } from "./util/GlobalContext";
|
||||
import { ChatDescriber } from "./util/chatDescriber";
|
||||
import { logDevData } from "./util/devdata";
|
||||
import { DevDataSqliteDb } from "./util/devdataSqlite";
|
||||
import { fetchwithRequestOptions } from "./util/fetchWithOptions";
|
||||
import { GlobalContext } from "./util/GlobalContext";
|
||||
import historyManager from "./util/history";
|
||||
import type { IMessenger, Message } from "./util/messenger";
|
||||
import { editConfigJson, setupInitialDotContinueDirectory } from "./util/paths";
|
||||
import { Telemetry } from "./util/posthog";
|
||||
import { TTS } from "./util/tts";
|
||||
|
||||
import type { ContextItemId, IDE, IndexingProgressUpdate } from ".";
|
||||
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
||||
import type { IMessenger, Message } from "./util/messenger";
|
||||
|
||||
export class Core {
|
||||
// implements IMessenger<ToCoreProtocol, FromCoreProtocol>
|
||||
configHandler: ConfigHandler;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { dedent } from "../util";
|
||||
|
||||
import { myersDiff } from "./myers";
|
||||
|
||||
describe("Test myers diff function", () => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { diffLines, type Change } from "diff";
|
||||
|
||||
import { DiffLine } from "..";
|
||||
|
||||
export function convertMyersChangeToDiffLines(change: Change): DiffLine[] {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import { changed, diff as myersDiff } from "myers-diff";
|
||||
|
||||
import { streamDiff } from "../diff/streamDiff.js";
|
||||
import { DiffLine, DiffLineType } from "../index.js";
|
||||
// @ts-ignore no typings available
|
||||
import { changed, diff as myersDiff } from "myers-diff";
|
||||
import path from "node:path";
|
||||
|
||||
import { generateLines } from "./util.js";
|
||||
|
||||
// "modification" is an extra type used to represent an "old" + "new" diff line
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { DiffLine, DiffLineType } from "../index.js";
|
||||
|
||||
import { LineStream, matchLine } from "./util.js";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { distance } from "fastest-levenshtein";
|
||||
|
||||
import { ChatMessage } from "../index.js";
|
||||
import { stripImages } from "../llm/images.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
import path from "path";
|
||||
|
||||
import { DiffLine, ILLM } from "../..";
|
||||
import { generateLines } from "../../diff/util";
|
||||
import { supportedLanguages } from "../../util/treeSitter";
|
||||
|
||||
import { deterministicApplyLazyEdit } from "./deterministic";
|
||||
import { streamLazyApply } from "./streamLazyApply";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
import fs from "node:fs";
|
||||
|
||||
// @ts-ignore no typings available
|
||||
import { diff as myersDiff } from "myers-diff";
|
||||
import path from "node:path";
|
||||
|
||||
import { diff as myersDiff } from "myers-diff";
|
||||
|
||||
import { DiffLine } from "../..";
|
||||
import { myersDiff as continueMyersDiff } from "../../diff/myers";
|
||||
import { dedent } from "../../util";
|
||||
|
||||
import { deterministicApplyLazyEdit } from "./deterministic";
|
||||
|
||||
const UNIFIED_DIFF_SYMBOLS = {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
import { distance } from "fastest-levenshtein";
|
||||
import path from "path";
|
||||
|
||||
import { distance } from "fastest-levenshtein";
|
||||
import Parser from "web-tree-sitter";
|
||||
|
||||
import { DiffLine } from "../..";
|
||||
import { LANGUAGES } from "../../autocomplete/constants/AutocompleteLanguageInfo";
|
||||
import { myersDiff } from "../../diff/myers";
|
||||
import { getParserForFile } from "../../util/treeSitter";
|
||||
|
||||
import { findInAst } from "./findInAst";
|
||||
|
||||
type AstReplacements = Array<{
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {
|
|||
import { streamDiff } from "../../diff/streamDiff.js";
|
||||
import { LineStream, streamLines } from "../../diff/util.js";
|
||||
import { DiffLine, ILLM } from "../../index.js";
|
||||
|
||||
import { lazyApplyPromptForModel, UNCHANGED_CODE } from "./prompts.js";
|
||||
import { BUFFER_LINES_BELOW, getReplacementWithLlm } from "./replace.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
import { jest } from "@jest/globals";
|
||||
|
||||
import { testIde } from "../test/util/fixtures";
|
||||
import {
|
||||
insertMockChunks,
|
||||
mockPathAndCacheKey,
|
||||
updateIndexAndAwaitGenerator,
|
||||
} from "../test/util/indexing";
|
||||
|
||||
import { CodeSnippetsCodebaseIndex } from "./CodeSnippetsIndex";
|
||||
import { DatabaseConnection, SqliteDb } from "./refreshIndex";
|
||||
import { IndexResultType } from "./types";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,21 @@
|
|||
import Parser from "web-tree-sitter";
|
||||
|
||||
import { getBasename, getLastNPathParts } from "../util/";
|
||||
import { migrate } from "../util/paths";
|
||||
import {
|
||||
TSQueryType,
|
||||
getParserForFile,
|
||||
getQueryForFile,
|
||||
} from "../util/treeSitter";
|
||||
|
||||
import { DatabaseConnection, SqliteDb, tagToString, truncateSqliteLikePattern } from "./refreshIndex";
|
||||
import {
|
||||
IndexResultType,
|
||||
MarkCompleteCallback,
|
||||
RefreshIndexResults,
|
||||
type CodebaseIndex,
|
||||
} from "./types";
|
||||
|
||||
import type {
|
||||
ChunkWithoutID,
|
||||
ContextItem,
|
||||
|
|
@ -7,20 +24,6 @@ import type {
|
|||
IndexTag,
|
||||
IndexingProgressUpdate,
|
||||
} from "../";
|
||||
import { getBasename, getLastNPathParts } from "../util/";
|
||||
import { migrate } from "../util/paths";
|
||||
import {
|
||||
TSQueryType,
|
||||
getParserForFile,
|
||||
getQueryForFile,
|
||||
} from "../util/treeSitter";
|
||||
import { DatabaseConnection, SqliteDb, tagToString, truncateSqliteLikePattern } from "./refreshIndex";
|
||||
import {
|
||||
IndexResultType,
|
||||
MarkCompleteCallback,
|
||||
RefreshIndexResults,
|
||||
type CodebaseIndex,
|
||||
} from "./types";
|
||||
|
||||
type SnippetChunk = ChunkWithoutID & { title: string; signature: string };
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
import { jest } from "@jest/globals";
|
||||
import { execSync } from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import { jest } from "@jest/globals";
|
||||
|
||||
import { ContinueServerClient } from "../continueServer/stubs/client.js";
|
||||
import { testConfigHandler, testIde } from "../test/util/fixtures.js";
|
||||
import {
|
||||
|
|
@ -11,6 +13,7 @@ import {
|
|||
TEST_DIR,
|
||||
} from "../test/util/testDir.js";
|
||||
import { getIndexSqlitePath } from "../util/paths.js";
|
||||
|
||||
import { CodebaseIndexer, PauseToken } from "./CodebaseIndexer.js";
|
||||
import { getComputeDeleteAddRemove } from "./refreshIndex.js";
|
||||
import { TestCodebaseIndex } from "./TestCodebaseIndex.js";
|
||||
|
|
@ -73,8 +76,8 @@ describe("CodebaseIndexer", () => {
|
|||
setUpTestDir();
|
||||
|
||||
execSync("git init", { cwd: TEST_DIR });
|
||||
execSync('git config user.email "test@example.com"', { cwd: TEST_DIR });
|
||||
execSync('git config user.name "Test"', { cwd: TEST_DIR });
|
||||
execSync("git config user.email \"test@example.com\"", { cwd: TEST_DIR });
|
||||
execSync("git config user.name \"Test\"", { cwd: TEST_DIR });
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import * as fs from "fs/promises";
|
||||
|
||||
import { ConfigHandler } from "../config/ConfigHandler.js";
|
||||
import { IContinueServerClient } from "../continueServer/interface.js";
|
||||
import { IDE, IndexingProgressUpdate, IndexTag } from "../index.js";
|
||||
import { extractMinimalStackTraceInfo } from "../util/extractMinimalStackTraceInfo.js";
|
||||
import { getIndexSqlitePath, getLanceDbPath } from "../util/paths.js";
|
||||
|
||||
import { ChunkCodebaseIndex } from "./chunk/ChunkCodebaseIndex.js";
|
||||
import { CodeSnippetsCodebaseIndex } from "./CodeSnippetsIndex.js";
|
||||
import { FullTextSearchCodebaseIndex } from "./FullTextSearchCodebaseIndex.js";
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import { jest } from "@jest/globals";
|
||||
|
||||
import {
|
||||
insertMockChunks,
|
||||
mockPathAndCacheKey,
|
||||
updateIndexAndAwaitGenerator,
|
||||
} from "../test/util/indexing";
|
||||
|
||||
import { FullTextSearchCodebaseIndex } from "./FullTextSearchCodebaseIndex";
|
||||
import { DatabaseConnection, SqliteDb } from "./refreshIndex";
|
||||
import { IndexResultType } from "./types";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { jest } from "@jest/globals";
|
||||
import lance from "vectordb";
|
||||
|
||||
import { testConfigHandler, testIde } from "../test/util/fixtures";
|
||||
import {
|
||||
mockPathAndCacheKey,
|
||||
|
|
@ -8,6 +9,7 @@ import {
|
|||
updateIndexAndAwaitGenerator,
|
||||
} from "../test/util/indexing";
|
||||
import { getLanceDbPath } from "../util/paths";
|
||||
|
||||
import { LanceDbIndex } from "./LanceDbIndex";
|
||||
import { DatabaseConnection, SqliteDb } from "./refreshIndex";
|
||||
import { IndexResultType } from "./types";
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import { RunResult } from "sqlite3";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import lance, { Table } from "vectordb";
|
||||
|
||||
import { IContinueServerClient } from "../continueServer/interface.js";
|
||||
import {
|
||||
BranchAndDir,
|
||||
|
|
@ -12,6 +13,7 @@ import {
|
|||
} from "../index.js";
|
||||
import { getBasename } from "../util/index.js";
|
||||
import { getLanceDbPath, migrate } from "../util/paths.js";
|
||||
|
||||
import { chunkDocument, shouldChunk } from "./chunk/chunk.js";
|
||||
import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex.js";
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import type { IndexTag, IndexingProgressUpdate } from "../index.js";
|
||||
import { DatabaseConnection, SqliteDb } from "./refreshIndex.js";
|
||||
import {
|
||||
IndexResultType,
|
||||
|
|
@ -7,6 +6,8 @@ import {
|
|||
type CodebaseIndex,
|
||||
} from "./types.js";
|
||||
|
||||
import type { IndexTag, IndexingProgressUpdate } from "../index.js";
|
||||
|
||||
/**
|
||||
* This is a CodebaseIndex used for testing which files get indexed.
|
||||
* It maintains a SQLite database of all file/tag pairs
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { jest } from "@jest/globals";
|
||||
|
||||
import { testIde } from "../../test/util/fixtures";
|
||||
import {
|
||||
mockFileContents,
|
||||
|
|
@ -10,6 +11,7 @@ import {
|
|||
import { addToTestDir } from "../../test/util/testDir";
|
||||
import { DatabaseConnection, SqliteDb } from "../refreshIndex";
|
||||
import { IndexResultType } from "../types";
|
||||
|
||||
import { ChunkCodebaseIndex } from "./ChunkCodebaseIndex";
|
||||
|
||||
jest.useFakeTimers();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import * as path from "path";
|
||||
|
||||
import { RunResult } from "sqlite3";
|
||||
|
||||
import { IContinueServerClient } from "../../continueServer/interface.js";
|
||||
import { Chunk, IndexTag, IndexingProgressUpdate } from "../../index.js";
|
||||
import { getBasename } from "../../util/index.js";
|
||||
|
|
@ -11,6 +13,7 @@ import {
|
|||
RefreshIndexResults,
|
||||
type CodebaseIndex,
|
||||
} from "../types.js";
|
||||
|
||||
import { chunkDocument, shouldChunk } from "./chunk.js";
|
||||
|
||||
export class ChunkCodebaseIndex implements CodebaseIndex {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import path from "path";
|
||||
|
||||
import { shouldChunk } from "./chunk";
|
||||
|
||||
describe("shouldChunk", () => {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { countTokensAsync } from "../../llm/countTokens.js";
|
|||
import { extractMinimalStackTraceInfo } from "../../util/extractMinimalStackTraceInfo.js";
|
||||
import { Telemetry } from "../../util/posthog.js";
|
||||
import { supportedLanguages } from "../../util/treeSitter.js";
|
||||
|
||||
import { basicChunker } from "./basic.js";
|
||||
import { codeChunker } from "./code.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { ChunkWithoutID } from "../..";
|
||||
|
||||
import { codeChunker } from "./code";
|
||||
|
||||
async function genToArr<T>(generator: AsyncGenerator<T>): Promise<T[]> {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { SyntaxNode } from "web-tree-sitter";
|
||||
|
||||
import { ChunkWithoutID } from "../../index.js";
|
||||
import { countTokensAsync } from "../../llm/countTokens.js";
|
||||
import { getParserForFile } from "../../util/treeSitter.js";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { ChunkWithoutID } from "../../";
|
||||
import { countTokens } from "../../llm/countTokens";
|
||||
|
||||
import { basicChunker } from "./basic";
|
||||
|
||||
export function cleanFragment(
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
import os from "os";
|
||||
|
||||
import { jest } from "@jest/globals";
|
||||
|
||||
import { ContinueConfig } from "../..";
|
||||
import { testConfigHandler } from "../../test/util/fixtures";
|
||||
import FileSystemIde from "../../util/filesystem";
|
||||
|
||||
import DocsCrawler, { ChromiumInstaller, type PageData } from "./DocsCrawler";
|
||||
import preIndexedDocs from "./preIndexedDocs";
|
||||
import { jest } from "@jest/globals";
|
||||
import FileSystemIde from "../../util/filesystem";
|
||||
import { testConfigHandler } from "../../test/util/fixtures";
|
||||
import os from "os";
|
||||
import { ContinueConfig } from "../..";
|
||||
|
||||
// Temporary workaround until we have better caching of Chromium
|
||||
// download between test runs
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
import { URL } from "node:url";
|
||||
|
||||
// @ts-ignore
|
||||
// @prettier-ignore
|
||||
import { ContinueConfig, IDE } from "../..";
|
||||
|
||||
import CheerioCrawler from "./crawlers/CheerioCrawler";
|
||||
import { ChromiumCrawler, ChromiumInstaller } from "./crawlers/ChromiumCrawler";
|
||||
import { DefaultCrawler } from "./crawlers/DefaultCrawler";
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { SiteIndexingConfig } from "../../index.js";
|
|||
import FileSystemIde from "../../util/filesystem.js";
|
||||
import { editConfigJson } from "../../util/paths.js";
|
||||
import FreeTrialEmbeddingsProvider from "../embeddings/FreeTrialEmbeddingsProvider.js";
|
||||
|
||||
import DocsService from "./DocsService.js";
|
||||
import preIndexedDocs from "./preIndexedDocs.js";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { open, type Database } from "sqlite";
|
||||
import sqlite3 from "sqlite3";
|
||||
import lancedb, { Connection } from "vectordb";
|
||||
|
||||
import {
|
||||
Chunk,
|
||||
ContinueConfig,
|
||||
|
|
@ -13,6 +14,7 @@ import { ConfigHandler } from "../../config/ConfigHandler";
|
|||
import { addContextProvider } from "../../config/util";
|
||||
import DocsContextProvider from "../../context/providers/DocsContextProvider";
|
||||
import { FromCoreProtocol, ToCoreProtocol } from "../../protocol";
|
||||
import { fetchFavicon, getFaviconBase64 } from "../../util/fetchFavicon";
|
||||
import { GlobalContext } from "../../util/GlobalContext";
|
||||
import { IMessenger } from "../../util/messenger";
|
||||
import {
|
||||
|
|
@ -22,6 +24,7 @@ import {
|
|||
} from "../../util/paths";
|
||||
import { Telemetry } from "../../util/posthog";
|
||||
import TransformersJsEmbeddingsProvider from "../embeddings/TransformersJsEmbeddingsProvider";
|
||||
|
||||
import { Article, chunkArticle, pageToArticle } from "./article";
|
||||
import DocsCrawler from "./DocsCrawler";
|
||||
import { runLanceMigrations, runSqliteMigrations } from "./migrations";
|
||||
|
|
@ -32,7 +35,6 @@ import {
|
|||
SiteIndexingResults,
|
||||
} from "./preIndexed";
|
||||
import preIndexedDocs from "./preIndexedDocs";
|
||||
import { fetchFavicon, getFaviconBase64 } from "../../util/fetchFavicon";
|
||||
|
||||
// Purposefully lowercase because lancedb converts
|
||||
export interface LanceDbDocsRow {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
import { Readability } from "@mozilla/readability";
|
||||
import { JSDOM } from "jsdom";
|
||||
|
||||
import { Chunk } from "../../";
|
||||
import { cleanFragment, cleanHeader } from "../chunk/markdown";
|
||||
|
||||
import { type PageData } from "./DocsCrawler";
|
||||
|
||||
export type ArticleComponent = {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import * as cheerio from "cheerio";
|
||||
import { URL } from "node:url";
|
||||
|
||||
import * as cheerio from "cheerio";
|
||||
|
||||
import { PageData } from "../DocsCrawler";
|
||||
|
||||
export default class CheerioCrawler {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,18 @@
|
|||
import * as fs from "fs";
|
||||
import { URL } from "node:url";
|
||||
|
||||
import { Handler, HTTPResponse, Page } from "puppeteer";
|
||||
|
||||
// @ts-ignore
|
||||
// @prettier-ignore
|
||||
import PCR from "puppeteer-chromium-resolver";
|
||||
|
||||
import { ContinueConfig, IDE } from "../../..";
|
||||
import {
|
||||
editConfigJson,
|
||||
getChromiumPath,
|
||||
getContinueUtilsPath,
|
||||
} from "../../../util/paths";
|
||||
// @ts-ignore
|
||||
// @prettier-ignore
|
||||
import PCR from "puppeteer-chromium-resolver";
|
||||
import { ContinueConfig, IDE } from "../../..";
|
||||
import { PageData } from "../DocsCrawler";
|
||||
|
||||
export class ChromiumCrawler {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { URL } from "node:url";
|
||||
|
||||
import { getHeaders } from "../../../continueServer/stubs/headers";
|
||||
import { TRIAL_PROXY_URL } from "../../../control-plane/client";
|
||||
import { PageData } from "../DocsCrawler";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import { Octokit } from "@octokit/rest";
|
||||
import { URL } from "node:url";
|
||||
|
||||
import { Octokit } from "@octokit/rest";
|
||||
|
||||
import { PageData } from "../DocsCrawler";
|
||||
|
||||
class GitHubCrawler {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { Table } from "vectordb";
|
||||
import { editConfigJson, migrate } from "../../util/paths.js";
|
||||
import { type Database } from "sqlite";
|
||||
import { Table } from "vectordb";
|
||||
|
||||
import { editConfigJson, migrate } from "../../util/paths.js";
|
||||
|
||||
import DocsService, { SqliteDocsRow } from "./DocsService.js";
|
||||
|
||||
export async function runLanceMigrations(table: Table) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Chunk } from "../../";
|
||||
import request from "request";
|
||||
|
||||
import { Chunk } from "../../";
|
||||
|
||||
export function getS3Filename(
|
||||
embeddingsProviderId: string,
|
||||
title: string,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import {
|
|||
EmbeddingsProviderName,
|
||||
FetchFunction,
|
||||
} from "../../index.js";
|
||||
|
||||
import { DEFAULT_MAX_CHUNK_SIZE } from "../../llm/constants.js";
|
||||
|
||||
export interface IBaseEmbeddingsProvider extends EmbeddingsProvider {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ import {
|
|||
InvokeModelCommand,
|
||||
} from "@aws-sdk/client-bedrock-runtime";
|
||||
import { fromIni } from "@aws-sdk/credential-providers";
|
||||
|
||||
import { EmbeddingsProviderName, EmbedOptions, FetchFunction } from "../../index.js";
|
||||
|
||||
import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js";
|
||||
|
||||
interface ModelConfig {
|
||||
|
|
@ -79,7 +81,7 @@ class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
|
||||
private _getModelConfig() {
|
||||
const modelConfigs: { [key: string]: ModelConfig } = {
|
||||
'cohere': {
|
||||
"cohere": {
|
||||
formatPayload: (text: string) => ({
|
||||
texts: [text],
|
||||
input_type: "search_document",
|
||||
|
|
@ -87,7 +89,7 @@ class BedrockEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
}),
|
||||
extractEmbeddings: (responseBody: any) => responseBody.embeddings || [],
|
||||
},
|
||||
'amazon.titan-embed': {
|
||||
"amazon.titan-embed": {
|
||||
formatPayload: (text: string) => ({
|
||||
inputText: text,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { Response } from "node-fetch";
|
||||
|
||||
import { EmbeddingsProviderName, EmbedOptions } from "../../index.js";
|
||||
import { withExponentialBackoff } from "../../util/withExponentialBackoff.js";
|
||||
|
||||
import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js";
|
||||
|
||||
class CohereEmbeddingsProvider extends BaseEmbeddingsProvider {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js";
|
||||
import { EmbeddingsProviderName } from "../../index.js";
|
||||
|
||||
import OpenAIEmbeddingsProvider from "./OpenAIEmbeddingsProvider.js";
|
||||
|
||||
class ContinueProxyEmbeddingsProvider extends OpenAIEmbeddingsProvider {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { EmbeddingsProviderName, EmbedOptions } from "../../index.js";
|
||||
import { withExponentialBackoff } from "../../util/withExponentialBackoff.js";
|
||||
|
||||
import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js";
|
||||
|
||||
class DeepInfraEmbeddingsProvider extends BaseEmbeddingsProvider {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { Response } from "node-fetch";
|
||||
|
||||
import { getHeaders } from "../../continueServer/stubs/headers.js";
|
||||
import { TRIAL_PROXY_URL } from "../../control-plane/client.js";
|
||||
import {
|
||||
|
|
@ -7,6 +8,7 @@ import {
|
|||
FetchFunction,
|
||||
} from "../../index.js";
|
||||
import { withExponentialBackoff } from "../../util/withExponentialBackoff.js";
|
||||
|
||||
import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js";
|
||||
|
||||
class FreeTrialEmbeddingsProvider extends BaseEmbeddingsProvider {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue