From 16571200fd6bc4469ee6bbd8018979a61a04ab89 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 5 Dec 2024 15:17:07 -0800 Subject: [PATCH 01/29] Update context-providers.md --- docs/docs/customize/context-providers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/customize/context-providers.md b/docs/docs/customize/context-providers.md index 2c7708cac..024786e14 100644 --- a/docs/docs/customize/context-providers.md +++ b/docs/docs/customize/context-providers.md @@ -444,7 +444,7 @@ Available connection types: ### `@Debugger` -Reference the contents of the local variables in the debugger. +Reference the contents of the local variables in the debugger. Currently only available in VS Code. ```json title="config.json" { From 100be30b413cca4c82fef05940865ac659d422d1 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 08:37:31 -0800 Subject: [PATCH 02/29] test macos-14 --- .github/workflows/main.yaml | 4 +- .github/workflows/preview.yaml | 167 +++++++++++++++++---------------- 2 files changed, 87 insertions(+), 84 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b73cdb3ad..f54d7bbe4 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -49,11 +49,11 @@ jobs: platform: alpine arch: x64 npm_config_arch: x64 - - os: macos-12 # should migrate this to the newer x64 version of macos-14 + - os: macos-14 platform: darwin arch: x64 npm_config_arch: x64 - - os: macos-12 # same here, especially + - os: macos-14 # same here, especially platform: darwin arch: arm64 npm_config_arch: arm64 diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index a65e79c7f..7f50f37bf 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -1,8 +1,11 @@ name: Publish Preview Extension on: - release: - types: [prereleased] + push: + branches: + - nate/mac-14-ci + # release: + # types: [prereleased] jobs: check_release_name: @@ -49,11 +52,11 @@ jobs: platform: alpine arch: x64 npm_config_arch: x64 - - os: macos-12 # should migrate this to the newer x64 version of macos-14 + - os: macos-14 platform: darwin arch: x64 npm_config_arch: x64 - - os: macos-12 # same here, especially + - os: macos-14 platform: darwin arch: arm64 npm_config_arch: arm64 @@ -161,93 +164,93 @@ jobs: name: ${{ env.target }}-vsix path: "extensions/vscode/*.vsix" - release: - permissions: - contents: write - runs-on: ubuntu-latest - needs: - - build - steps: - - name: Checkout - uses: actions/checkout@v4 + # release: + # permissions: + # contents: write + # runs-on: ubuntu-latest + # needs: + # - build + # steps: + # - name: Checkout + # uses: actions/checkout@v4 - - name: Set up Git - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" + # - name: Set up Git + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" - # Download the .vsix artifacts - - uses: actions/download-artifact@v4 - with: - pattern: "*-vsix" - path: vsix-artifacts - merge-multiple: true + # # Download the .vsix artifacts + # - uses: actions/download-artifact@v4 + # with: + # pattern: "*-vsix" + # path: vsix-artifacts + # merge-multiple: true - - name: Release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ github.ref_name }} - files: | - vsix-artifacts/*.vsix - token: ${{ secrets.CI_GITHUB_TOKEN }} - repository: continuedev/continue - prerelease: true + # - name: Release + # uses: softprops/action-gh-release@v2 + # with: + # tag_name: ${{ github.ref_name }} + # files: | + # vsix-artifacts/*.vsix + # token: ${{ secrets.CI_GITHUB_TOKEN }} + # repository: continuedev/continue + # prerelease: true - publish: - runs-on: ubuntu-latest - needs: - - build - permissions: - contents: write - steps: - # 0. Setup git - - name: Checkout - uses: actions/checkout@v4 + # publish: + # runs-on: ubuntu-latest + # needs: + # - build + # permissions: + # contents: write + # steps: + # # 0. Setup git + # - name: Checkout + # uses: actions/checkout@v4 - - name: Set up Git - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" + # - name: Set up Git + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" - - name: Pull latest changes - run: git pull origin main + # - name: Pull latest changes + # run: git pull origin main - # 1. Download the artifacts - - uses: actions/download-artifact@v4 - with: - pattern: "*-vsix" - path: vsix-artifacts - merge-multiple: true + # # 1. Download the artifacts + # - uses: actions/download-artifact@v4 + # with: + # pattern: "*-vsix" + # path: vsix-artifacts + # merge-multiple: true - # 2. Publish the extension to VS Code Marketplace - - name: Publish to VS Code Marketplace - run: | - cd extensions/vscode - npx vsce publish --pre-release --packagePath ../../vsix-artifacts/*.vsix - env: - VSCE_PAT: ${{ secrets.VSCE_TOKEN }} + # # 2. Publish the extension to VS Code Marketplace + # - name: Publish to VS Code Marketplace + # run: | + # cd extensions/vscode + # npx vsce publish --pre-release --packagePath ../../vsix-artifacts/*.vsix + # env: + # VSCE_PAT: ${{ secrets.VSCE_TOKEN }} - # 3. Publish the extension to Open VSX Registry - - name: Publish (Open VSX Registry) - continue-on-error: true - run: | - cd extensions/vscode - npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix + # # 3. Publish the extension to Open VSX Registry + # - name: Publish (Open VSX Registry) + # continue-on-error: true + # run: | + # cd extensions/vscode + # npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix - # 4. Update the package.json version and push changes - # - name: Update version in package.json - # run: | - # cd extensions/vscode - # npm version patch + # 4. Update the package.json version and push changes + # - name: Update version in package.json + # run: | + # cd extensions/vscode + # npm version patch - # - name: Commit changes - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" - # git commit -am "💚 Update package.json version [skip ci]" + # - name: Commit changes + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" + # git commit -am "💚 Update package.json version [skip ci]" - # - name: Push changes - # uses: ad-m/github-push-action@master - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # branch: ${{ github.ref }} + # - name: Push changes + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # branch: ${{ github.ref }} From 8d5030c1038ddbcf31b0bc0bef1224b2a89fbfce Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 09:10:40 -0800 Subject: [PATCH 03/29] don't check release name --- .github/workflows/preview.yaml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 7f50f37bf..18e6161c4 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -8,23 +8,23 @@ on: # types: [prereleased] jobs: - check_release_name: - runs-on: ubuntu-latest - outputs: - should_run: ${{ steps.check.outputs.should_run }} - steps: - - id: check - working-directory: . - run: | - if [[ "${{ github.event.release.tag_name }}" == v0.9.*-vscode ]]; then - echo "should_run=true" >> $GITHUB_OUTPUT - else - echo "should_run=false" >> $GITHUB_OUTPUT - fi + # check_release_name: + # runs-on: ubuntu-latest + # outputs: + # should_run: ${{ steps.check.outputs.should_run }} + # steps: + # - id: check + # working-directory: . + # run: | + # if [[ "${{ github.event.release.tag_name }}" == v0.9.*-vscode ]]; then + # echo "should_run=true" >> $GITHUB_OUTPUT + # else + # echo "should_run=false" >> $GITHUB_OUTPUT + # fi build: - needs: check_release_name - if: needs.check_release_name.outputs.should_run == 'true' + # needs: check_release_name + # if: needs.check_release_name.outputs.should_run == 'true' strategy: matrix: include: From a5db0d46ae656dd04bf2150e74c0cc7885d81084 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Fri, 6 Dec 2024 11:01:59 -0800 Subject: [PATCH 04/29] Update Chat.tsx --- gui/src/pages/gui/Chat.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index db0367969..8545813bc 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -341,7 +341,7 @@ export function Chat() { <> {isInEditMode && ( { loadLastSession().catch((e) => console.error(`Failed to load last session: ${e}`), From 9e41fa1e678d165ae5554ffdb292ec7c0ba759eb Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 13:44:29 -0800 Subject: [PATCH 05/29] use 13 --- .github/workflows/main.yaml | 4 ++-- .github/workflows/preview.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f54d7bbe4..ae0359027 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -49,11 +49,11 @@ jobs: platform: alpine arch: x64 npm_config_arch: x64 - - os: macos-14 + - os: macos-13 platform: darwin arch: x64 npm_config_arch: x64 - - os: macos-14 # same here, especially + - os: macos-13 platform: darwin arch: arm64 npm_config_arch: arm64 diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 18e6161c4..9a3604f09 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -52,11 +52,11 @@ jobs: platform: alpine arch: x64 npm_config_arch: x64 - - os: macos-14 + - os: macos-13 platform: darwin arch: x64 npm_config_arch: x64 - - os: macos-14 + - os: macos-13 platform: darwin arch: arm64 npm_config_arch: arm64 From 608a157ef5742df182339749a67652adcdf50e58 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Thu, 5 Dec 2024 16:41:22 -0800 Subject: [PATCH 06/29] test: add utils --- core/autocomplete/filtering/test/util.ts | 4 +- core/index.d.ts | 1 + core/llm/llms/Mock.ts | 4 +- core/llm/llms/Test.ts | 39 +++++++++ core/llm/llms/index.ts | 6 +- extensions/vscode/e2e/GUI.test.ts | 86 ------------------- extensions/vscode/e2e/actions/GUI.actions.ts | 58 +++++++++++++ .../vscode/e2e/selectors/GUI.selectors.ts | 44 ++++++++++ .../vscode/e2e/selectors/SelectorUtils.ts | 16 ++++ extensions/vscode/e2e/test-files/config.json | 4 + extensions/vscode/e2e/tests/GUI.test.ts | 61 +++++++++++++ extensions/vscode/package.json | 9 +- gui/src/components/mainInput/InputToolbar.tsx | 1 + .../components/modelSelection/ModelSelect.tsx | 1 + 14 files changed, 239 insertions(+), 95 deletions(-) create mode 100644 core/llm/llms/Test.ts delete mode 100644 extensions/vscode/e2e/GUI.test.ts create mode 100644 extensions/vscode/e2e/actions/GUI.actions.ts create mode 100644 extensions/vscode/e2e/selectors/GUI.selectors.ts create mode 100644 extensions/vscode/e2e/selectors/SelectorUtils.ts create mode 100644 extensions/vscode/e2e/test-files/config.json create mode 100644 extensions/vscode/e2e/tests/GUI.test.ts diff --git a/core/autocomplete/filtering/test/util.ts b/core/autocomplete/filtering/test/util.ts index a052aace2..db8d99131 100644 --- a/core/autocomplete/filtering/test/util.ts +++ b/core/autocomplete/filtering/test/util.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "node:path"; -import Mock from "../../../llm/llms/Mock"; +import MockLLM from "../../../llm/llms/Mock"; import { testConfigHandler, testIde } from "../../../test/fixtures"; import { CompletionProvider } from "../../CompletionProvider"; import { AutocompleteInput } from "../../util/types"; @@ -30,7 +30,7 @@ export async function testAutocompleteFiltering( const { prefix, suffix } = parseFimExample(test.input); // Setup necessary objects - const llm = new Mock({ + const llm = new MockLLM({ model: "mock", }); llm.completion = test.llmOutput; diff --git a/core/index.d.ts b/core/index.d.ts index 06fbd7275..4e050bb58 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -807,6 +807,7 @@ type ModelProvider = | "nvidia" | "vllm" | "mock" + | "test" | "cerebras" | "askSage" | "vertexai" diff --git a/core/llm/llms/Mock.ts b/core/llm/llms/Mock.ts index 5f3880e3c..6f564cce7 100644 --- a/core/llm/llms/Mock.ts +++ b/core/llm/llms/Mock.ts @@ -1,7 +1,7 @@ import { ChatMessage, CompletionOptions, ModelProvider } from "../../index.js"; import { BaseLLM } from "../index.js"; -class Mock extends BaseLLM { +class MockLLM extends BaseLLM { public completion: string = "Test Completion"; static providerName: ModelProvider = "mock"; @@ -27,4 +27,4 @@ class Mock extends BaseLLM { } } -export default Mock; +export default MockLLM; diff --git a/core/llm/llms/Test.ts b/core/llm/llms/Test.ts new file mode 100644 index 000000000..b35984f3e --- /dev/null +++ b/core/llm/llms/Test.ts @@ -0,0 +1,39 @@ +import { ChatMessage, CompletionOptions, ModelProvider } from "../../index.js"; +import { BaseLLM } from "../index.js"; + +const RESPONSES: Record = { + "How are you?": "I'm fine", +}; + +const HARDCODED_CHAT_RESPONSE = "THIS IS A HARDCODED RESPONSE"; + +class TestLLM extends BaseLLM { + static providerName: ModelProvider = "test"; + + private findResponse(prompt: string) { + return Object.entries(RESPONSES).find(([key]) => prompt.includes(key))?.[1]; + } + + protected async *_streamComplete( + prompt: string, + signal: AbortSignal, + options: CompletionOptions, + ): AsyncGenerator { + yield this.findResponse(prompt) || `PROMPT: ${prompt}`; + } + + protected async *_streamChat( + messages: ChatMessage[], + signal: AbortSignal, + options: CompletionOptions, + ): AsyncGenerator { + for (const char of HARDCODED_CHAT_RESPONSE) { + yield { + role: "assistant", + content: char, + }; + } + } +} + +export default TestLLM; diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 632607ed1..9604cb9f6 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -31,7 +31,7 @@ import LlamaCpp from "./LlamaCpp"; import Llamafile from "./Llamafile"; import LMStudio from "./LMStudio"; import Mistral from "./Mistral"; -import Mock from "./Mock"; +import MockLLM from "./Mock"; import Moonshot from "./Moonshot"; import Msty from "./Msty"; import Nebius from "./Nebius"; @@ -50,6 +50,7 @@ import Vllm from "./Vllm"; import WatsonX from "./WatsonX"; import xAI from "./xAI"; import SiliconFlow from "./SiliconFlow"; +import TestLLM from "./Test"; const LLMs = [ Anthropic, @@ -87,7 +88,8 @@ const LLMs = [ Nvidia, Vllm, SambaNova, - Mock, + MockLLM, + TestLLM, Cerebras, Asksage, Nebius, diff --git a/extensions/vscode/e2e/GUI.test.ts b/extensions/vscode/e2e/GUI.test.ts deleted file mode 100644 index 0055df1ba..000000000 --- a/extensions/vscode/e2e/GUI.test.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { - Workbench, - EditorView, - WebView, - By, - WebElement, - WebDriver, - Key, -} from "vscode-extension-tester"; -import { expect } from "chai"; - -const switchToReactIframe = async (driver: WebDriver) => { - const iframes = await driver.findElements(By.css("iframe")); - let continueIFrame: WebElement | undefined = undefined; - for (let i = 0; i < iframes.length; i++) { - const iframe = iframes[i]; - const src = await iframe.getAttribute("src"); - if (src.includes("extensionId=Continue.continue")) { - continueIFrame = iframe; - break; - } - } - - if (!continueIFrame) { - throw new Error("Could not find continue iframe"); - } - - await driver.switchTo().frame(continueIFrame); - - await new Promise((res) => { - setTimeout(res, 500); - }); - - const reactIFrame = await driver.findElement(By.css("iframe")); - - if (!reactIFrame) { - throw new Error("Could not find React iframe"); - } - - await driver.switchTo().frame(reactIFrame); -}; - -describe("GUI Test", () => { - let view: WebView; - let driver: WebDriver; - - before(async function () { - this.timeout(10000); - - await new Workbench().executeCommand("continue.focusContinueInput"); - - view = new WebView(); - driver = view.getDriver(); - - await switchToReactIframe(driver); - }); - - after(async () => { - await view.switchBack(); - await new EditorView().closeAllEditors(); - }); - - it("should display correct panel description", async () => { - const description = await view.findWebElement( - By.xpath("//*[contains(text(), 'Quickly')]"), - ); - - expect(await description.getText()).has.string( - "Quickly get up and running using our API keys.", - ); - }); - - it("should allow typing text in the editor", async () => { - const tiptap = await view.findWebElement(By.className("tiptap")); - - await tiptap.sendKeys("Hello world!"); - - expect(await tiptap.getText()).has.string("Hello world!"); - - // Just to show that we can - await tiptap.sendKeys(Key.ENTER); - await new Promise((res) => { - setTimeout(res, 5000); - }); - }).timeout(6000); -}); diff --git a/extensions/vscode/e2e/actions/GUI.actions.ts b/extensions/vscode/e2e/actions/GUI.actions.ts new file mode 100644 index 000000000..1e59f1d15 --- /dev/null +++ b/extensions/vscode/e2e/actions/GUI.actions.ts @@ -0,0 +1,58 @@ +import { + WebDriver, + WebElement, + WebView, + Workbench, +} from "vscode-extension-tester"; +import { GUISelectors } from "../selectors/GUI.selectors"; + +export class GUIActions { + public static switchToReactIframe = async (driver: WebDriver) => { + const iframes = await GUISelectors.getAllIframes(driver); + let continueIFrame: WebElement | undefined = undefined; + for (let i = 0; i < iframes.length; i++) { + const iframe = iframes[i]; + const src = await iframe.getAttribute("src"); + if (src.includes("extensionId=Continue.continue")) { + continueIFrame = iframe; + break; + } + } + + if (!continueIFrame) { + throw new Error("Could not find continue iframe"); + } + + await driver.switchTo().frame(continueIFrame); + + await new Promise((res) => { + setTimeout(res, 500); + }); + + const reactIFrame = await GUISelectors.getReactIframe(driver); + + if (!reactIFrame) { + throw new Error("Could not find React iframe"); + } + + await driver.switchTo().frame(reactIFrame); + }; + + public static openGui = async () => { + return new Workbench().executeCommand("continue.focusContinueInput"); + }; + + public static selectModelFromDropdown = async ( + view: WebView, + option: string, + ) => { + const dropdownButton = await GUISelectors.getModelDropdownButton(view); + await dropdownButton.click(); + + const dropdownOption = await GUISelectors.getModelDropdownOption( + view, + option, + ); + await dropdownOption.click(); + }; +} diff --git a/extensions/vscode/e2e/selectors/GUI.selectors.ts b/extensions/vscode/e2e/selectors/GUI.selectors.ts new file mode 100644 index 000000000..1208d1a04 --- /dev/null +++ b/extensions/vscode/e2e/selectors/GUI.selectors.ts @@ -0,0 +1,44 @@ +import { By, WebDriver, WebView } from "vscode-extension-tester"; +import { SelectorUtils } from "./SelectorUtils"; + +export class GUISelectors { + public static getDescription(view: WebView) { + return view.findWebElement(By.xpath("//*[contains(text(), 'Quickly')]")); + } + + public static getTipTapEditor(view: WebView) { + return view.findWebElement(By.className("tiptap")); + } + + public static getAllIframes(driver: WebDriver) { + return driver.findElements(By.css("iframe")); + } + + public static getReactIframe(driver: WebDriver) { + return driver.findElement(By.css("iframe")); + } + + public static getSubmitInputButton(view: WebView) { + return SelectorUtils.getElementByDataTestId(view, "submit-input-button"); + } + + public static getModelDropdownButton(view: WebView) { + return SelectorUtils.getElementByDataTestId(view, "model-select-button"); + } + + public static getListbox(view: WebView) { + const listbox = view.findWebElement(By.css('[role="listbox"]')); + } + + public static getModelDropdownOption(view: WebView, option: string) { + return view.findWebElement( + By.xpath(`//*[@role="listbox"]//*[contains(text(), "${option}")]`), + ); + } + + public static getThreadMessageByText(view: WebView, text: string) { + return view.findWebElement( + By.xpath(`//*[@class="thread-message"]//*[contains(text(), "${text}")]`), + ); + } +} diff --git a/extensions/vscode/e2e/selectors/SelectorUtils.ts b/extensions/vscode/e2e/selectors/SelectorUtils.ts new file mode 100644 index 000000000..243e1bf44 --- /dev/null +++ b/extensions/vscode/e2e/selectors/SelectorUtils.ts @@ -0,0 +1,16 @@ +import { By, WebElement, WebView } from "vscode-extension-tester"; + +export class SelectorUtils { + /** + * Finds a web element by its data-testid attribute within a WebView. + * @param view - The WebView to search within. + * @param testId - The data-testid value to search for. + * @returns A promise that resolves to the WebElement found. + */ + public static getElementByDataTestId( + view: WebView, + testId: string, + ): Promise { + return view.findWebElement(By.css(`[data-testid='${testId}']`)); + } +} diff --git a/extensions/vscode/e2e/test-files/config.json b/extensions/vscode/e2e/test-files/config.json new file mode 100644 index 000000000..524cd8403 --- /dev/null +++ b/extensions/vscode/e2e/test-files/config.json @@ -0,0 +1,4 @@ +{ + "name": "Untitled.txt", + "content": "Hello, world!" +} diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts new file mode 100644 index 000000000..87837c69c --- /dev/null +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -0,0 +1,61 @@ +import { + EditorView, + WebView, + WebDriver, + Key, + VSBrowser, +} from "vscode-extension-tester"; +import { expect } from "chai"; +import { GUIActions } from "../actions/GUI.actions"; +import { GUISelectors } from "../selectors/GUI.selectors"; +import * as path from "path"; + +describe("GUI Test", () => { + let view: WebView; + let driver: WebDriver; + + before(async function () { + this.timeout(10000000); + + await VSBrowser.instance.openResources(path.join("e2e/test-files")); + + await GUIActions.openGui(); + + view = new WebView(); + driver = view.getDriver(); + + await GUIActions.switchToReactIframe(driver); + // await new Promise((res) => { + // setTimeout(res, 10000000); + // }); + }); + + after(async () => { + await view.switchBack(); + await new EditorView().closeAllEditors(); + }); + + it("should display correct panel description", async () => { + const description = await GUISelectors.getDescription(view); + + expect(await description.getText()).has.string( + "Quickly get up and running using our API keys.", + ); + }); + + it.only("should allow typing text in the editor", async () => { + await GUIActions.selectModelFromDropdown(view, "Mock"); + await GUIActions.selectModelFromDropdown(view, "TEST LLM"); + + const tiptap = await GUISelectors.getTipTapEditor(view); + + await tiptap.sendKeys("How are you?"); + (await GUISelectors.getSubmitInputButton(view)).click(); + + await new Promise((res) => { + setTimeout(res, 600000000); + }); + + await GUISelectors.getThreadMessageByText(view, "I'm fine"); + }).timeout(600000000); +}); diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index acc5b947b..9d353798f 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "0.9.244", + "version": "0.9.251", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" @@ -613,6 +613,7 @@ "quick-test": "npm run build-test && node ./out/runTestOnVSCodeHost.js", "prepackage": "node scripts/prepackage.js", "package": "node scripts/package.js", + "e2e:package": "CONTINUE_GLOBAL_DIR=e2e/test-files node scripts/package.js", "package-all": "node scripts/package-all.js", "package:pre-release": "node scripts/package.js --pre-release", "build:rust": "cargo-cp-artifact -ac sync sync.node -- cargo build --manifest-path ../../sync/Cargo.toml --message-format=json-render-diagnostics", @@ -625,8 +626,10 @@ "e2e:sign-vscode": "codesign --entitlements entitlements.plist --deep --force -s - './e2e/storage/Visual Studio Code.app'", "e2e:copy-vsix": "chmod +x ./e2e/get-latest-vsix.sh && bash ./e2e/get-latest-vsix.sh", "e2e:install-vsix": "extest install-vsix -f ./e2e/vsix/continue.vsix --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", - "e2e:test": "extest run-tests './e2e/_output/*.test.js' --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", - "e2e:all": "npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:sign-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:test", + "e2e:test": "extest run-tests './e2e/_output/tests/*.test.js' --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", + "e2e:clean": "rm -rf ./e2e/_output", + "e2e:all": "npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:sign-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:test && npm run e2e:clean", + "e2e:quick": "CONTINUE_GLOBAL_DIR=e2e/test-files npm run e2e:compile && npm run e2e:test && npm run e2e:clean", "e2e:ci": "npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:test" }, "devDependencies": { diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 9348e5262..f83c27d1e 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -208,6 +208,7 @@ function InputToolbar(props: InputToolbarProps) { )} { if (props.onEnter) { props.onEnter({ diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index a4d7fe364..c5edb5d7b 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -316,6 +316,7 @@ function ModelSelect() { >
Date: Fri, 6 Dec 2024 15:39:42 -0800 Subject: [PATCH 07/29] fix ImportDefinitionsService bug --- .../context/ImportDefinitionsService.ts | 13 +++++++++++-- core/util/LruCache.ts | 8 ++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/core/autocomplete/context/ImportDefinitionsService.ts b/core/autocomplete/context/ImportDefinitionsService.ts index 128dbf78e..309310738 100644 --- a/core/autocomplete/context/ImportDefinitionsService.ts +++ b/core/autocomplete/context/ImportDefinitionsService.ts @@ -29,14 +29,23 @@ export class ImportDefinitionsService { return this.cache.get(filepath); } - private async _getFileInfo(filepath: string): Promise { + private async _getFileInfo(filepath: string): Promise { const parser = await getParserForFile(filepath); if (!parser) { return { imports: {}, }; } - const ast = parser.parse(await this.ide.readFile(filepath), undefined, { + + let fileContents: string | undefined = undefined; + try { + fileContents = await this.ide.readFile(filepath); + } catch (err) { + // File removed + return null; + } + + const ast = parser.parse(fileContents, undefined, { includedRanges: [ { startIndex: 0, diff --git a/core/util/LruCache.ts b/core/util/LruCache.ts index f6d923fed..86925a6bc 100644 --- a/core/util/LruCache.ts +++ b/core/util/LruCache.ts @@ -1,7 +1,7 @@ export class PrecalculatedLruCache { private items: [string, V][] = []; constructor( - private readonly calculateValue: (key: string) => Promise, + private readonly calculateValue: (key: string) => Promise, private readonly N: number, ) {} @@ -11,7 +11,11 @@ export class PrecalculatedLruCache { if (index < 0) { // Calculate info for new file - const value: V = await this.calculateValue(key); + const value: V | null = await this.calculateValue(key); + + if (value === null) { + return; + } this.items.push([key, value]); if (this.items.length > this.N) { From b95956155f8c40beebd89894fdf1d2184295569c Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 15:45:57 -0800 Subject: [PATCH 08/29] preview.yaml back to normal --- .github/workflows/preview.yaml | 193 ++++++++++++++++----------------- 1 file changed, 95 insertions(+), 98 deletions(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 9a3604f09..f433e8fe0 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -1,30 +1,27 @@ name: Publish Preview Extension on: - push: - branches: - - nate/mac-14-ci - # release: - # types: [prereleased] + release: + types: [prereleased] jobs: - # check_release_name: - # runs-on: ubuntu-latest - # outputs: - # should_run: ${{ steps.check.outputs.should_run }} - # steps: - # - id: check - # working-directory: . - # run: | - # if [[ "${{ github.event.release.tag_name }}" == v0.9.*-vscode ]]; then - # echo "should_run=true" >> $GITHUB_OUTPUT - # else - # echo "should_run=false" >> $GITHUB_OUTPUT - # fi + check_release_name: + runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.check.outputs.should_run }} + steps: + - id: check + working-directory: . + run: | + if [[ "${{ github.event.release.tag_name }}" == v0.9.*-vscode ]]; then + echo "should_run=true" >> $GITHUB_OUTPUT + else + echo "should_run=false" >> $GITHUB_OUTPUT + fi build: - # needs: check_release_name - # if: needs.check_release_name.outputs.should_run == 'true' + needs: check_release_name + if: needs.check_release_name.outputs.should_run == 'true' strategy: matrix: include: @@ -164,93 +161,93 @@ jobs: name: ${{ env.target }}-vsix path: "extensions/vscode/*.vsix" - # release: - # permissions: - # contents: write - # runs-on: ubuntu-latest - # needs: - # - build - # steps: - # - name: Checkout - # uses: actions/checkout@v4 + release: + permissions: + contents: write + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Checkout + uses: actions/checkout@v4 - # - name: Set up Git - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" + - name: Set up Git + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" - # # Download the .vsix artifacts - # - uses: actions/download-artifact@v4 - # with: - # pattern: "*-vsix" - # path: vsix-artifacts - # merge-multiple: true + # Download the .vsix artifacts + - uses: actions/download-artifact@v4 + with: + pattern: "*-vsix" + path: vsix-artifacts + merge-multiple: true - # - name: Release - # uses: softprops/action-gh-release@v2 - # with: - # tag_name: ${{ github.ref_name }} - # files: | - # vsix-artifacts/*.vsix - # token: ${{ secrets.CI_GITHUB_TOKEN }} - # repository: continuedev/continue - # prerelease: true + - name: Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.ref_name }} + files: | + vsix-artifacts/*.vsix + token: ${{ secrets.CI_GITHUB_TOKEN }} + repository: continuedev/continue + prerelease: true - # publish: - # runs-on: ubuntu-latest - # needs: - # - build - # permissions: - # contents: write - # steps: - # # 0. Setup git - # - name: Checkout - # uses: actions/checkout@v4 + publish: + runs-on: ubuntu-latest + needs: + - build + permissions: + contents: write + steps: + # 0. Setup git + - name: Checkout + uses: actions/checkout@v4 - # - name: Set up Git - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" + - name: Set up Git + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" - # - name: Pull latest changes - # run: git pull origin main + - name: Pull latest changes + run: git pull origin main - # # 1. Download the artifacts - # - uses: actions/download-artifact@v4 - # with: - # pattern: "*-vsix" - # path: vsix-artifacts - # merge-multiple: true + # 1. Download the artifacts + - uses: actions/download-artifact@v4 + with: + pattern: "*-vsix" + path: vsix-artifacts + merge-multiple: true - # # 2. Publish the extension to VS Code Marketplace - # - name: Publish to VS Code Marketplace - # run: | - # cd extensions/vscode - # npx vsce publish --pre-release --packagePath ../../vsix-artifacts/*.vsix - # env: - # VSCE_PAT: ${{ secrets.VSCE_TOKEN }} + # 2. Publish the extension to VS Code Marketplace + - name: Publish to VS Code Marketplace + run: | + cd extensions/vscode + npx vsce publish --pre-release --packagePath ../../vsix-artifacts/*.vsix + env: + VSCE_PAT: ${{ secrets.VSCE_TOKEN }} - # # 3. Publish the extension to Open VSX Registry - # - name: Publish (Open VSX Registry) - # continue-on-error: true - # run: | - # cd extensions/vscode - # npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix + # 3. Publish the extension to Open VSX Registry + - name: Publish (Open VSX Registry) + continue-on-error: true + run: | + cd extensions/vscode + npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix - # 4. Update the package.json version and push changes - # - name: Update version in package.json - # run: | - # cd extensions/vscode - # npm version patch + 4. Update the package.json version and push changes + - name: Update version in package.json + run: | + cd extensions/vscode + npm version patch - # - name: Commit changes - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" - # git commit -am "💚 Update package.json version [skip ci]" + - name: Commit changes + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -am "💚 Update package.json version [skip ci]" - # - name: Push changes - # uses: ad-m/github-push-action@master - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # branch: ${{ github.ref }} + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} From 39a0cab5e413ac060a492d1ab24bd9367688d3b8 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 15:47:12 -0800 Subject: [PATCH 09/29] comment --- .github/workflows/preview.yaml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index f433e8fe0..2f3e0875d 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -234,20 +234,20 @@ jobs: cd extensions/vscode npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix - 4. Update the package.json version and push changes - - name: Update version in package.json - run: | - cd extensions/vscode - npm version patch + # 4. Update the package.json version and push changes + # - name: Update version in package.json + # run: | + # cd extensions/vscode + # npm version patch - - name: Commit changes - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git commit -am "💚 Update package.json version [skip ci]" + # - name: Commit changes + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" + # git commit -am "💚 Update package.json version [skip ci]" - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} + # - name: Push changes + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # branch: ${{ github.ref }} From a255583d2264b40a22546fd45871ceabaaf2c5d3 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 15:47:33 -0800 Subject: [PATCH 10/29] tab --- .github/workflows/preview.yaml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 2f3e0875d..da46e9d49 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -234,20 +234,20 @@ jobs: cd extensions/vscode npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix - # 4. Update the package.json version and push changes - # - name: Update version in package.json - # run: | - # cd extensions/vscode - # npm version patch + # 4. Update the package.json version and push changes + # - name: Update version in package.json + # run: | + # cd extensions/vscode + # npm version patch - # - name: Commit changes - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" - # git commit -am "💚 Update package.json version [skip ci]" + # - name: Commit changes + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" + # git commit -am "💚 Update package.json version [skip ci]" - # - name: Push changes - # uses: ad-m/github-push-action@master - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # branch: ${{ github.ref }} + # - name: Push changes + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # branch: ${{ github.ref }} From 9857ea8df6d6833524cc279d72f2de61ae218c7e Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 15:47:57 -0800 Subject: [PATCH 11/29] tab --- .github/workflows/preview.yaml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index da46e9d49..2f3e0875d 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -234,20 +234,20 @@ jobs: cd extensions/vscode npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix - # 4. Update the package.json version and push changes - # - name: Update version in package.json - # run: | - # cd extensions/vscode - # npm version patch + # 4. Update the package.json version and push changes + # - name: Update version in package.json + # run: | + # cd extensions/vscode + # npm version patch - # - name: Commit changes - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" - # git commit -am "💚 Update package.json version [skip ci]" + # - name: Commit changes + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" + # git commit -am "💚 Update package.json version [skip ci]" - # - name: Push changes - # uses: ad-m/github-push-action@master - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # branch: ${{ github.ref }} + # - name: Push changes + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # branch: ${{ github.ref }} From 321e079d527407e29fa78c595e30c0369639e2e6 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 15:48:16 -0800 Subject: [PATCH 12/29] more tabs --- .github/workflows/preview.yaml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 2f3e0875d..bd5f4b7ac 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -234,20 +234,20 @@ jobs: cd extensions/vscode npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix - # 4. Update the package.json version and push changes - # - name: Update version in package.json - # run: | - # cd extensions/vscode - # npm version patch + # 4. Update the package.json version and push changes + # - name: Update version in package.json + # run: | + # cd extensions/vscode + # npm version patch - # - name: Commit changes - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" - # git commit -am "💚 Update package.json version [skip ci]" + # - name: Commit changes + # run: | + # git config --local user.email "action@github.com" + # git config --local user.name "GitHub Action" + # git commit -am "💚 Update package.json version [skip ci]" - # - name: Push changes - # uses: ad-m/github-push-action@master - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # branch: ${{ github.ref }} + # - name: Push changes + # uses: ad-m/github-push-action@master + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # branch: ${{ github.ref }} From ba41678a398385300f11b2194c091a62b2ee4e94 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 6 Dec 2024 16:47:20 -0800 Subject: [PATCH 13/29] test: set up test config.json and test project directory --- extensions/vscode/.gitignore | 3 +- extensions/vscode/.vscodeignore | 1 + .../vscode/e2e/test-continue/config.json | 44 +++++++++++++++++++ extensions/vscode/e2e/test-files/config.json | 4 -- extensions/vscode/e2e/tests/GUI.test.ts | 6 +-- extensions/vscode/package.json | 7 ++- 6 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 extensions/vscode/e2e/test-continue/config.json delete mode 100644 extensions/vscode/e2e/test-files/config.json diff --git a/extensions/vscode/.gitignore b/extensions/vscode/.gitignore index 23c012927..f922ad032 100644 --- a/extensions/vscode/.gitignore +++ b/extensions/vscode/.gitignore @@ -18,8 +18,9 @@ gui/** continue_rc_schema.json - e2e/_output e2e/.test-extensions e2e/storage e2e/vsix +e2e/test-continue/* +!e2e/test-continue/config.json \ No newline at end of file diff --git a/extensions/vscode/.vscodeignore b/extensions/vscode/.vscodeignore index 9d59dbe5c..387be8ba5 100644 --- a/extensions/vscode/.vscodeignore +++ b/extensions/vscode/.vscodeignore @@ -21,6 +21,7 @@ esbuild.js esbuild.test.mjs importMetaUrl.js scripts +e2e server/exe/** !out/node_modules/** diff --git a/extensions/vscode/e2e/test-continue/config.json b/extensions/vscode/e2e/test-continue/config.json new file mode 100644 index 000000000..6ffeb7465 --- /dev/null +++ b/extensions/vscode/e2e/test-continue/config.json @@ -0,0 +1,44 @@ +{ + "ui": { + "displayRawMarkdown": false + }, + "models": [ + { + "title": "TEST LLM", + "provider": "test", + "model": "this field is not used" + }, + { + "title": "Mock", + "provider": "mock", + "model": "this field is not used" + } + ], + "analytics": { + "provider": "continue-proxy" + }, + "tabAutocompleteModel": { + "title": "Qwen", + "provider": "mistral", + "model": "codestral-latest", + "apiKey": "" + }, + "tabAutocompleteOptions": { + "useCache": false + }, + "contextProviders": [ + { + "name": "docs" + }, + { + "name": "diff" + }, + { + "name": "url" + }, + { + "name": "folder" + } + ], + "docs": [] +} diff --git a/extensions/vscode/e2e/test-files/config.json b/extensions/vscode/e2e/test-files/config.json deleted file mode 100644 index 524cd8403..000000000 --- a/extensions/vscode/e2e/test-files/config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Untitled.txt", - "content": "Hello, world!" -} diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index 87837c69c..abab249b9 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -17,7 +17,7 @@ describe("GUI Test", () => { before(async function () { this.timeout(10000000); - await VSBrowser.instance.openResources(path.join("e2e/test-files")); + await VSBrowser.instance.openResources(path.join("e2e/test-continue")); await GUIActions.openGui(); @@ -43,7 +43,7 @@ describe("GUI Test", () => { ); }); - it.only("should allow typing text in the editor", async () => { + it("should allow typing text in the editor", async () => { await GUIActions.selectModelFromDropdown(view, "Mock"); await GUIActions.selectModelFromDropdown(view, "TEST LLM"); @@ -53,7 +53,7 @@ describe("GUI Test", () => { (await GUISelectors.getSubmitInputButton(view)).click(); await new Promise((res) => { - setTimeout(res, 600000000); + setTimeout(res, 1000); }); await GUISelectors.getThreadMessageByText(view, "I'm fine"); diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 9d353798f..b9b2fb022 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "0.9.251", + "version": "0.9.257", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" @@ -613,7 +613,6 @@ "quick-test": "npm run build-test && node ./out/runTestOnVSCodeHost.js", "prepackage": "node scripts/prepackage.js", "package": "node scripts/package.js", - "e2e:package": "CONTINUE_GLOBAL_DIR=e2e/test-files node scripts/package.js", "package-all": "node scripts/package-all.js", "package:pre-release": "node scripts/package.js --pre-release", "build:rust": "cargo-cp-artifact -ac sync sync.node -- cargo build --manifest-path ../../sync/Cargo.toml --message-format=json-render-diagnostics", @@ -628,8 +627,8 @@ "e2e:install-vsix": "extest install-vsix -f ./e2e/vsix/continue.vsix --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", "e2e:test": "extest run-tests './e2e/_output/tests/*.test.js' --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", "e2e:clean": "rm -rf ./e2e/_output", - "e2e:all": "npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:sign-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:test && npm run e2e:clean", - "e2e:quick": "CONTINUE_GLOBAL_DIR=e2e/test-files npm run e2e:compile && npm run e2e:test && npm run e2e:clean", + "e2e:all": "npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:sign-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", + "e2e:quick": "npm run e2e:compile && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", "e2e:ci": "npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:test" }, "devDependencies": { From af5d5fadb0fa9e8ae9364eb77844b9a027280ac3 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 6 Dec 2024 17:22:24 -0800 Subject: [PATCH 14/29] test: add waitForElement util --- extensions/vscode/e2e/TestUtils.ts | 27 +++++++++++++++++++++++++ extensions/vscode/e2e/tests/GUI.test.ts | 11 +++++----- 2 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 extensions/vscode/e2e/TestUtils.ts diff --git a/extensions/vscode/e2e/TestUtils.ts b/extensions/vscode/e2e/TestUtils.ts new file mode 100644 index 000000000..dc1fd556e --- /dev/null +++ b/extensions/vscode/e2e/TestUtils.ts @@ -0,0 +1,27 @@ +import { WebElement } from "vscode-extension-tester"; + +export class TestUtils { + public static async waitForElement( + locatorFn: () => Promise, + timeout: number = 1500, + interval: number = 500, + ): Promise { + const startTime = Date.now(); + + while (Date.now() - startTime < timeout) { + try { + const element = await locatorFn(); + if (element) { + return element; + } + } catch (e) { + if (Date.now() - startTime >= timeout) { + throw new Error(`Element not found after ${timeout}ms timeout`); + } + } + await new Promise((resolve) => setTimeout(resolve, interval)); + } + + throw new Error(`Element not found after ${timeout}ms timeout`); + } +} diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index abab249b9..d14eaad2a 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -2,13 +2,13 @@ import { EditorView, WebView, WebDriver, - Key, VSBrowser, } from "vscode-extension-tester"; import { expect } from "chai"; import { GUIActions } from "../actions/GUI.actions"; import { GUISelectors } from "../selectors/GUI.selectors"; import * as path from "path"; +import { TestUtils } from "../TestUtils"; describe("GUI Test", () => { let view: WebView; @@ -52,10 +52,9 @@ describe("GUI Test", () => { await tiptap.sendKeys("How are you?"); (await GUISelectors.getSubmitInputButton(view)).click(); - await new Promise((res) => { - setTimeout(res, 1000); - }); - - await GUISelectors.getThreadMessageByText(view, "I'm fine"); + await TestUtils.waitForElement( + () => GUISelectors.getThreadMessageByText(view, "I'm fine"), + 5000, + ); }).timeout(600000000); }); From ec121409f8bd813fc3360227adddcc869d10a29f Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 6 Dec 2024 17:25:10 -0800 Subject: [PATCH 15/29] test: clean up code --- extensions/vscode/e2e/TestUtils.ts | 2 +- extensions/vscode/e2e/actions/GUI.actions.ts | 1 + extensions/vscode/e2e/selectors/GUI.selectors.ts | 4 ---- extensions/vscode/e2e/tests/GUI.test.ts | 1 - 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/extensions/vscode/e2e/TestUtils.ts b/extensions/vscode/e2e/TestUtils.ts index dc1fd556e..47651d926 100644 --- a/extensions/vscode/e2e/TestUtils.ts +++ b/extensions/vscode/e2e/TestUtils.ts @@ -3,7 +3,7 @@ import { WebElement } from "vscode-extension-tester"; export class TestUtils { public static async waitForElement( locatorFn: () => Promise, - timeout: number = 1500, + timeout: number = 5000, interval: number = 500, ): Promise { const startTime = Date.now(); diff --git a/extensions/vscode/e2e/actions/GUI.actions.ts b/extensions/vscode/e2e/actions/GUI.actions.ts index 1e59f1d15..86fcb293b 100644 --- a/extensions/vscode/e2e/actions/GUI.actions.ts +++ b/extensions/vscode/e2e/actions/GUI.actions.ts @@ -5,6 +5,7 @@ import { Workbench, } from "vscode-extension-tester"; import { GUISelectors } from "../selectors/GUI.selectors"; +import { TestUtils } from "../TestUtils"; export class GUIActions { public static switchToReactIframe = async (driver: WebDriver) => { diff --git a/extensions/vscode/e2e/selectors/GUI.selectors.ts b/extensions/vscode/e2e/selectors/GUI.selectors.ts index 1208d1a04..b4c88aacb 100644 --- a/extensions/vscode/e2e/selectors/GUI.selectors.ts +++ b/extensions/vscode/e2e/selectors/GUI.selectors.ts @@ -26,10 +26,6 @@ export class GUISelectors { return SelectorUtils.getElementByDataTestId(view, "model-select-button"); } - public static getListbox(view: WebView) { - const listbox = view.findWebElement(By.css('[role="listbox"]')); - } - public static getModelDropdownOption(view: WebView, option: string) { return view.findWebElement( By.xpath(`//*[@role="listbox"]//*[contains(text(), "${option}")]`), diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index d14eaad2a..b01feb35e 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -54,7 +54,6 @@ describe("GUI Test", () => { await TestUtils.waitForElement( () => GUISelectors.getThreadMessageByText(view, "I'm fine"), - 5000, ); }).timeout(600000000); }); From b9f161f6d8b4e7400dff25912881f41f472a9137 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 6 Dec 2024 17:43:13 -0800 Subject: [PATCH 16/29] fix: timeout --- extensions/vscode/e2e/actions/GUI.actions.ts | 4 ++++ extensions/vscode/e2e/tests/GUI.test.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/e2e/actions/GUI.actions.ts b/extensions/vscode/e2e/actions/GUI.actions.ts index 86fcb293b..9ad60e275 100644 --- a/extensions/vscode/e2e/actions/GUI.actions.ts +++ b/extensions/vscode/e2e/actions/GUI.actions.ts @@ -50,6 +50,10 @@ export class GUIActions { const dropdownButton = await GUISelectors.getModelDropdownButton(view); await dropdownButton.click(); + await new Promise((res) => { + setTimeout(res, 1000); + }); + const dropdownOption = await GUISelectors.getModelDropdownOption( view, option, diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index b01feb35e..66791cf74 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -52,8 +52,8 @@ describe("GUI Test", () => { await tiptap.sendKeys("How are you?"); (await GUISelectors.getSubmitInputButton(view)).click(); - await TestUtils.waitForElement( - () => GUISelectors.getThreadMessageByText(view, "I'm fine"), + await TestUtils.waitForElement(() => + GUISelectors.getThreadMessageByText(view, "I'm fine"), ); }).timeout(600000000); }); From 120e46fcbc31d0f743c3dd98e08c70fa21f5cdd5 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 6 Dec 2024 17:50:18 -0800 Subject: [PATCH 17/29] test: timeout --- extensions/vscode/e2e/actions/GUI.actions.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extensions/vscode/e2e/actions/GUI.actions.ts b/extensions/vscode/e2e/actions/GUI.actions.ts index 9ad60e275..3c8f59100 100644 --- a/extensions/vscode/e2e/actions/GUI.actions.ts +++ b/extensions/vscode/e2e/actions/GUI.actions.ts @@ -5,7 +5,6 @@ import { Workbench, } from "vscode-extension-tester"; import { GUISelectors } from "../selectors/GUI.selectors"; -import { TestUtils } from "../TestUtils"; export class GUIActions { public static switchToReactIframe = async (driver: WebDriver) => { @@ -51,7 +50,7 @@ export class GUIActions { await dropdownButton.click(); await new Promise((res) => { - setTimeout(res, 1000); + setTimeout(res, 2000); }); const dropdownOption = await GUISelectors.getModelDropdownOption( From 8d06b9f381414ecc7c6c030d4730e89d80b41466 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 6 Dec 2024 17:51:52 -0800 Subject: [PATCH 18/29] test: wait for element --- extensions/vscode/e2e/TestUtils.ts | 2 +- extensions/vscode/e2e/actions/GUI.actions.ts | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/extensions/vscode/e2e/TestUtils.ts b/extensions/vscode/e2e/TestUtils.ts index 47651d926..05e4bc5d1 100644 --- a/extensions/vscode/e2e/TestUtils.ts +++ b/extensions/vscode/e2e/TestUtils.ts @@ -5,7 +5,7 @@ export class TestUtils { locatorFn: () => Promise, timeout: number = 5000, interval: number = 500, - ): Promise { + ): Promise { const startTime = Date.now(); while (Date.now() - startTime < timeout) { diff --git a/extensions/vscode/e2e/actions/GUI.actions.ts b/extensions/vscode/e2e/actions/GUI.actions.ts index 3c8f59100..7a6e76c04 100644 --- a/extensions/vscode/e2e/actions/GUI.actions.ts +++ b/extensions/vscode/e2e/actions/GUI.actions.ts @@ -5,6 +5,7 @@ import { Workbench, } from "vscode-extension-tester"; import { GUISelectors } from "../selectors/GUI.selectors"; +import { TestUtils } from "../TestUtils"; export class GUIActions { public static switchToReactIframe = async (driver: WebDriver) => { @@ -49,14 +50,10 @@ export class GUIActions { const dropdownButton = await GUISelectors.getModelDropdownButton(view); await dropdownButton.click(); - await new Promise((res) => { - setTimeout(res, 2000); + const dropdownOption = await TestUtils.waitForElement(() => { + return GUISelectors.getModelDropdownOption(view, option); }); - const dropdownOption = await GUISelectors.getModelDropdownOption( - view, - option, - ); await dropdownOption.click(); }; } From fe06296bba7f86e270b93e234670f18d7cced594 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 6 Dec 2024 17:57:42 -0800 Subject: [PATCH 19/29] test: timeouts --- extensions/vscode/e2e/tests/GUI.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index 66791cf74..6a5e820f8 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -41,7 +41,7 @@ describe("GUI Test", () => { expect(await description.getText()).has.string( "Quickly get up and running using our API keys.", ); - }); + }).timeout(20_000); it("should allow typing text in the editor", async () => { await GUIActions.selectModelFromDropdown(view, "Mock"); @@ -55,5 +55,5 @@ describe("GUI Test", () => { await TestUtils.waitForElement(() => GUISelectors.getThreadMessageByText(view, "I'm fine"), ); - }).timeout(600000000); + }).timeout(20_000); }); From 92a688c7a8c1fe1ace3426fe2be521b9f5d55afb Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 17:58:34 -0800 Subject: [PATCH 20/29] cancelStream --- gui/src/pages/gui/Chat.tsx | 3 ++- gui/src/redux/thunks/cancelStream.ts | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gui/src/redux/thunks/cancelStream.ts diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 8545813bc..851a6f13b 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -57,6 +57,7 @@ import { setShowDialog, } from "../../redux/slices/uiSlice"; import { RootState } from "../../redux/store"; +import { cancelStream } from "../../redux/thunks/cancelStream"; import { exitEditMode } from "../../redux/thunks/exitEditMode"; import { streamResponseThunk } from "../../redux/thunks/streamResponse"; import { @@ -203,7 +204,7 @@ export function Chat() { isMetaEquivalentKeyPressed(e) && !e.shiftKey ) { - // dispatch(cancelGeneration()); TODO!!! + dispatch(cancelStream()); } }; window.addEventListener("keydown", listener); diff --git a/gui/src/redux/thunks/cancelStream.ts b/gui/src/redux/thunks/cancelStream.ts new file mode 100644 index 000000000..0f1a6aeca --- /dev/null +++ b/gui/src/redux/thunks/cancelStream.ts @@ -0,0 +1,14 @@ +import { createAsyncThunk } from "@reduxjs/toolkit"; +import { setInactive } from "../slices/sessionSlice"; +import { ThunkApiType } from "../store"; + +export const cancelStream = createAsyncThunk( + "chat/cancelStream", + async (messages, { dispatch, extra, getState }) => { + dispatch(setInactive()); + + // If the assistant message is empty, then remove it and the user message, placing the user input in the main text box + // TODO: Waiting until next release + // dispatch(clearLastEmptyResponse()); + }, +); From 781f27728b468140b947dfd45767911ea64b6eec Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 6 Dec 2024 17:59:44 -0800 Subject: [PATCH 21/29] test: ci --- extensions/vscode/e2e/tests/GUI.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index 6a5e820f8..e4db4df3b 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -44,7 +44,7 @@ describe("GUI Test", () => { }).timeout(20_000); it("should allow typing text in the editor", async () => { - await GUIActions.selectModelFromDropdown(view, "Mock"); + // await GUIActions.selectModelFromDropdown(view, "Mock"); await GUIActions.selectModelFromDropdown(view, "TEST LLM"); const tiptap = await GUISelectors.getTipTapEditor(view); From 1520d0815a4737228b729906cdb9d72851fbf63a Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 18:04:02 -0800 Subject: [PATCH 22/29] abortStream() --- gui/src/redux/thunks/cancelStream.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gui/src/redux/thunks/cancelStream.ts b/gui/src/redux/thunks/cancelStream.ts index 0f1a6aeca..dc23c04a6 100644 --- a/gui/src/redux/thunks/cancelStream.ts +++ b/gui/src/redux/thunks/cancelStream.ts @@ -1,11 +1,12 @@ import { createAsyncThunk } from "@reduxjs/toolkit"; -import { setInactive } from "../slices/sessionSlice"; +import { abortStream, setInactive } from "../slices/sessionSlice"; import { ThunkApiType } from "../store"; export const cancelStream = createAsyncThunk( "chat/cancelStream", async (messages, { dispatch, extra, getState }) => { dispatch(setInactive()); + dispatch(abortStream()); // If the assistant message is empty, then remove it and the user message, placing the user input in the main text box // TODO: Waiting until next release From 90603a6ccd7a713596bb8354a1d3c211f96a5c37 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 6 Dec 2024 18:04:33 -0800 Subject: [PATCH 23/29] test: log listbox --- extensions/vscode/e2e/selectors/GUI.selectors.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/vscode/e2e/selectors/GUI.selectors.ts b/extensions/vscode/e2e/selectors/GUI.selectors.ts index b4c88aacb..c1dbdbf78 100644 --- a/extensions/vscode/e2e/selectors/GUI.selectors.ts +++ b/extensions/vscode/e2e/selectors/GUI.selectors.ts @@ -26,7 +26,10 @@ export class GUISelectors { return SelectorUtils.getElementByDataTestId(view, "model-select-button"); } - public static getModelDropdownOption(view: WebView, option: string) { + public static async getModelDropdownOption(view: WebView, option: string) { + const listbox = await view.findWebElement(By.xpath('//*[@role="listbox"]')); + + console.log("LISTBOX", await listbox.getText()); return view.findWebElement( By.xpath(`//*[@role="listbox"]//*[contains(text(), "${option}")]`), ); From 27d20eb08b25b142a54641048670b036e201ea1d Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 6 Dec 2024 18:07:34 -0800 Subject: [PATCH 24/29] fix: ci tests --- extensions/vscode/e2e/selectors/GUI.selectors.ts | 5 +---- extensions/vscode/e2e/tests/GUI.test.ts | 2 +- extensions/vscode/package.json | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/extensions/vscode/e2e/selectors/GUI.selectors.ts b/extensions/vscode/e2e/selectors/GUI.selectors.ts index c1dbdbf78..b4c88aacb 100644 --- a/extensions/vscode/e2e/selectors/GUI.selectors.ts +++ b/extensions/vscode/e2e/selectors/GUI.selectors.ts @@ -26,10 +26,7 @@ export class GUISelectors { return SelectorUtils.getElementByDataTestId(view, "model-select-button"); } - public static async getModelDropdownOption(view: WebView, option: string) { - const listbox = await view.findWebElement(By.xpath('//*[@role="listbox"]')); - - console.log("LISTBOX", await listbox.getText()); + public static getModelDropdownOption(view: WebView, option: string) { return view.findWebElement( By.xpath(`//*[@role="listbox"]//*[contains(text(), "${option}")]`), ); diff --git a/extensions/vscode/e2e/tests/GUI.test.ts b/extensions/vscode/e2e/tests/GUI.test.ts index e4db4df3b..6a5e820f8 100644 --- a/extensions/vscode/e2e/tests/GUI.test.ts +++ b/extensions/vscode/e2e/tests/GUI.test.ts @@ -44,7 +44,7 @@ describe("GUI Test", () => { }).timeout(20_000); it("should allow typing text in the editor", async () => { - // await GUIActions.selectModelFromDropdown(view, "Mock"); + await GUIActions.selectModelFromDropdown(view, "Mock"); await GUIActions.selectModelFromDropdown(view, "TEST LLM"); const tiptap = await GUISelectors.getTipTapEditor(view); diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index f5beee189..9cf7db2b1 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -629,7 +629,7 @@ "e2e:clean": "rm -rf ./e2e/_output", "e2e:all": "npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:sign-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", "e2e:quick": "npm run e2e:compile && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", - "e2e:ci": "npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:test" + "e2e:ci": "npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test" }, "devDependencies": { "@biomejs/biome": "1.6.4", From 2d09fdcb295d88295bb375078d14965f1fb6d156 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 18:57:30 -0800 Subject: [PATCH 25/29] clean up logs --- core/context/retrieval/repoMapRequest.ts | 1 - core/util/constants.ts | 1 + core/util/history.ts | 4 ++-- core/util/treeSitter.ts | 8 +++++++- extensions/vscode/package-lock.json | 4 ++-- gui/src/components/FileIcon.tsx | 10 ++++++++-- gui/src/components/mainInput/ContextItemsPeek.tsx | 6 +++--- gui/src/hooks/useHistory.tsx | 5 +++-- gui/src/redux/slices/sessionSlice.ts | 3 ++- 9 files changed, 28 insertions(+), 14 deletions(-) create mode 100644 core/util/constants.ts diff --git a/core/context/retrieval/repoMapRequest.ts b/core/context/retrieval/repoMapRequest.ts index 57f2b339e..5c82ace95 100644 --- a/core/context/retrieval/repoMapRequest.ts +++ b/core/context/retrieval/repoMapRequest.ts @@ -66,7 +66,6 @@ This is the question that you should select relevant files for: "${input}"`; new AbortController().signal, ); const content = renderChatMessage(response); - console.debug("Repo map retrieval response: ", content); if (!content.includes("\n")) { return []; diff --git a/core/util/constants.ts b/core/util/constants.ts new file mode 100644 index 000000000..188fc0005 --- /dev/null +++ b/core/util/constants.ts @@ -0,0 +1 @@ +export const NEW_SESSION_TITLE = "New Session"; diff --git a/core/util/history.ts b/core/util/history.ts index 053c23455..622c2c9ce 100644 --- a/core/util/history.ts +++ b/core/util/history.ts @@ -3,8 +3,8 @@ import * as fs from "fs"; import { Session, SessionMetadata } from "../index.js"; import { ListHistoryOptions } from "../protocol/core.js"; +import { NEW_SESSION_TITLE } from "./constants.js"; import { getSessionFilePath, getSessionsListPath } from "./paths.js"; - function safeParseArray( value: string, errorMessage: string = "Error parsing array", @@ -80,7 +80,7 @@ class HistoryManager { console.log(`Error loading session: ${e}`); return { history: [], - title: "Failed to load session", + title: NEW_SESSION_TITLE, workspaceDirectory: "", sessionId: sessionId, }; diff --git a/core/util/treeSitter.ts b/core/util/treeSitter.ts index 8029c0609..daa12827d 100644 --- a/core/util/treeSitter.ts +++ b/core/util/treeSitter.ts @@ -231,7 +231,13 @@ export async function getSymbolsForFile( return; } - const tree = parser.parse(contents); + let tree: Parser.Tree; + try { + tree = parser.parse(contents); + } catch (e) { + console.log(`Error parsing file: ${filepath}`); + return; + } // console.log(`file: ${filepath}`); // Function to recursively find all named nodes (classes and functions) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 923f4c9b5..ea5966c13 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.244", + "version": "0.9.240", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.244", + "version": "0.9.240", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/gui/src/components/FileIcon.tsx b/gui/src/components/FileIcon.tsx index 8117ce734..96321348c 100644 --- a/gui/src/components/FileIcon.tsx +++ b/gui/src/components/FileIcon.tsx @@ -31,9 +31,15 @@ export default function FileIcon({ filename, height, width }: FileIconProps) { const sanitizedSVG = DOMPurify.sanitize(svg); return ( -
); } diff --git a/gui/src/components/mainInput/ContextItemsPeek.tsx b/gui/src/components/mainInput/ContextItemsPeek.tsx index 2f97af73b..1e3997930 100644 --- a/gui/src/components/mainInput/ContextItemsPeek.tsx +++ b/gui/src/components/mainInput/ContextItemsPeek.tsx @@ -9,11 +9,11 @@ import { getBasename } from "core/util"; import { useContext, useMemo, useState } from "react"; import { AnimatedEllipsis, lightGray, vscBackground } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { useAppSelector } from "../../redux/hooks"; +import { selectIsGatheringContext } from "../../redux/slices/sessionSlice"; import FileIcon from "../FileIcon"; import SafeImg from "../SafeImg"; import { getIconFromDropdownItem } from "./MentionList"; -import { useAppSelector } from "../../redux/hooks"; -import { selectIsGatheringContext } from "../../redux/slices/sessionSlice"; interface ContextItemsPeekProps { contextItems?: ContextItemWithId[]; @@ -172,7 +172,7 @@ function ContextItemsPeek({ {isGatheringContext ? ( <> - Gathering context... + Gathering context ) : ( diff --git a/gui/src/hooks/useHistory.tsx b/gui/src/hooks/useHistory.tsx index 4fcb20035..63252d8f1 100644 --- a/gui/src/hooks/useHistory.tsx +++ b/gui/src/hooks/useHistory.tsx @@ -1,5 +1,6 @@ import { Dispatch } from "@reduxjs/toolkit"; import { Session, SessionMetadata } from "core"; +import { NEW_SESSION_TITLE } from "core/util/constants"; import { renderChatMessage } from "core/util/messageContent"; import { useCallback, useContext } from "react"; import { IdeMessengerContext } from "../context/IdeMessenger"; @@ -65,7 +66,7 @@ function useHistory(dispatch: Dispatch) { } let currentTitle = title; - if (config?.ui?.getChatTitles && currentTitle === "New Session") { + if (config?.ui?.getChatTitles && currentTitle === NEW_SESSION_TITLE) { try { // Check if we have first assistant response let assistantResponse = history @@ -82,7 +83,7 @@ function useHistory(dispatch: Dispatch) { // Fallback if we get an error above or if the user has not set getChatTitles let newTitle = - currentTitle === "New Session" + currentTitle === NEW_SESSION_TITLE ? truncateText( renderChatMessage(history[0].message) .split("\n") diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 1b6f4d7f4..871b1e7eb 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -19,6 +19,7 @@ import { Session, ToolCall, } from "core"; +import { NEW_SESSION_TITLE } from "core/util/constants"; import { incrementalParseJson } from "core/util/incrementalParseJson"; import { renderChatMessage } from "core/util/messageContent"; import { v4 as uuidv4 } from "uuid"; @@ -86,7 +87,7 @@ function getBaseHistoryItem(): ChatHistoryItemWithMessageId { const initialState: SessionState = { history: [], isStreaming: false, - title: "New Session", + title: NEW_SESSION_TITLE, id: uuidv4(), selectedProfileId: "local", curCheckpointIndex: 0, From 16cb2e34f2db56688e165f556c056ab9e45380f1 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 19:04:50 -0800 Subject: [PATCH 26/29] clean more logs --- core/core.ts | 5 +---- core/indexing/docs/DocsService.ts | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/core/core.ts b/core/core.ts index 4dce3ca64..ddfacf5b9 100644 --- a/core/core.ts +++ b/core/core.ts @@ -860,10 +860,7 @@ export class Core { this.indexingCancellationController && !this.indexingCancellationController.signal.aborted ) { - return console.debug( - "Codebase indexing already in progress, skipping indexing of files\n" + - files.join("\n"), - ); + return; } this.indexingCancellationController = new AbortController(); for await (const update of (await this.codebaseIndexerPromise).refreshFiles( diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index 6e841f6be..b52577a5f 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -7,9 +7,9 @@ import { ContinueConfig, EmbeddingsProvider, IDE, + IdeInfo, IndexingStatus, SiteIndexingConfig, - IdeInfo, } from "../.."; import { ConfigHandler } from "../../config/ConfigHandler"; import { addContextProvider } from "../../config/util"; @@ -69,7 +69,6 @@ export type AddParams = { favicon?: string; }; - /* General process: - On config update: @@ -476,8 +475,6 @@ export default class DocsService { const embeddings: number[][] = []; // Create embeddings of retrieved articles - console.debug(`Creating embeddings for ${articles.length} articles`); - for (let i = 0; i < articles.length; i++) { const article = articles[i]; From 12018ec24d70afff4c7915c62000f9c917f0fabb Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Dec 2024 19:15:53 -0800 Subject: [PATCH 27/29] fix tests --- core/util/history.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/util/history.test.ts b/core/util/history.test.ts index 048087564..dbcf69619 100644 --- a/core/util/history.test.ts +++ b/core/util/history.test.ts @@ -1,6 +1,7 @@ import { v4 as uuidv4 } from "uuid"; import { Session } from ".."; +import { NEW_SESSION_TITLE } from "./constants"; import historyManager from "./history"; import { getSessionFilePath } from "./paths"; @@ -31,7 +32,7 @@ describe("No sessions have been created", () => { const session = historyManager.load(testSessionId); expect(session).toEqual({ history: [], - title: "Failed to load session", + title: NEW_SESSION_TITLE, workspaceDirectory: "", sessionId: testSessionId, }); From 767f7e1c9c7ecab7cc3515f0dabf3798a14df612 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 8 Dec 2024 21:30:03 -0800 Subject: [PATCH 28/29] fix autocomplete filtering cases --- .../streamTransforms/StreamTransformPipeline.ts | 7 +++++++ .../filtering/streamTransforms/lineStream.ts | 15 ++++++++++++++- core/autocomplete/filtering/test/testCases.ts | 12 ++++-------- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts b/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts index 55cde067a..180c339e6 100644 --- a/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts +++ b/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts @@ -10,6 +10,7 @@ import { showWhateverWeHaveAtXMs, skipPrefixes, stopAtLines, + stopAtLinesExact, stopAtRepeatingLines, stopAtSimilarLine, streamWithNewLines, @@ -42,6 +43,12 @@ export class StreamTransformPipeline { let lineGenerator = streamLines(charGenerator); lineGenerator = stopAtLines(lineGenerator, fullStop); + const lineBelowCursor = this.getLineBelowCursor(helper); + if (lineBelowCursor.trim() !== "") { + lineGenerator = stopAtLinesExact(lineGenerator, fullStop, [ + lineBelowCursor, + ]); + } lineGenerator = stopAtRepeatingLines(lineGenerator, fullStop); lineGenerator = avoidEmptyComments( lineGenerator, diff --git a/core/autocomplete/filtering/streamTransforms/lineStream.ts b/core/autocomplete/filtering/streamTransforms/lineStream.ts index aaeec1291..851dea88a 100644 --- a/core/autocomplete/filtering/streamTransforms/lineStream.ts +++ b/core/autocomplete/filtering/streamTransforms/lineStream.ts @@ -2,7 +2,6 @@ import { distance } from "fastest-levenshtein"; import { DiffLine } from "../../.."; import { LineStream } from "../../../diff/util"; -import { BRACKETS, BRACKETS_REVERSE } from "../BracketMatchingService"; export type LineFilter = (args: { lines: LineStream; @@ -270,6 +269,20 @@ export async function* stopAtLines( } } +export async function* stopAtLinesExact( + stream: LineStream, + fullStop: () => void, + linesToStopAt: string[], +): LineStream { + for await (const line of stream) { + if (linesToStopAt.some((stopAt) => line === stopAt)) { + fullStop(); + break; + } + yield line; + } +} + /** * Filters a LineStream, skipping specified prefixes on the first line. * @param {LineStream} lines - The input stream of lines. diff --git a/core/autocomplete/filtering/test/testCases.ts b/core/autocomplete/filtering/test/testCases.ts index 277c8cdc8..f83de1607 100644 --- a/core/autocomplete/filtering/test/testCases.ts +++ b/core/autocomplete/filtering/test/testCases.ts @@ -810,8 +810,7 @@ func main() {}`, }`, expectedCompletion: `string State string - ZipCode string -}`, + ZipCode string`, }, { @@ -1118,8 +1117,7 @@ impl Calculator { self.result /= number; } else { println!("Cannot divide by zero."); - } -}`, + }`, }, { description: "Should autocomplete Rust struct definition", @@ -1600,8 +1598,7 @@ interface User { age: number; }`, expectedCompletion: `mail: string; - age: number; -}`, + age: number;`, }, { description: "Should autocomplete TypeScript interface declarations", @@ -1853,8 +1850,7 @@ let john = { FirstName = "John"; LastName = "Doe"; Age = 30 }`, Address: string }`, expectedCompletion: ` - Address: string -}`, + Address: string`, }, { From fc11a987756ac0f43e1ae3ab1a624e7d77f44f2c Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 8 Dec 2024 21:30:22 -0800 Subject: [PATCH 29/29] update package.json --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 9cf7db2b1..b63ed82f9 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "0.9.241", + "version": "0.9.242", "repository": { "type": "git", "url": "https://github.com/continuedev/continue"