diff --git a/.changes/extensions/vscode/0.8.56.md b/.changes/extensions/vscode/0.8.56.md new file mode 100644 index 000000000..d1c81fd34 --- /dev/null +++ b/.changes/extensions/vscode/0.8.56.md @@ -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 diff --git a/.changes/unreleased/Added-20241102-002724.yaml b/.changes/unreleased/Added-20241102-002724.yaml deleted file mode 100644 index 3426d6546..000000000 --- a/.changes/unreleased/Added-20241102-002724.yaml +++ /dev/null @@ -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 diff --git a/.changes/unreleased/Added-20241102-002744.yaml b/.changes/unreleased/Added-20241102-002744.yaml deleted file mode 100644 index b7d894747..000000000 --- a/.changes/unreleased/Added-20241102-002744.yaml +++ /dev/null @@ -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 diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index dce9178bf..4e7157e67 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -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 diff --git a/.github/workflows/README.md b/.github/workflows/README.md deleted file mode 100644 index ff1b7bd22..000000000 --- a/.github/workflows/README.md +++ /dev/null @@ -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 diff --git a/.github/workflows/dev_pr.yaml b/.github/workflows/pr_checks.yaml similarity index 92% rename from .github/workflows/dev_pr.yaml rename to .github/workflows/pr_checks.yaml index 12607a0b9..a879c3d9d 100644 --- a/.github/workflows/dev_pr.yaml +++ b/.github/workflows/pr_checks.yaml @@ -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 diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index fbc69b64f..a65e79c7f 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -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 diff --git a/.github/workflows/ts-check.yaml b/.github/workflows/ts-check.yaml index 97bc39d7c..5f16c406c 100644 --- a/.github/workflows/ts-check.yaml +++ b/.github/workflows/ts-check.yaml @@ -4,7 +4,6 @@ on: pull_request: branches: - main - - preview jobs: tsc-check: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d1ca16637..c2d8bb49d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/core/autocomplete/CompletionProvider.ts b/core/autocomplete/CompletionProvider.ts index cb162043a..24815f501 100644 --- a/core/autocomplete/CompletionProvider.ts +++ b/core/autocomplete/CompletionProvider.ts @@ -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); diff --git a/core/autocomplete/READEME.md b/core/autocomplete/READEME.md deleted file mode 100644 index d5e822273..000000000 --- a/core/autocomplete/READEME.md +++ /dev/null @@ -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 diff --git a/core/autocomplete/constants/AutocompleteLanguageInfo.ts b/core/autocomplete/constants/AutocompleteLanguageInfo.ts index 18bbf2ff9..ccd5a9717 100644 --- a/core/autocomplete/constants/AutocompleteLanguageInfo.ts +++ b/core/autocomplete/constants/AutocompleteLanguageInfo.ts @@ -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: [], }; diff --git a/core/autocomplete/constructPrompt.ts b/core/autocomplete/constructPrompt.ts index 2c5d43f42..f15b1c4e1 100644 --- a/core/autocomplete/constructPrompt.ts +++ b/core/autocomplete/constructPrompt.ts @@ -1,4 +1,5 @@ import { Position, Range } from "../index.js"; + import { ContextRetrievalService } from "./context/ContextRetrievalService.js"; import { fillPromptWithSnippets, diff --git a/core/autocomplete/context/ContextRetrievalService.ts b/core/autocomplete/context/ContextRetrievalService.ts index a12d1962e..24f6e9182 100644 --- a/core/autocomplete/context/ContextRetrievalService.ts +++ b/core/autocomplete/context/ContextRetrievalService.ts @@ -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"; diff --git a/core/autocomplete/context/NearbyDefinitionsService.ts b/core/autocomplete/context/NearbyDefinitionsService.ts index 6e4cece83..8b526b261 100644 --- a/core/autocomplete/context/NearbyDefinitionsService.ts +++ b/core/autocomplete/context/NearbyDefinitionsService.ts @@ -1,5 +1,6 @@ import { IDE, Location } from "../.."; import { LANGUAGES } from "../constants/AutocompleteLanguageInfo"; + import { getSymbolsForSnippet } from "./ranking"; interface FileInfo { diff --git a/core/autocomplete/context/ranking/slidingWindow.ts b/core/autocomplete/context/ranking/slidingWindow.ts index 54ec763f2..7b650eb44 100644 --- a/core/autocomplete/context/ranking/slidingWindow.ts +++ b/core/autocomplete/context/ranking/slidingWindow.ts @@ -1,4 +1,5 @@ import { RangeInFileWithContents } from "../../../commands/util.js"; + import { AutocompleteSnippet, jaccardSimilarity } from "./index.js"; function* slidingWindow( diff --git a/core/autocomplete/context/root-path-context/RootPathContextService.ts b/core/autocomplete/context/root-path-context/RootPathContextService.ts index ad7918084..b381f2166 100644 --- a/core/autocomplete/context/root-path-context/RootPathContextService.ts +++ b/core/autocomplete/context/root-path-context/RootPathContextService.ts @@ -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"; diff --git a/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts b/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts index 8d7f3e23f..5576ee26b 100644 --- a/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts +++ b/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts @@ -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, diff --git a/core/autocomplete/filtering/streamTransforms/lineStream.test.ts b/core/autocomplete/filtering/streamTransforms/lineStream.test.ts index 810ab9eec..0a99a5a91 100644 --- a/core/autocomplete/filtering/streamTransforms/lineStream.test.ts +++ b/core/autocomplete/filtering/streamTransforms/lineStream.test.ts @@ -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();", diff --git a/core/autocomplete/filtering/streamTransforms/lineStream.ts b/core/autocomplete/filtering/streamTransforms/lineStream.ts index 0f49cea55..8c7936e2d 100644 --- a/core/autocomplete/filtering/streamTransforms/lineStream.ts +++ b/core/autocomplete/filtering/streamTransforms/lineStream.ts @@ -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; } /** diff --git a/core/autocomplete/filtering/test/filter.test.ts b/core/autocomplete/filtering/test/filter.test.ts index 62ef65512..b2e025a4b 100644 --- a/core/autocomplete/filtering/test/filter.test.ts +++ b/core/autocomplete/filtering/test/filter.test.ts @@ -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)) { diff --git a/core/autocomplete/filtering/test/testCases.ts b/core/autocomplete/filtering/test/testCases.ts index 683dbc7bc..406faf66f 100644 --- a/core/autocomplete/filtering/test/testCases.ts +++ b/core/autocomplete/filtering/test/testCases.ts @@ -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 = () => { ); };`, - llmOutput: `0`, - expectedCompletion: `0`, + llmOutput: "0", + expectedCompletion: "0", filename: "Counter.tsx", }, @@ -556,8 +558,8 @@ export const Timer = () => { ); };`, - 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() {
<|fim|>