Merge branch 'dev' into nate/autocomplete-cleaning
This commit is contained in:
commit
a5f4380bd0
370 changed files with 6244 additions and 3817 deletions
4
.changes/extensions/vscode/0.8.56.md
Normal file
4
.changes/extensions/vscode/0.8.56.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
## 0.8.56 - 2024-11-08
|
||||
### Added
|
||||
* New Edit mode in sidebar (cmd/ctrl+I)
|
||||
* Significantly faster and more accurate docs crawler by default
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
project: extensions/vscode
|
||||
kind: Added
|
||||
body: New Edit mode in sidebar (cmd/ctrl+I)
|
||||
time: 2024-11-02T00:27:24.40964-07:00
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
project: extensions/vscode
|
||||
kind: Added
|
||||
body: Significantly faster and more accurate docs crawler by default
|
||||
time: 2024-11-02T00:27:44.408045-07:00
|
||||
1
.github/pull_request_template.md
vendored
1
.github/pull_request_template.md
vendored
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
## Checklist
|
||||
|
||||
- [] The base branch of this PR is `dev`, rather than `main`
|
||||
- [] The relevant docs, if any, have been updated or created
|
||||
|
||||
## Screenshots
|
||||
|
|
|
|||
19
.github/workflows/README.md
vendored
19
.github/workflows/README.md
vendored
|
|
@ -1,19 +0,0 @@
|
|||
# Deployment Process
|
||||
|
||||
## preview
|
||||
|
||||
When merging to `preview`:
|
||||
|
||||
- the VS Code extension along with Rust extension is built and uploaded as an artifact
|
||||
- all of the artifacts are downloaded and pushed to the store/registry all at once, as full releases.
|
||||
- the version is bumped and this change is commited to preview
|
||||
- in the future, the JetBrains extension will be built and uploaded to the marketplace here
|
||||
|
||||
## main
|
||||
|
||||
When merging to `main`:
|
||||
|
||||
- the VS Code extension along with Rust extension is built and uploaded as an artifact
|
||||
- all of the artifacts are downloaded and pushed to the store/registry all at once, as full releases.
|
||||
- the version is bumped and this change is commited to main
|
||||
- in the future, the JetBrains extension will be built and uploaded to the marketplace here
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
name: Dev PR checks
|
||||
name: PR checks
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
- main
|
||||
|
||||
jobs:
|
||||
tsc-check:
|
||||
|
|
@ -101,3 +101,13 @@ jobs:
|
|||
run: |
|
||||
cd binary
|
||||
npx tsc --noEmit
|
||||
|
||||
- name: Run core tests
|
||||
run: |
|
||||
cd core
|
||||
npm test
|
||||
|
||||
- name: Run gui tests
|
||||
run: |
|
||||
cd gui
|
||||
npm test
|
||||
2
.github/workflows/preview.yaml
vendored
2
.github/workflows/preview.yaml
vendored
|
|
@ -210,7 +210,7 @@ jobs:
|
|||
git config --local user.name "GitHub Action"
|
||||
|
||||
- name: Pull latest changes
|
||||
run: git pull origin dev
|
||||
run: git pull origin main
|
||||
|
||||
# 1. Download the artifacts
|
||||
- uses: actions/download-artifact@v4
|
||||
|
|
|
|||
1
.github/workflows/ts-check.yaml
vendored
1
.github/workflows/ts-check.yaml
vendored
|
|
@ -4,7 +4,6 @@ on:
|
|||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- preview
|
||||
|
||||
jobs:
|
||||
tsc-check:
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
- [🧑💻 Contributing Code](#-contributing-code)
|
||||
- [Environment Setup](#environment-setup)
|
||||
- [Pre-requisites](#pre-requisites)
|
||||
- [Fork the Continue Repository with All Branches](#fork-the-continue-repository-with-all-branches)
|
||||
- [Fork the Continue Repository with All Branches](#fork-the-continue-repository)
|
||||
- [VS Code](#vs-code)
|
||||
- [Debugging](#debugging)
|
||||
- [JetBrains](#jetbrains)
|
||||
|
|
@ -94,8 +94,6 @@ This will start a local server and you can see the documentation rendered in you
|
|||
|
||||
## 🧑💻 Contributing Code
|
||||
|
||||
> Please make PRs to the `dev` branch. We use this to first test changes in a pre-release version of the extension.
|
||||
|
||||
### Environment Setup
|
||||
|
||||
#### Pre-requisites
|
||||
|
|
@ -106,15 +104,15 @@ You should have Node.js version 20.11.0 (LTS) or higher installed. You can get i
|
|||
nvm use
|
||||
```
|
||||
|
||||
#### Fork the Continue Repository with All Branches
|
||||
#### Fork the Continue Repository
|
||||
|
||||
1. Go to the [Continue GitHub repository](https://github.com/continuedev/continue) and fork it to your GitHub account. **Ensure all branches are included in the fork**.
|
||||
1. Go to the [Continue GitHub repository](https://github.com/continuedev/continue) and fork it to your GitHub account.
|
||||
|
||||
2. Clone your forked repository to your local machine. Use: `git clone https://github.com/YOUR_USERNAME/continue.git`
|
||||
|
||||
3. Navigate to the cloned directory and switch to the **dev** branch. Execute: `git checkout dev`, then create your feature/fix branch from there, like so: `git checkout -b 123-my-feature-branch`
|
||||
3. Navigate to the cloned directory and make sure you are on the main branch. Create your feature/fix branch from there, like so: `git checkout -b 123-my-feature-branch`
|
||||
|
||||
4. When you're ready to submit your changes, send your pull request specifically to the **dev** branch.
|
||||
4. Send your pull request to the main branch.
|
||||
|
||||
#### VS Code
|
||||
|
||||
|
|
@ -145,7 +143,7 @@ See the [`CONTRIBUTING.md`](./extensions/intellij/CONTRIBUTING.md) for the JetBr
|
|||
|
||||
### Our Git Workflow
|
||||
|
||||
We keep two permanent branches: `main` and `dev`. All contributions should be made as pull requests to the `dev` branch. When we are ready to create a "pre-release" version, we create a tag on the `dev` branch, which automatically triggers the workflow in [preview.yaml](./.github/workflows/preview.yaml), which builds and releases a version of the VS Code extension. When a release has been sufficiently tested, we will merge its tag into the `main` branch. Creating a tag on the `main` branch will then trigger a similar workflow in [main.yaml](./.github/workflows/main.yaml), which will build and release a main release of the VS Code extension. Any hotfixes can be made by creating a feature branch from the tag for the release in question.
|
||||
We keep a single permanent branch: `main`. When we are ready to create a "pre-release" version, we create a tag on the `main` branch titled `v0.9.x-vscode`, which automatically triggers the workflow in [preview.yaml](./.github/workflows/preview.yaml), which builds and releases a version of the VS Code extension. When a release has been sufficiently tested, we will create a new release titled `v0.8.x-vscode`, triggering a similar workflow in [main.yaml](./.github/workflows/main.yaml), which will build and release a main release of the VS Code extension. Any hotfixes can be made by creating a feature branch from the tag for the release in question. This workflow is well explained by http://releaseflow.org.
|
||||
|
||||
### Formatting
|
||||
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -253,6 +255,7 @@ export class CompletionProvider {
|
|||
completionId: helper.input.completionId,
|
||||
gitRepo: await this.ide.getRepoName(helper.filepath),
|
||||
uniqueId: await this.ide.getUniqueId(),
|
||||
timestamp: Date.now(),
|
||||
...helper.options,
|
||||
};
|
||||
|
||||
|
|
@ -266,6 +269,12 @@ export class CompletionProvider {
|
|||
}
|
||||
}, 100);
|
||||
|
||||
// When using the JetBrains extension, Mark as displayed
|
||||
const ideType = (await this.ide.getIdeInfo()).ideType;
|
||||
if (ideType === "jetbrains") {
|
||||
this.markDisplayed(input.completionId, outcome);
|
||||
}
|
||||
|
||||
return outcome;
|
||||
} catch (e: any) {
|
||||
this.onError(e);
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
TODO
|
||||
|
||||
- The generator reuse thing isn't working it seems
|
||||
|
||||
Tests for context:
|
||||
|
||||
- You need a static set of files to test. Ideally you don't have to rewrite the exact same files every time you want to make a new test.
|
||||
- So put some example files in a few folders. There should be a folder for each language I think.
|
||||
- You should definitely test each of the services separately
|
||||
|
|
@ -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,6 +1,8 @@
|
|||
import { createHash } from "crypto";
|
||||
|
||||
import { LRUCache } from "lru-cache";
|
||||
import Parser from "web-tree-sitter";
|
||||
|
||||
import { IDE } from "../../..";
|
||||
import { getQueryForFile } 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", () => {
|
||||
|
|
@ -115,7 +116,7 @@ describe("lineStream", () => {
|
|||
expect(mockFullStop).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("should stop at a similar line", async () => {
|
||||
it.only("should stop at a similar line", async () => {
|
||||
const lineToTest = "const x = 6;";
|
||||
const linesGenerator = await getLineGenerator([
|
||||
"console.log();",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { distance } from "fastest-levenshtein";
|
||||
|
||||
import { DiffLine } from "../../..";
|
||||
import { LineStream } from "../../../diff/util";
|
||||
|
||||
|
|
@ -196,7 +197,7 @@ export function lineIsRepeated(a: string, b: string): boolean {
|
|||
|
||||
const aTrim = a.trim();
|
||||
const bTrim = b.trim();
|
||||
return distance(aTrim, bTrim) / bTrim.length < 0.05;
|
||||
return distance(aTrim, bTrim) / bTrim.length < 0.1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
@ -156,22 +157,23 @@ public class Calculator {
|
|||
POSTGRES_DB: mydb
|
||||
`,
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete a Markdown list with nested items",
|
||||
filename: "test.md",
|
||||
input: `
|
||||
- Item 1
|
||||
- Item 2
|
||||
- Subitem 1
|
||||
<|fim|>
|
||||
- Item 3
|
||||
`,
|
||||
llmOutput: ` - Subitem 2
|
||||
- Subitem 3
|
||||
`,
|
||||
expectedCompletion: ` - Subitem 2
|
||||
- Subitem 3`,
|
||||
},
|
||||
// TODO
|
||||
// {
|
||||
// description: "Should autocomplete a Markdown list with nested items",
|
||||
// filename: "test.md",
|
||||
// input: `
|
||||
// - Item 1
|
||||
// - Item 2
|
||||
// - Subitem 1
|
||||
// <|fim|>
|
||||
// - Item 3
|
||||
// `,
|
||||
// llmOutput: ` - Subitem 2
|
||||
// - Subitem 3
|
||||
// `,
|
||||
// expectedCompletion: ` - Subitem 2
|
||||
// - Subitem 3`,
|
||||
// },
|
||||
{
|
||||
description: "Should enforce bracket matching in JSON files",
|
||||
filename: "test.json",
|
||||
|
|
@ -374,8 +376,8 @@ button {
|
|||
border: 2px solid #000;
|
||||
border-radius<|fim|>
|
||||
}`,
|
||||
llmOutput: `: 5px;`,
|
||||
expectedCompletion: `: 5px;`,
|
||||
llmOutput: ": 5px;",
|
||||
expectedCompletion: ": 5px;",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -390,8 +392,8 @@ button {
|
|||
border-bottom-right-radius: 8px;
|
||||
}
|
||||
`,
|
||||
llmOutput: `8`,
|
||||
expectedCompletion: `8`,
|
||||
llmOutput: "8",
|
||||
expectedCompletion: "8",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -403,8 +405,8 @@ input:focus {
|
|||
border: 2px solid <|fim|>;
|
||||
}
|
||||
`,
|
||||
llmOutput: `#4CAF50;`,
|
||||
expectedCompletion: `#4CAF50;`,
|
||||
llmOutput: "#4CAF50;",
|
||||
expectedCompletion: "#4CAF50;",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -421,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",
|
||||
|
|
@ -434,8 +436,8 @@ input:focus {
|
|||
grid-gap: 10px;
|
||||
}
|
||||
`,
|
||||
llmOutput: `3, 1fr`,
|
||||
expectedCompletion: `3, 1fr`,
|
||||
llmOutput: "3, 1fr",
|
||||
expectedCompletion: "3, 1fr",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -475,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",
|
||||
},
|
||||
|
||||
|
|
@ -487,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",
|
||||
},
|
||||
{
|
||||
|
|
@ -528,8 +530,8 @@ export const Counter = () => {
|
|||
</div>
|
||||
);
|
||||
};`,
|
||||
llmOutput: `0`,
|
||||
expectedCompletion: `0`,
|
||||
llmOutput: "0",
|
||||
expectedCompletion: "0",
|
||||
filename: "Counter.tsx",
|
||||
},
|
||||
|
||||
|
|
@ -556,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",
|
||||
},
|
||||
|
||||
|
|
@ -592,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",
|
||||
},
|
||||
{
|
||||
|
|
@ -645,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",
|
||||
|
|
@ -730,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:
|
||||
|
|
@ -773,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:
|
||||
|
|
@ -789,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",
|
||||
|
|
@ -802,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",
|
||||
},
|
||||
{
|
||||
|
|
@ -815,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",
|
||||
},
|
||||
{
|
||||
|
|
@ -826,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",
|
||||
},
|
||||
|
||||
|
|
@ -873,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",
|
||||
},
|
||||
{
|
||||
|
|
@ -887,8 +889,8 @@ public class App {
|
|||
System.out.println(message);
|
||||
}
|
||||
}`,
|
||||
llmOutput: `World`,
|
||||
expectedCompletion: `World`,
|
||||
llmOutput: "World",
|
||||
expectedCompletion: "World",
|
||||
},
|
||||
{
|
||||
description:
|
||||
|
|
@ -928,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",
|
||||
|
|
@ -937,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:
|
||||
|
|
@ -947,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",
|
||||
|
|
@ -956,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",
|
||||
|
|
@ -1124,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",
|
||||
|
|
@ -1141,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",
|
||||
|
|
@ -1152,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",
|
||||
|
|
@ -1191,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",
|
||||
|
|
@ -1212,8 +1214,8 @@ class Counter {
|
|||
count = 0;
|
||||
}
|
||||
}`,
|
||||
llmOutput: `count--;`,
|
||||
expectedCompletion: `count--;`,
|
||||
llmOutput: "count--;",
|
||||
expectedCompletion: "count--;",
|
||||
},
|
||||
{
|
||||
description:
|
||||
|
|
@ -1222,8 +1224,8 @@ class Counter {
|
|||
(let [sum (+ a b)]
|
||||
(println "The sum is" sum)
|
||||
sum<|fim|>`,
|
||||
llmOutput: `))`,
|
||||
expectedCompletion: `))`,
|
||||
llmOutput: "))",
|
||||
expectedCompletion: "))",
|
||||
filename: "test.clj",
|
||||
},
|
||||
{
|
||||
|
|
@ -1235,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",
|
||||
},
|
||||
{
|
||||
|
|
@ -1247,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",
|
||||
},
|
||||
{
|
||||
|
|
@ -1272,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",
|
||||
|
|
@ -1284,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",
|
||||
|
|
@ -1299,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",
|
||||
|
|
@ -1311,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",
|
||||
|
|
@ -1322,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.\"",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1333,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\")",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1379,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;",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1399,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",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1452,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:
|
||||
|
|
@ -1489,8 +1491,8 @@ contract SimpleStorage {
|
|||
}
|
||||
}
|
||||
`,
|
||||
llmOutput: `return data;`,
|
||||
expectedCompletion: `return data;`,
|
||||
llmOutput: "return data;",
|
||||
expectedCompletion: "return data;",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1507,8 +1509,8 @@ contract EventExample {
|
|||
}
|
||||
}
|
||||
`,
|
||||
llmOutput: `id, content`,
|
||||
expectedCompletion: `id, content`,
|
||||
llmOutput: "id, content",
|
||||
expectedCompletion: "id, content",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1581,66 +1583,69 @@ 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;",
|
||||
},
|
||||
|
||||
{
|
||||
description:
|
||||
"Should handle autocomplete inside a nested TypeScript class method",
|
||||
filename: "Account.ts",
|
||||
input: `
|
||||
class Account {
|
||||
private balance: number = 0;
|
||||
// TODO
|
||||
// {
|
||||
// description:
|
||||
// "Should handle autocomplete inside a nested TypeScript class method",
|
||||
// filename: "Account.ts",
|
||||
// input: `
|
||||
// class Account {
|
||||
// private balance: number = 0;
|
||||
|
||||
deposit(amount: number) {
|
||||
this.balance += amount;
|
||||
return this.balance;
|
||||
}
|
||||
// deposit(amount: number) {
|
||||
// this.balance += amount;
|
||||
// return this.balance;
|
||||
// }
|
||||
|
||||
withdraw(amount: number) {
|
||||
if (amount > this.balance) {
|
||||
throw new Error("Insufficient funds");
|
||||
}
|
||||
this.balance -= amount;
|
||||
return thi<|fim|>
|
||||
}
|
||||
}
|
||||
`,
|
||||
llmOutput: `s.balance;`,
|
||||
expectedCompletion: `s.balance;`,
|
||||
},
|
||||
// withdraw(amount: number) {
|
||||
// if (amount > this.balance) {
|
||||
// throw new Error("Insufficient funds");
|
||||
// }
|
||||
// this.balance -= amount;
|
||||
// return thi<|fim|>
|
||||
// }
|
||||
// }
|
||||
// `,
|
||||
// llmOutput: `s.balance;`,
|
||||
// expectedCompletion: `s.balance;`,
|
||||
// },
|
||||
|
||||
{
|
||||
description: "Should autocomplete a TypeScript generic function",
|
||||
filename: "GenericFunction.ts",
|
||||
input: `
|
||||
function identity<T>(arg: T): T {
|
||||
return ar<|fim|>
|
||||
}
|
||||
// TODO
|
||||
// {
|
||||
// description: "Should autocomplete a TypeScript generic function",
|
||||
// filename: "GenericFunction.ts",
|
||||
// input: `
|
||||
// function identity<T>(arg: T): T {
|
||||
// return ar<|fim|>
|
||||
// }
|
||||
|
||||
console.log(identity<number>(5));
|
||||
`,
|
||||
llmOutput: `g;`,
|
||||
expectedCompletion: `g;`,
|
||||
},
|
||||
// console.log(identity<number>(5));
|
||||
// `,
|
||||
// llmOutput: `g;`,
|
||||
// expectedCompletion: `g;`,
|
||||
// },
|
||||
|
||||
{
|
||||
description:
|
||||
"Should autocomplete a TypeScript promise within an asynchronous function",
|
||||
filename: "asyncFunction.ts",
|
||||
input: `
|
||||
async function fetchData(url: string): Promise<unknown> {
|
||||
const response = await fetch(url);
|
||||
<|fim|>
|
||||
return data;
|
||||
}
|
||||
// TODO
|
||||
// {
|
||||
// description:
|
||||
// "Should autocomplete a TypeScript promise within an asynchronous function",
|
||||
// filename: "asyncFunction.ts",
|
||||
// input: `
|
||||
// async function fetchData(url: string): Promise<unknown> {
|
||||
// const response = await fetch(url);
|
||||
// <|fim|>
|
||||
// return data;
|
||||
// }
|
||||
|
||||
fetchData('https://api.example.com/data');
|
||||
`,
|
||||
llmOutput: `const data = await response.json();`,
|
||||
expectedCompletion: `const data = await response.json();`,
|
||||
},
|
||||
// fetchData('https://api.example.com/data');
|
||||
// `,
|
||||
// llmOutput: `const data = await response.json();`,
|
||||
// expectedCompletion: `const data = await response.json();`,
|
||||
// },
|
||||
|
||||
{
|
||||
description:
|
||||
|
|
@ -1673,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",
|
||||
|
|
@ -1692,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",
|
||||
|
|
@ -1702,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",
|
||||
|
|
@ -1717,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",
|
||||
|
|
@ -1752,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",
|
||||
|
|
@ -1772,8 +1777,8 @@ end
|
|||
|
||||
<|fim|>
|
||||
`,
|
||||
llmOutput: `end`,
|
||||
expectedCompletion: `end`,
|
||||
llmOutput: "end",
|
||||
expectedCompletion: "end",
|
||||
},
|
||||
{
|
||||
description: "Should complete F# let-binding with function definition",
|
||||
|
|
@ -1782,8 +1787,8 @@ end
|
|||
|
||||
let calculateArea length width =
|
||||
<|fim|>`,
|
||||
llmOutput: `length * width`,
|
||||
expectedCompletion: `length * width`,
|
||||
llmOutput: "length * width",
|
||||
expectedCompletion: "length * width",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1824,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",
|
||||
|
|
@ -1833,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",
|
||||
|
|
@ -1915,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);",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1933,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",
|
||||
|
|
@ -2023,8 +2028,8 @@ export default {
|
|||
};
|
||||
</script>
|
||||
`,
|
||||
llmOutput: `this.completed`,
|
||||
expectedCompletion: `this.completed`,
|
||||
llmOutput: "this.completed",
|
||||
expectedCompletion: "this.completed",
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete Svelte reactive statement",
|
||||
|
|
@ -2044,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",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -2061,8 +2066,8 @@ export default {
|
|||
<ChildComponent <|fim|> />
|
||||
</main>
|
||||
`,
|
||||
llmOutput: `name="World"`,
|
||||
expectedCompletion: `name="World"`,
|
||||
llmOutput: "name=\"World\"",
|
||||
expectedCompletion: "name=\"World\"",
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -2079,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";
|
||||
|
||||
|
|
|
|||
|
|
@ -40,4 +40,5 @@ export interface AutocompleteOutcome extends TabAutocompleteOptions {
|
|||
gitRepo?: string;
|
||||
completionId: string;
|
||||
uniqueId: string;
|
||||
timestamp: number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { CustomCommand, SlashCommand, SlashCommandDescription } from "../";
|
||||
import { stripImages } from "../llm/images";
|
||||
import { renderTemplatedString } from "../promptFiles/renderTemplatedString";
|
||||
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,8 +1,6 @@
|
|||
import GenerateTerminalCommand from "./cmd";
|
||||
import CommentSlashCommand from "./comment";
|
||||
import CommitMessageCommand from "./commit";
|
||||
import DraftIssueCommand from "./draftIssue";
|
||||
import EditSlashCommand from "./edit";
|
||||
import HttpSlashCommand from "./http";
|
||||
import MultiFileEditSlashCommand from "./multifileEdit";
|
||||
import OnboardSlashCommand from "./onboard";
|
||||
|
|
@ -13,8 +11,6 @@ export default [
|
|||
DraftIssueCommand,
|
||||
ShareSlashCommand,
|
||||
GenerateTerminalCommand,
|
||||
EditSlashCommand,
|
||||
CommentSlashCommand,
|
||||
HttpSlashCommand,
|
||||
CommitMessageCommand,
|
||||
ReviewMessageCommand,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import { SlashCommand } from "../..";
|
||||
import { getFullyQualifiedPath } from "../../../extensions/vscode/src/util/util";
|
||||
import { VsCodeIde } from "../../../extensions/vscode/src/VsCodeIde";
|
||||
import { stripImages } from "../../llm/images";
|
||||
|
||||
const MultiFileEditSlashCommand: SlashCommand = {
|
||||
|
|
@ -12,7 +10,10 @@ const MultiFileEditSlashCommand: SlashCommand = {
|
|||
selectedCode.map(async (item) => {
|
||||
// Split the range string from the filename, e.g. `filename.ts (1-2) -> [filename.ts, (1-2)]`
|
||||
const [filepath, rangeStr] = item.filepath.split(" ");
|
||||
const fullPath = getFullyQualifiedPath(ide as VsCodeIde, filepath);
|
||||
const { getFullyQualifiedPath } = await import(
|
||||
"../../../extensions/vscode/src/util/util"
|
||||
);
|
||||
const fullPath = getFullyQualifiedPath(ide as any, filepath); // any = VsCodeIde here, but importing it breaks tests
|
||||
|
||||
if (!fullPath) {
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -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,9 +1,11 @@
|
|||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { defaultConfig } from "./default";
|
||||
import { getConfigTsPath } from "../util/paths";
|
||||
|
||||
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", () => {
|
||||
test("should show only local profile", () => {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -67,14 +67,6 @@ export const defaultContextProvidersJetBrains: ContextProviderWithParams[] = [
|
|||
];
|
||||
|
||||
export const defaultSlashCommandsVscode: SlashCommandDescription[] = [
|
||||
{
|
||||
name: "edit",
|
||||
description: "Edit selected code",
|
||||
},
|
||||
{
|
||||
name: "comment",
|
||||
description: "Write comments for the selected code",
|
||||
},
|
||||
{
|
||||
name: "share",
|
||||
description: "Export the current chat session to markdown",
|
||||
|
|
@ -90,14 +82,6 @@ export const defaultSlashCommandsVscode: SlashCommandDescription[] = [
|
|||
];
|
||||
|
||||
export const defaultSlashCommandsJetBrains = [
|
||||
{
|
||||
name: "edit",
|
||||
description: "Edit selected code",
|
||||
},
|
||||
{
|
||||
name: "comment",
|
||||
description: "Write comments for the selected code",
|
||||
},
|
||||
{
|
||||
name: "share",
|
||||
description: "Export the current chat session to markdown",
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import * as JSONC from "comment-json";
|
|||
import * as fs from "fs";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
|
||||
import * as tar from "tar";
|
||||
import {
|
||||
BrowserSerializedContinueConfig,
|
||||
|
|
@ -32,6 +33,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 +44,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 +57,7 @@ import {
|
|||
getEsbuildBinaryPath,
|
||||
readAllGlobalPromptFiles,
|
||||
} from "../util/paths";
|
||||
|
||||
import {
|
||||
defaultContextProvidersJetBrains,
|
||||
defaultContextProvidersVsCode,
|
||||
|
|
@ -67,8 +71,6 @@ import {
|
|||
} from "./promptFile.js";
|
||||
import { ConfigValidationError, validateConfig } from "./validation.js";
|
||||
|
||||
import { GlobalContext } from "../util/GlobalContext";
|
||||
|
||||
export interface ConfigResult<T> {
|
||||
config: T | undefined;
|
||||
errors: ConfigValidationError[] | undefined;
|
||||
|
|
@ -194,6 +196,7 @@ async function serializedToIntermediateConfig(
|
|||
const promptFolder = initial.experimental?.promptPath;
|
||||
|
||||
if (loadPromptFiles) {
|
||||
// v1 prompt files
|
||||
let promptFiles: { path: string; content: string }[] = [];
|
||||
promptFiles = (
|
||||
await Promise.all(
|
||||
|
|
@ -245,6 +248,7 @@ async function intermediateToFinalConfig(
|
|||
uniqueId: string,
|
||||
writeLog: (log: string) => Promise<void>,
|
||||
workOsAccessToken: string | undefined,
|
||||
loadPromptFiles: boolean = true,
|
||||
allowFreeTrial: boolean = true,
|
||||
): Promise<ContinueConfig> {
|
||||
// Auto-detect models
|
||||
|
|
@ -396,6 +400,7 @@ async function intermediateToFinalConfig(
|
|||
const DEFAULT_CONTEXT_PROVIDERS = [
|
||||
new FileContextProvider({}),
|
||||
new CodebaseContextProvider(codebaseContextParams),
|
||||
...(loadPromptFiles ? [new PromptFilesContextProvider({})] : []),
|
||||
];
|
||||
|
||||
const DEFAULT_CONTEXT_PROVIDERS_TITLES = DEFAULT_CONTEXT_PROVIDERS.map(
|
||||
|
|
|
|||
|
|
@ -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,16 @@
|
|||
import Handlebars from "handlebars";
|
||||
import path from "path";
|
||||
|
||||
import Handlebars from "handlebars";
|
||||
import * as YAML from "yaml";
|
||||
import type { IDE, SlashCommand } from "..";
|
||||
|
||||
import { BaseContextProvider } from "../context";
|
||||
import { walkDir } from "../indexing/walkDir";
|
||||
import { stripImages } from "../llm/images";
|
||||
import { renderTemplatedString } from "../promptFiles/renderTemplatedString";
|
||||
import { renderTemplatedString } from "../promptFiles/v1/renderTemplatedString";
|
||||
import { getBasename } from "../util/index";
|
||||
|
||||
import type { ChatHistory, ChatHistoryItem, ChatMessage, ContextItem, ContinueSDK, IContextProvider, IDE, SlashCommand } from "..";
|
||||
|
||||
export const DEFAULT_PROMPTS_FOLDER = ".prompts";
|
||||
|
||||
export async function getPromptFiles(
|
||||
|
|
@ -147,28 +151,32 @@ function extractUserInput(input: string, commandName: string): string {
|
|||
return input;
|
||||
}
|
||||
|
||||
async function renderPrompt(prompt: string, context: any, userInput: string) {
|
||||
async function renderPrompt(prompt: string, context: ContinueSDK, userInput: string) {
|
||||
const helpers = getContextProviderHelpers(context);
|
||||
|
||||
// A few context providers that don't need to be in config.json to work in .prompt files
|
||||
const diff = await context.ide.getDiff(false);
|
||||
const currentFilePath = await context.ide.getCurrentFile();
|
||||
const currentFile = currentFilePath
|
||||
? await context.ide.readFile(currentFilePath)
|
||||
: undefined;
|
||||
const currentFile = await context.ide.getCurrentFile();
|
||||
const inputData: Record<string, string> = {
|
||||
diff,
|
||||
input: userInput,
|
||||
};
|
||||
if (currentFile) {
|
||||
inputData.currentFile = currentFile.path;
|
||||
}
|
||||
|
||||
return renderTemplatedString(
|
||||
prompt,
|
||||
context.ide.readFile.bind(context.ide),
|
||||
{ diff, currentFile, input: userInput },
|
||||
inputData,
|
||||
helpers,
|
||||
);
|
||||
}
|
||||
|
||||
function getContextProviderHelpers(
|
||||
context: any,
|
||||
context: ContinueSDK,
|
||||
): Array<[string, Handlebars.HelperDelegate]> | undefined {
|
||||
return context.config.contextProviders?.map((provider: any) => [
|
||||
return context.config.contextProviders?.map((provider: IContextProvider) => [
|
||||
provider.description.title,
|
||||
async (helperContext: any) => {
|
||||
const items = await provider.getContextItems(helperContext, {
|
||||
|
|
@ -182,16 +190,16 @@ function getContextProviderHelpers(
|
|||
selectedCode: context.selectedCode,
|
||||
});
|
||||
|
||||
items.forEach((item: any) =>
|
||||
items.forEach((item) =>
|
||||
context.addContextItem(createContextItem(item, provider)),
|
||||
);
|
||||
|
||||
return items.map((item: any) => item.content).join("\n\n");
|
||||
return items.map((item) => item.content).join("\n\n");
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
function createContextItem(item: any, provider: any) {
|
||||
function createContextItem(item: ContextItem, provider: IContextProvider) {
|
||||
return {
|
||||
...item,
|
||||
id: {
|
||||
|
|
@ -202,7 +210,7 @@ function createContextItem(item: any, provider: any) {
|
|||
}
|
||||
|
||||
function updateChatHistory(
|
||||
history: any[],
|
||||
history: ChatMessage[],
|
||||
commandName: string,
|
||||
renderedPrompt: string,
|
||||
systemMessage?: string,
|
||||
|
|
|
|||
|
|
@ -463,7 +463,11 @@ declare global {
|
|||
stepIndex: number,
|
||||
): Promise<void>;
|
||||
getOpenFiles(): Promise<string[]>;
|
||||
getCurrentFile(): Promise<string | undefined>;
|
||||
getCurrentFile(): Promise<undefined | {
|
||||
isUntitled: boolean
|
||||
path: string
|
||||
contents: string
|
||||
}>;
|
||||
getPinnedFiles(): Promise<string[]>;
|
||||
getSearchResults(query: string): Promise<string>;
|
||||
subprocess(command: string): Promise<[string, string]>;
|
||||
|
|
@ -538,6 +542,7 @@ declare global {
|
|||
| "folder"
|
||||
| "jira"
|
||||
| "postgres"
|
||||
| "mssql"
|
||||
| "database"
|
||||
| "code"
|
||||
| "docs"
|
||||
|
|
@ -623,6 +628,11 @@ declare global {
|
|||
| "mistral-large-latest"
|
||||
| "mistral-7b"
|
||||
| "mistral-8x7b"
|
||||
| "mistral-8x22b"
|
||||
| "mistral-tiny"
|
||||
| "mistral-small"
|
||||
| "mistral-medium"
|
||||
| "mistral-nemo"
|
||||
// Llama 2
|
||||
| "llama2-7b"
|
||||
| "llama2-13b"
|
||||
|
|
@ -636,6 +646,8 @@ declare global {
|
|||
| "llama3-70b"
|
||||
// Other Open-source
|
||||
| "phi2"
|
||||
| "phi-3-mini"
|
||||
| "phi-3-medium"
|
||||
| "phind-codellama-34b"
|
||||
| "wizardcoder-7b"
|
||||
| "wizardcoder-13b"
|
||||
|
|
@ -644,9 +656,12 @@ declare global {
|
|||
| "codeup-13b"
|
||||
| "deepseek-7b"
|
||||
| "deepseek-33b"
|
||||
| "deepseek-2-lite"
|
||||
| "neural-chat-7b"
|
||||
| "gemma-7b-it"
|
||||
| "gemma2-2b-it"
|
||||
| "gemma2-9b-it"
|
||||
| "olmo-7b"
|
||||
// Anthropic
|
||||
| "claude-3-5-sonnet-latest"
|
||||
| "claude-3-5-sonnet-20240620"
|
||||
|
|
@ -664,10 +679,6 @@ declare global {
|
|||
| "gemini-1.5-pro"
|
||||
| "gemini-1.5-flash-latest"
|
||||
| "gemini-1.5-flash"
|
||||
// Mistral
|
||||
| "mistral-tiny"
|
||||
| "mistral-small"
|
||||
| "mistral-medium"
|
||||
// Tab autocomplete
|
||||
| "deepseek-1b"
|
||||
| "starcoder-1b"
|
||||
|
|
@ -730,6 +741,7 @@ declare global {
|
|||
stop?: string[];
|
||||
maxTokens?: number;
|
||||
numThreads?: number;
|
||||
useMmap?: boolean;
|
||||
keepAlive?: number;
|
||||
raw?: boolean;
|
||||
stream?: boolean;
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
@ -24,17 +24,15 @@ class CurrentFileContextProvider extends BaseContextProvider {
|
|||
if (!currentFile) {
|
||||
return [];
|
||||
}
|
||||
const contents = await ide.readFile(currentFile);
|
||||
const baseName = getBasename(currentFile.path);
|
||||
return [
|
||||
{
|
||||
description: currentFile,
|
||||
content: `This is the currently open file:\n\n\`\`\`${getBasename(
|
||||
currentFile,
|
||||
)}\n${contents}\n\`\`\``,
|
||||
name: getBasename(currentFile),
|
||||
description: currentFile.path,
|
||||
content: `This is the currently open file:\n\n\`\`\`${baseName}\n${currentFile.contents}\n\`\`\``,
|
||||
name: baseName,
|
||||
uri: {
|
||||
type: "file",
|
||||
value: currentFile,
|
||||
value: currentFile.path,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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,7 +1,8 @@
|
|||
import { RequestOptions } from "../../../";
|
||||
// @ts-ignore
|
||||
import adf2md from "adf-to-md";
|
||||
|
||||
import { RequestOptions } from "../../../";
|
||||
|
||||
interface JiraClientOptions {
|
||||
domain: string;
|
||||
username: 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,
|
||||
|
|
|
|||
56
core/context/providers/PromptFilesContextProvider.ts
Normal file
56
core/context/providers/PromptFilesContextProvider.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import { BaseContextProvider } from "..";
|
||||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
ContextProviderExtras,
|
||||
ContextSubmenuItem,
|
||||
LoadSubmenuItemsArgs,
|
||||
} from "../../";
|
||||
import { getAllPromptFilesV2 } from "../../promptFiles/v2/getPromptFiles";
|
||||
import { parsePreamble } from "../../promptFiles/v2/parse";
|
||||
import { renderPromptFileV2 } from "../../promptFiles/v2/renderPromptFile";
|
||||
|
||||
class PromptFilesContextProvider extends BaseContextProvider {
|
||||
static description: ContextProviderDescription = {
|
||||
title: "prompt-files",
|
||||
displayTitle: "Prompt Files",
|
||||
description: ".prompt files",
|
||||
type: "submenu",
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> {
|
||||
const rawContent = await extras.ide.readFile(query);
|
||||
const preamble = parsePreamble(query, rawContent);
|
||||
const [contextItems, body] = await renderPromptFileV2(rawContent, extras);
|
||||
return [
|
||||
...contextItems,
|
||||
{
|
||||
content: body,
|
||||
name: preamble.name,
|
||||
description: preamble.description,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
async loadSubmenuItems(
|
||||
args: LoadSubmenuItemsArgs,
|
||||
): Promise<ContextSubmenuItem[]> {
|
||||
const promptFiles = await getAllPromptFilesV2(
|
||||
args.ide,
|
||||
args.config.experimental?.promptPath,
|
||||
);
|
||||
return promptFiles.map((file) => {
|
||||
const preamble = parsePreamble(file.path, file.content);
|
||||
return {
|
||||
id: file.path,
|
||||
title: preamble.name,
|
||||
description: preamble.description,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default PromptFilesContextProvider;
|
||||
|
|
@ -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,9 +1,11 @@
|
|||
import { BaseContextProvider } from "../";
|
||||
import { ContextProviderName } from "../../";
|
||||
|
||||
import CodeContextProvider from "./CodeContextProvider";
|
||||
import ContinueProxyContextProvider from "./ContinueProxyContextProvider";
|
||||
import CurrentFileContextProvider from "./CurrentFileContextProvider";
|
||||
import DatabaseContextProvider from "./DatabaseContextProvider";
|
||||
import DebugLocalsProvider from "./DebugLocalsProvider";
|
||||
import DiffContextProvider from "./DiffContextProvider";
|
||||
import DiscordContextProvider from "./DiscordContextProvider";
|
||||
import DocsContextProvider from "./DocsContextProvider";
|
||||
|
|
@ -15,9 +17,8 @@ import GoogleContextProvider from "./GoogleContextProvider";
|
|||
import GreptileContextProvider from "./GreptileContextProvider";
|
||||
import HttpContextProvider from "./HttpContextProvider";
|
||||
import JiraIssuesContextProvider from "./JiraIssuesContextProvider/";
|
||||
import DebugLocalsProvider from "./DebugLocalsProvider";
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ const modelDescriptionSchema = z.object({
|
|||
stop: z.array(z.string()).optional(),
|
||||
maxTokens: z.number().optional(),
|
||||
numThreads: z.number().optional(),
|
||||
useMmap: z.boolean().optional(),
|
||||
keepAlive: z.number().optional(),
|
||||
raw: z.boolean().optional(),
|
||||
stream: z.boolean().optional(),
|
||||
|
|
|
|||
25
core/core.ts
25
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 {
|
||||
|
|
@ -10,7 +11,6 @@ import {
|
|||
setupLocalConfigAfterFreeTrial,
|
||||
setupQuickstartConfig,
|
||||
} from "./config/onboarding";
|
||||
import { createNewPromptFile } from "./config/promptFile";
|
||||
import { addModel, addOpenAIKey, deleteModel } from "./config/util";
|
||||
import { recentlyEditedFilesCache } from "./context/retrieval/recentlyEditedFilesCache";
|
||||
import { ContinueServerClient } from "./continueServer/stubs/client";
|
||||
|
|
@ -21,18 +21,21 @@ import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer";
|
|||
import DocsService from "./indexing/docs/DocsService";
|
||||
import { defaultIgnoreFile } from "./indexing/ignore.js";
|
||||
import Ollama from "./llm/llms/Ollama";
|
||||
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
||||
import { GlobalContext } from "./util/GlobalContext";
|
||||
import { createNewPromptFileV2 } from "./promptFiles/v2/createNewPromptFile";
|
||||
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;
|
||||
|
|
@ -80,7 +83,7 @@ export class Core {
|
|||
constructor(
|
||||
private readonly messenger: IMessenger<ToCoreProtocol, FromCoreProtocol>,
|
||||
private readonly ide: IDE,
|
||||
private readonly onWrite: (text: string) => Promise<void> = async () => {},
|
||||
private readonly onWrite: (text: string) => Promise<void> = async () => { },
|
||||
) {
|
||||
// Ensure .continue directory is created
|
||||
setupInitialDotContinueDirectory();
|
||||
|
|
@ -171,7 +174,7 @@ export class Core {
|
|||
this.configHandler,
|
||||
ide,
|
||||
getLlm,
|
||||
(e) => {},
|
||||
(e) => { },
|
||||
(..._) => Promise.resolve([]),
|
||||
);
|
||||
|
||||
|
|
@ -248,11 +251,11 @@ export class Core {
|
|||
});
|
||||
|
||||
on("config/newPromptFile", async (msg) => {
|
||||
void createNewPromptFile(
|
||||
await createNewPromptFileV2(
|
||||
this.ide,
|
||||
(await this.config()).experimental?.promptPath,
|
||||
);
|
||||
void this.configHandler.reloadConfig();
|
||||
await this.configHandler.reloadConfig();
|
||||
});
|
||||
|
||||
on("config/reload", (msg) => {
|
||||
|
|
@ -681,7 +684,7 @@ export class Core {
|
|||
await codebaseIndexer.clearIndexes();
|
||||
}
|
||||
|
||||
const dirs = data?.dir ? [data.dir] : await this.ide.getWorkspaceDirs();
|
||||
const dirs = data?.dirs ?? await this.ide.getWorkspaceDirs();
|
||||
await this.refreshCodebaseIndex(dirs);
|
||||
});
|
||||
on("index/setPaused", (msg) => {
|
||||
|
|
|
|||
|
|
@ -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,10 @@
|
|||
import fs from "node:fs";
|
||||
import { streamDiff } from "../diff/streamDiff.js";
|
||||
import { DiffLine, DiffLineType } from "../index.js";
|
||||
import path from "node:path";
|
||||
|
||||
// @ts-ignore no typings available
|
||||
import { changed, diff as myersDiff } from "myers-diff";
|
||||
import path from "node:path";
|
||||
import { streamDiff } from "../diff/streamDiff.js";
|
||||
import { DiffLine, DiffLineType } from "../index.js";
|
||||
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,8 +1,8 @@
|
|||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
// @ts-ignore no typings available
|
||||
import { diff as myersDiff } from "myers-diff";
|
||||
import path from "node:path";
|
||||
import { DiffLine } from "../..";
|
||||
import { myersDiff as continueMyersDiff } from "../../diff/myers";
|
||||
import { dedent } from "../../util";
|
||||
|
|
@ -127,11 +127,11 @@ describe("deterministicApplyLazyEdit(", () => {
|
|||
await expectDiff("calculator-comments.js");
|
||||
});
|
||||
|
||||
test("calculator docstrings", async () => {
|
||||
test.skip("calculator docstrings", async () => {
|
||||
await expectDiff("calculator-docstrings.js");
|
||||
});
|
||||
|
||||
test("calculator stateless", async () => {
|
||||
test.skip("calculator stateless", async () => {
|
||||
await expectDiff("calculator-stateless.js");
|
||||
});
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ describe("deterministicApplyLazyEdit(", () => {
|
|||
await expectDiff("no-lazy.js");
|
||||
});
|
||||
|
||||
test("no lazy blocks in single top level class", async () => {
|
||||
test.skip("no lazy blocks in single top level class", async () => {
|
||||
await expectDiff("no-lazy-single-class.js");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
|
|
|
|||
18
core/index.d.ts
vendored
18
core/index.d.ts
vendored
|
|
@ -494,7 +494,14 @@ export interface IDE {
|
|||
stepIndex: number,
|
||||
): Promise<void>;
|
||||
getOpenFiles(): Promise<string[]>;
|
||||
getCurrentFile(): Promise<string | undefined>;
|
||||
getCurrentFile(): Promise<
|
||||
| undefined
|
||||
| {
|
||||
isUntitled: boolean;
|
||||
path: string;
|
||||
contents: string;
|
||||
}
|
||||
>;
|
||||
getPinnedFiles(): Promise<string[]>;
|
||||
getSearchResults(query: string): Promise<string>;
|
||||
subprocess(command: string, cwd?: string): Promise<[string, string]>;
|
||||
|
|
@ -673,10 +680,12 @@ export type ModelName =
|
|||
| "mistral-large-latest"
|
||||
| "mistral-7b"
|
||||
| "mistral-8x7b"
|
||||
| "mistral-8x22b"
|
||||
| "mistral-tiny"
|
||||
| "mistral-small"
|
||||
| "mistral-medium"
|
||||
| "mistral-embed"
|
||||
| "mistral-nemo"
|
||||
// Llama 2
|
||||
| "llama2-7b"
|
||||
| "llama2-13b"
|
||||
|
|
@ -701,6 +710,8 @@ export type ModelName =
|
|||
| "grok-beta"
|
||||
// Other Open-source
|
||||
| "phi2"
|
||||
| "phi-3-mini"
|
||||
| "phi-3-medium"
|
||||
| "phind-codellama-34b"
|
||||
| "wizardcoder-7b"
|
||||
| "wizardcoder-13b"
|
||||
|
|
@ -709,9 +720,13 @@ export type ModelName =
|
|||
| "codeup-13b"
|
||||
| "deepseek-7b"
|
||||
| "deepseek-33b"
|
||||
| "deepseek-2-lite"
|
||||
| "neural-chat-7b"
|
||||
| "gemma-7b-it"
|
||||
| "gemma2-2b-it"
|
||||
| "gemma2-9b-it"
|
||||
| "olmo-7b"
|
||||
| "qwen-coder2.5-7b"
|
||||
// Anthropic
|
||||
| "claude-3-5-sonnet-latest"
|
||||
| "claude-3-5-sonnet-20240620"
|
||||
|
|
@ -801,6 +816,7 @@ interface BaseCompletionOptions {
|
|||
stop?: string[];
|
||||
maxTokens?: number;
|
||||
numThreads?: number;
|
||||
useMmap?: boolean;
|
||||
keepAlive?: number;
|
||||
raw?: boolean;
|
||||
stream?: boolean;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
import { jest } from "@jest/globals";
|
||||
|
||||
import { testIde } from "../test/util/fixtures";
|
||||
import {
|
||||
insertMockChunks,
|
||||
updateIndexAndAwaitGenerator,
|
||||
mockPathAndCacheKey,
|
||||
updateIndexAndAwaitGenerator,
|
||||
} from "../test/util/indexing";
|
||||
|
||||
import { CodeSnippetsCodebaseIndex } from "./CodeSnippetsIndex";
|
||||
import { DatabaseConnection, SqliteDb } from "./refreshIndex";
|
||||
import { IndexResultType } from "./types";
|
||||
|
||||
describe("CodeSnippetsCodebaseIndex", () => {
|
||||
describe.skip("CodeSnippetsCodebaseIndex", () => {
|
||||
let index: CodeSnippetsCodebaseIndex;
|
||||
let db: DatabaseConnection;
|
||||
|
||||
|
|
|
|||
|
|
@ -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,14 +1,16 @@
|
|||
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";
|
||||
|
||||
describe("FullTextSearchCodebaseIndex", () => {
|
||||
describe.skip("FullTextSearchCodebaseIndex", () => {
|
||||
let index: FullTextSearchCodebaseIndex;
|
||||
let db: DatabaseConnection;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { jest } from "@jest/globals";
|
||||
import lance from "vectordb";
|
||||
|
||||
import { testConfigHandler, testIde } from "../test/util/fixtures";
|
||||
import {
|
||||
mockPathAndCacheKey,
|
||||
|
|
@ -8,13 +9,14 @@ import {
|
|||
updateIndexAndAwaitGenerator,
|
||||
} from "../test/util/indexing";
|
||||
import { getLanceDbPath } from "../util/paths";
|
||||
|
||||
import { LanceDbIndex } from "./LanceDbIndex";
|
||||
import { DatabaseConnection, SqliteDb } from "./refreshIndex";
|
||||
import { IndexResultType } from "./types";
|
||||
|
||||
jest.useFakeTimers();
|
||||
|
||||
describe("ChunkCodebaseIndex", () => {
|
||||
describe.skip("ChunkCodebaseIndex", () => {
|
||||
let index: LanceDbIndex;
|
||||
let sqliteDb: DatabaseConnection;
|
||||
let lanceDb: lance.Connection;
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue