From 97cfc8ea9b9b11075fd3bae11b1f910c87302da8 Mon Sep 17 00:00:00 2001 From: "Michael C. McMinn" Date: Fri, 13 Dec 2024 14:50:32 -0500 Subject: [PATCH 01/12] Fix comment parsing to handle end of line inline comments --- extensions/vscode/src/util/getTheme.ts | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/extensions/vscode/src/util/getTheme.ts b/extensions/vscode/src/util/getTheme.ts index a4a570a19..113a5047f 100644 --- a/extensions/vscode/src/util/getTheme.ts +++ b/extensions/vscode/src/util/getTheme.ts @@ -11,12 +11,39 @@ import * as vscode from "vscode"; /** * Strip comments from theme */ + +function stripInLineComment(line: string): string { + let inString = false; + let pCh = ''; + + for (let i = 0; i < line.length-1; i++) { + const ch = line[i]; + const nCh = line[i + 1]; + + // If we're not in a string and we see '//' this is a comment. + if (!inString && ch === '/' && nCh === '/') { + // Stop processing this line from here. + return line.substring(0, i); + } + + // Toggle inString state if we see a double quote not escaped by a backslash. + if (ch === '"' && pCh !== '\\') { + inString = !inString; + } + + pCh = ch; + } + + return line; +} + function parseThemeString(themeString: string | undefined): any { themeString = themeString ?.split("\n") .filter((line) => { return !line.trim().startsWith("//"); }) + .map(stripInLineComment) .join("\n"); return JSON.parse(themeString ?? "{}"); } From cede708013f873236e129b944821bd672f6aca1b Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 13 Dec 2024 13:45:55 -0800 Subject: [PATCH 02/12] clear up confusion about fim logging --- extensions/vscode/src/util/getTheme.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/extensions/vscode/src/util/getTheme.ts b/extensions/vscode/src/util/getTheme.ts index a4a570a19..a130649d9 100644 --- a/extensions/vscode/src/util/getTheme.ts +++ b/extensions/vscode/src/util/getTheme.ts @@ -2,10 +2,7 @@ import * as fs from "node:fs"; import * as path from "node:path"; import mergeJson from "core/util/merge"; -import { - convertTheme, - IVSCodeTheme, -} from "monaco-vscode-textmate-theme-converter/lib/cjs"; +import { convertTheme } from "monaco-vscode-textmate-theme-converter/lib/cjs"; import * as vscode from "vscode"; /** @@ -61,7 +58,6 @@ export function getTheme() { ); break; default: - console.log("unknown color theme kind", activeColorTheme); colorTheme = workbenchConfig.get("workbench.colorTheme") ?? "Default Dark Modern"; From 1f36d425711a4277e0ca4926baf44b298bf04b1b Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 13 Dec 2024 13:46:08 -0800 Subject: [PATCH 03/12] fim logging change --- core/llm/index.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/core/llm/index.ts b/core/llm/index.ts index dc55f8a78..041693363 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -476,15 +476,13 @@ export abstract class BaseLLM implements ILLM { ): AsyncGenerator { const { completionOptions, log } = this._parseCompletionOptions(options); - const madeUpFimPrompt = `<|fim_prefix|>${prefix}<|fim_suffix|>${suffix}<|fim_middle|>`; + const fimLog = `Prefix: ${prefix}\nSuffix: ${suffix}`; if (log) { if (this.writeLog) { - await this.writeLog( - this._compileLogMessage(madeUpFimPrompt, completionOptions), - ); + await this.writeLog(this._compileLogMessage(fimLog, completionOptions)); } if (this.llmRequestHook) { - this.llmRequestHook(completionOptions.model, madeUpFimPrompt); + this.llmRequestHook(completionOptions.model, fimLog); } } @@ -515,18 +513,14 @@ export abstract class BaseLLM implements ILLM { } } - this._logTokensGenerated( - completionOptions.model, - madeUpFimPrompt, - completion, - ); + this._logTokensGenerated(completionOptions.model, fimLog, completion); if (log && this.writeLog) { await this.writeLog(`Completion:\n${completion}\n\n`); } return { - prompt: madeUpFimPrompt, + prompt: fimLog, completion, completionOptions, }; From e42b73f49c7047af6d2c64ce81eacec8ea25ed0e Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Fri, 13 Dec 2024 13:49:37 -0800 Subject: [PATCH 04/12] Change name to Azure AI Foundry --- .../model-providers/top-level/azure.md | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/docs/docs/customize/model-providers/top-level/azure.md b/docs/docs/customize/model-providers/top-level/azure.md index edd890d37..45b49f734 100644 --- a/docs/docs/customize/model-providers/top-level/azure.md +++ b/docs/docs/customize/model-providers/top-level/azure.md @@ -1,13 +1,13 @@ --- -title: Azure OpenAI +title: Azure AI Foundry slug: ../azure --- -Azure OpenAI is a cloud-based service that provides access to OpenAI's models, integrated with the security and enterprise features of the Microsoft Azure platform. To get started, create an Azure OpenAI resource in the [Azure portal](https://portal.azure.com). +Azure AI Foundry is a cloud-based service that provides access to models from OpenAI, Mistral AI, and others, integrated with the security and enterprise features of the Microsoft Azure platform. To get started, create an Azure AI Foundry resource in the [Azure portal](https://portal.azure.com). :::info -For details on model setup, see [General model configuration](#general-model-configuration). +For details on OpenAI model setup, see [Azure OpenAI Service configuration](#general-model-configuration). ::: @@ -28,13 +28,17 @@ We recommend configuring **GPT-4o** as your chat model. ## Autocomplete model -Azure OpenAI currently does not offer any autocomplete models. +We recommend configuring **Codestral** as your autocomplete model. -[Click here](../../model-types/autocomplete.md) to see a list of autocomplete models. - -:::info -**Codestral** will be available on Azure in the near future. -::: +```json title="config.json" +{ + "tabAutocompleteModel": { + "title": "Codestral", + "provider": "mistral", + "model": "codestral-latest" + } +} +``` ## Embeddings model @@ -67,11 +71,11 @@ You need to apply for access to the Azure OpenAI service. Response times are typ **[Click here to apply for access to the Azure OpenAI service](https://azure.microsoft.com/en-us/products/ai-services/openai-service)** ::: -## General model configuration +## Azure OpenAI Service configuration -Azure OpenAI requires a handful of additional parameters to be configured, such as a deployment name and API base URL. +Azure OpenAI Service requires a handful of additional parameters to be configured, such as a deployment name and API base URL. -To find this information in _Azure AI Studio_, first select the model that you would like to connect. Then visit _Endpoint_ > _Target URI_. +To find this information in _Azure AI Foundry_, first select the model that you would like to connect. Then visit _Endpoint_ > _Target URI_. For example, a Target URI of `https://just-an-example.openai.azure.com/openai/deployments/gpt-4o-july/chat/completions?api-version=2023-03-15-preview` would map to the following: From adb9d7cac993cb97a505625226614b7c15f607f3 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 15:53:36 -0800 Subject: [PATCH 05/12] ci: cache vscode and chromedriver --- .github/workflows/pr_checks.yaml | 25 ++++++++++++++++++++++++- extensions/vscode/package.json | 3 ++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 660960077..25f11a950 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -202,14 +202,35 @@ jobs: - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" + - uses: actions/cache@v4 + id: vscode-node-modules-cache with: path: extensions/vscode/node_modules key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} + - uses: actions/cache@v4 + id: core-node-modules-cache with: path: core/node_modules key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} + + - uses: actions/cache@v4 + id: chromedriver-cache + with: + path: ~/.cache/chromedriver + key: ${{ runner.os }}-chromedriver-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - uses: actions/cache@v4 + id: vscode-cache + with: + path: ~/.vscode-test + key: ${{ runner.os }}-vscode-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - name: Download Dependencies if Cache Miss + if: steps.chromedriver-cache.outputs.cache-hit != 'true' || steps.vscode-cache.outputs.cache-hit != 'true' + run: npm run e2e:ci:download + - name: Set up SSH env: SSH_KEY: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }} @@ -220,6 +241,7 @@ jobs: chmod 600 ~/.ssh/id_rsa ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts echo -e "Host ssh-test-container\n\tHostName $SSH_HOST\n\tUser ec2-user\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config + - name: Install Xvfb for Linux and run e2e tests run: | sudo apt-get install -y xvfb # Install Xvfb @@ -227,7 +249,8 @@ jobs: export DISPLAY=:99 # Export the display number to the environment cd extensions/vscode npm run package - npm run e2e:ci + npm run e2e:ci:run + - name: Upload e2e test screenshots if: failure() uses: actions/upload-artifact@v4 diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index ba3b4e2e2..9aa7c22ae 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -633,7 +633,8 @@ "e2e:clean": "rm -rf ./e2e/_output", "e2e:all": "npm run e2e:build && 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:install-extensions && 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:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test" + "e2e:ci:download": "npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode", + "e2e:ci:run": "npm run e2e:compile && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test" }, "devDependencies": { "@biomejs/biome": "1.6.4", From 0d88b8f379d161962a72626fe2af583cce0f3fe0 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 16:20:02 -0800 Subject: [PATCH 06/12] fix: missing cd --- .github/workflows/pr_checks.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 25f11a950..31d18a1b4 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -229,7 +229,9 @@ jobs: - name: Download Dependencies if Cache Miss if: steps.chromedriver-cache.outputs.cache-hit != 'true' || steps.vscode-cache.outputs.cache-hit != 'true' - run: npm run e2e:ci:download + run: | + cd extensions/vscode + npm run e2e:ci:download - name: Set up SSH env: From 368d264d221793b7f2439678cef9b8b032135529 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 16:34:01 -0800 Subject: [PATCH 07/12] fix: cache --- .github/workflows/pr_checks.yaml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 31d18a1b4..21e043c7a 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -216,19 +216,13 @@ jobs: key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - uses: actions/cache@v4 - id: chromedriver-cache + id: storage-cache with: - path: ~/.cache/chromedriver - key: ${{ runner.os }}-chromedriver-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: vscode-cache - with: - path: ~/.vscode-test + path: extensions/vscode/e2e/storage key: ${{ runner.os }}-vscode-${{ hashFiles('extensions/vscode/package-lock.json') }} - name: Download Dependencies if Cache Miss - if: steps.chromedriver-cache.outputs.cache-hit != 'true' || steps.vscode-cache.outputs.cache-hit != 'true' + if: steps.storage.outputs.cache-hit != 'true' run: | cd extensions/vscode npm run e2e:ci:download From a1d7c0e561579f81c871d8d6ffcb9c73fd9ab827 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 16:46:15 -0800 Subject: [PATCH 08/12] ci: test --- 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 9aa7c22ae..ced753f29 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -629,7 +629,7 @@ "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:install-extensions": "extest install-from-marketplace ms-vscode-remote.remote-ssh --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage && extest install-from-marketplace ms-vscode-remote.remote-containers --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage && extest install-from-marketplace ms-vscode-remote.remote-wsl --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:test": "extest run-tests './e2e/_output/tests/GUI.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:build && 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:install-extensions && 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", From 4d50da0f7aa71656de31f84ba8f5ca44e2c96736 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 16:53:23 -0800 Subject: [PATCH 09/12] ci: update cache --- .github/workflows/pr_checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 21e043c7a..a61552cf7 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -219,7 +219,7 @@ jobs: id: storage-cache with: path: extensions/vscode/e2e/storage - key: ${{ runner.os }}-vscode-${{ hashFiles('extensions/vscode/package-lock.json') }} + key: ${{ runner.os }}-vscode-storage-${{ hashFiles('extensions/vscode/package-lock.json') }} - name: Download Dependencies if Cache Miss if: steps.storage.outputs.cache-hit != 'true' From 1fd48c7a6fc225ec6cfc2fff928b0ef2ec56a0c4 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 17:10:18 -0800 Subject: [PATCH 10/12] ci: fix cache id --- .github/workflows/pr_checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index a61552cf7..a9546e849 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -222,7 +222,7 @@ jobs: key: ${{ runner.os }}-vscode-storage-${{ hashFiles('extensions/vscode/package-lock.json') }} - name: Download Dependencies if Cache Miss - if: steps.storage.outputs.cache-hit != 'true' + if: steps.storage-cache.outputs.cache-hit != 'true' run: | cd extensions/vscode npm run e2e:ci:download From 0b0cd213238de19fd0cdc521ef911c4fee8b3ef9 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 17:17:01 -0800 Subject: [PATCH 11/12] ci: restore all tests --- 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 ced753f29..9aa7c22ae 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -629,7 +629,7 @@ "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:install-extensions": "extest install-from-marketplace ms-vscode-remote.remote-ssh --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage && extest install-from-marketplace ms-vscode-remote.remote-containers --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage && extest install-from-marketplace ms-vscode-remote.remote-wsl --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", - "e2e:test": "extest run-tests './e2e/_output/tests/GUI.test.js' --code_settings settings.json --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:build && 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:install-extensions && 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", From 8d3aac314ef68fe8d99b7ce87603c3c2d3dc580f Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Fri, 13 Dec 2024 17:28:12 -0800 Subject: [PATCH 12/12] ci: fix flaky ssh test --- extensions/vscode/e2e/tests/SSH.test.ts | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/extensions/vscode/e2e/tests/SSH.test.ts b/extensions/vscode/e2e/tests/SSH.test.ts index 261f9ab90..664776a9c 100644 --- a/extensions/vscode/e2e/tests/SSH.test.ts +++ b/extensions/vscode/e2e/tests/SSH.test.ts @@ -13,11 +13,7 @@ import { SSHSelectors } from "../selectors/SSH.selectors"; import { AutocompleteActions } from "../actions/Autocomplete.actions"; describe("SSH", function () { - this.retries(2); - - beforeEach(async function () { - this.timeout(DEFAULT_TIMEOUT.XL); - + it("Should display completions", async () => { await TestUtils.waitForSuccess(async () => { await new Workbench().executeCommand( "Remote-SSH: Connect Current Window to Host...", @@ -32,13 +28,6 @@ describe("SSH", function () { DEFAULT_TIMEOUT.XL, ); - // await TestUtils.waitForSuccess(async () => { - // await new Workbench().executeCommand("File: Open Folder..."); - // const inputBox = await InputBox.create(DEFAULT_TIMEOUT.MD); - // await inputBox.setText("/home/ec2-user/test-folder"); - // await inputBox.sendKeys(Key.ENTER); - // }); - await TestUtils.waitForSuccess(async () => { await new Workbench().executeCommand("File: Open File..."); const inputBox = await InputBox.create(DEFAULT_TIMEOUT.MD); @@ -46,9 +35,7 @@ describe("SSH", function () { await inputBox.selectQuickPick("main.py"); await inputBox.sendKeys(Key.ENTER); }, DEFAULT_TIMEOUT.XL); - }); - it("Should display completions", async () => { const editor = await TestUtils.waitForSuccess( async () => (await new EditorView().openEditor("main.py")) as TextEditor, ); @@ -57,5 +44,7 @@ describe("SSH", function () { await editor.clearText(); await AutocompleteActions.testCompletions(editor); await editor.setText(text); - }).timeout(DEFAULT_TIMEOUT.XL); + }) + .timeout(DEFAULT_TIMEOUT.XL) + .retries(2); });