From 17dbfe6bfd38f67b7cb535da00fa626cdaf4f690 Mon Sep 17 00:00:00 2001 From: Aplulu Date: Fri, 21 Feb 2025 02:49:36 +0900 Subject: [PATCH 01/53] fix: Resolve proxy error when adding Azure OpenAI model --- packages/openai-adapters/src/apis/AzureOpenAI.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/openai-adapters/src/apis/AzureOpenAI.ts b/packages/openai-adapters/src/apis/AzureOpenAI.ts index 2b02af69d..fc9fbdda8 100644 --- a/packages/openai-adapters/src/apis/AzureOpenAI.ts +++ b/packages/openai-adapters/src/apis/AzureOpenAI.ts @@ -40,8 +40,10 @@ export class AzureOpenAIApi implements BaseLlmApi { if (PROXY) { const url = new URL(PROXY); proxyOptions = { - host: url.hostname, - port: Number(url.port), + host: (url.protocol ? url.protocol + "//" : "") + url.hostname, + port: Number(url.port || 80), + username: url.username, + password: url.password, }; } From ad73f4eaa58bfde4d710d8a276d08db6ea4891d1 Mon Sep 17 00:00:00 2001 From: ferenci84 Date: Fri, 21 Feb 2025 17:59:56 +0100 Subject: [PATCH 02/53] modify condition to ignore non-file URIs in RecentlyEditedTracker --- extensions/vscode/src/autocomplete/recentlyEdited.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extensions/vscode/src/autocomplete/recentlyEdited.ts b/extensions/vscode/src/autocomplete/recentlyEdited.ts index 69b9b4d0f..d32f362dd 100644 --- a/extensions/vscode/src/autocomplete/recentlyEdited.ts +++ b/extensions/vscode/src/autocomplete/recentlyEdited.ts @@ -47,7 +47,7 @@ export class RecentlyEditedTracker { editedRange: Omit, ): Promise { - if (editedRange.uri.scheme === "output") { + if (editedRange.uri.scheme !== "file") { return; } @@ -83,7 +83,6 @@ export class RecentlyEditedTracker { RecentlyEditedTracker.maxRecentlyEditedRanges, ); } - } private insertDocument(uri: vscode.Uri): void { From b02e6ba660b493fcd62742dfb2010c90b88a2656 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 27 Feb 2025 11:47:20 -0800 Subject: [PATCH 03/53] fix markdown patch --- .../markdown/utils/patchNestedMarkdown.ts | 68 ++++--------------- 1 file changed, 13 insertions(+), 55 deletions(-) diff --git a/gui/src/components/markdown/utils/patchNestedMarkdown.ts b/gui/src/components/markdown/utils/patchNestedMarkdown.ts index 29b305b26..b8be69ae7 100644 --- a/gui/src/components/markdown/utils/patchNestedMarkdown.ts +++ b/gui/src/components/markdown/utils/patchNestedMarkdown.ts @@ -8,9 +8,8 @@ // TODO support github-specific markdown as well, edge case */ - export const patchNestedMarkdown = (source: string): string => { - if (!source.match(/```(md|markdown)/)) return source; // For performance + if (!source.match(/```(\w+\.(md|markdown))/)) return source; // For performance // const start = Date.now(); let nestCount = 0; const lines = source.split("\n"); @@ -28,9 +27,18 @@ export const patchNestedMarkdown = (source: string): string => { } } else { // Enter the markdown block, start tracking nesting - if (line.startsWith("```md") || line.startsWith("```markdown")) { - nestCount = 1; - lines[i] = lines[i].replace(/```(md|markdown)/, "~~~"); // Replace backticks with tildes + if (line.startsWith("```")) { + const header = line.replaceAll("`", ""); + const file = header.split(" ")[0]; + + if (file) { + const ext = file.split(".").at(-1); + debugger; + if (ext === "md" || ext === "markdown") { + nestCount = 1; + lines[i] = lines[i].replaceAll("`", "~"); // Replace backticks with tildes + } + } } } } @@ -38,53 +46,3 @@ export const patchNestedMarkdown = (source: string): string => { // console.log(`patched in ${Date.now() - start}ms`); return out; }; - -// This version tries to detect if a codeblock without a language specified is a starter codeblock -// It tries again if didn't come back to root nesting, without checking for that ^ -// I didn't use for performance and also because the root nest check doesn't make sense mid-generation - -// export const patchNestedMarkdown = (source: string): string => { -// const start = Date.now(); - -// let attempts = 0; - -// while (attempts <= 2) { -// let nestCount = 0; -// const lines = source.split("\n"); -// const trimmedLines = lines.map((l) => l.trim()); -// for (let i = 0; i < trimmedLines.length; i++) { -// const line = trimmedLines[i]; -// if (nestCount) { -// if (line.match(/^`+$/)) { -// if (attempts === 0 && i !== lines.length && lines[i + 1] !== "") { -// nestCount++; -// continue; -// } -// if (nestCount === 1) lines[i] = "~~~"; -// nestCount--; -// } else if (line.startsWith("```")) { -// // Going into a nested codeblock -// nestCount++; -// } -// } else { -// // Enter the markdown block, start tracking nesting -// if (line.startsWith("```md") || line.startsWith("```markdown")) { -// nestCount = 1; -// lines[i] = lines[i].replace(/^```(md|markdown)/, "~~~"); // Replace backticks with tildes -// } -// } -// } -// if (nestCount === 0) { -// console.log( -// `patch successful in ${Date.now() - start} ms with ${attempts} attempts`, -// ); -// return lines.join("\n"); -// } -// attempts++; -// } - -// console.log( -// `patch failed in ${Date.now() - start} ms with ${attempts} attempts`, -// ); -// return source; -// }; From e2e8e3990a40fe4ff49d8ce6ac21f1a85e1f5b62 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 27 Feb 2025 11:49:01 -0800 Subject: [PATCH 04/53] cleanup --- gui/src/components/markdown/utils/patchNestedMarkdown.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/gui/src/components/markdown/utils/patchNestedMarkdown.ts b/gui/src/components/markdown/utils/patchNestedMarkdown.ts index b8be69ae7..10d5af1b2 100644 --- a/gui/src/components/markdown/utils/patchNestedMarkdown.ts +++ b/gui/src/components/markdown/utils/patchNestedMarkdown.ts @@ -33,7 +33,6 @@ export const patchNestedMarkdown = (source: string): string => { if (file) { const ext = file.split(".").at(-1); - debugger; if (ext === "md" || ext === "markdown") { nestCount = 1; lines[i] = lines[i].replaceAll("`", "~"); // Replace backticks with tildes From 037545fd77e2439afaf09408c12fd7a25dec35a9 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 1 Mar 2025 10:52:38 -0800 Subject: [PATCH 05/53] stale-issue-helper dry run --- .github/workflows/stale-issue-helper.yaml | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/stale-issue-helper.yaml diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml new file mode 100644 index 000000000..c6d4c415a --- /dev/null +++ b/.github/workflows/stale-issue-helper.yaml @@ -0,0 +1,25 @@ +name: "Label stale issues and PRs" +on: + schedule: + - cron: "*/5 * * * *" + +jobs: + stale: + runs-on: ubuntu-latest + strategy: + matrix: + assignee: [sestinj, Patrick-Erichsen, tomasz-stefaniak, RomneyDa] + steps: + - uses: actions/stale@v9 + with: + stale-issue-message: "This issue hasn't been updated in a while. @${{ matrix.assignee }} can you take a look?" + stale-pr-message: "This PR hasn't been updated in a while. @${{ matrix.assignee }} can you take a look?" + days-before-stale: 180 + days-before-close: -1 + days-before-pr-close: -1 + stale-issue-label: "stale" + stale-pr-label: "stale" + debug-only: true + exempt-issue-labels: "needs-triage,no-stale" + exempt-pr-labels: "no-stale,no-stale" + exempt-assignees: ${{ toJSON(fromJSON('["sestinj", "Patrick-Erichsen", "tomasz-stefaniak", "RomneyDa"]').filter(user => user != matrix.assignee)) }} From 3acbc68df82ebfd03ffbd13fdb317cf3c0e0f6df Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 1 Mar 2025 10:53:22 -0800 Subject: [PATCH 06/53] run on push --- .github/workflows/stale-issue-helper.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index c6d4c415a..11c651cd7 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -1,7 +1,10 @@ name: "Label stale issues and PRs" on: + push: + branches: + - nate/stale-issue-helper schedule: - - cron: "*/5 * * * *" + - cron: "30 1 * * *" jobs: stale: From 17e5eb912f640f9cf19ef3d52ed8cfdd72e49a7b Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 1 Mar 2025 11:12:09 -0800 Subject: [PATCH 07/53] use excluded-assignees --- .github/workflows/stale-issue-helper.yaml | 16 +++++++++++++- scripts/getExcludedAssignees.js | 27 +++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 scripts/getExcludedAssignees.js diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 11c651cd7..4bfc83dee 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -13,6 +13,20 @@ jobs: matrix: assignee: [sestinj, Patrick-Erichsen, tomasz-stefaniak, RomneyDa] steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + + - name: Compute excluded assignees + id: excluded-assignees + run: | + node ./scripts/getExcludedAssignees.js sestinj,Patrick-Erichsen,tomasz-stefaniak,RomneyDa ${{ matrix.assignee }} + + echo "excluded_assignees=$result" >> $GITHUB_OUTPUT + - uses: actions/stale@v9 with: stale-issue-message: "This issue hasn't been updated in a while. @${{ matrix.assignee }} can you take a look?" @@ -25,4 +39,4 @@ jobs: debug-only: true exempt-issue-labels: "needs-triage,no-stale" exempt-pr-labels: "no-stale,no-stale" - exempt-assignees: ${{ toJSON(fromJSON('["sestinj", "Patrick-Erichsen", "tomasz-stefaniak", "RomneyDa"]').filter(user => user != matrix.assignee)) }} + exempt-assignees: ${{ steps.excluded-assignees.outputs.excluded_assignees }} diff --git a/scripts/getExcludedAssignees.js b/scripts/getExcludedAssignees.js new file mode 100644 index 000000000..e6ac5904c --- /dev/null +++ b/scripts/getExcludedAssignees.js @@ -0,0 +1,27 @@ +#!/usr/bin/env node + +function removeStringFromList(list, stringToRemove) { + return list.filter((item) => item !== stringToRemove); +} + +function main() { + // Get command line arguments + const args = process.argv.slice(2); + + if (args.length < 2) { + console.error( + "Usage: node script.js ", + ); + process.exit(1); + } + + const list = args[0].split(","); + const stringToRemove = args[1]; + + const result = removeStringFromList(list, stringToRemove); + + // Output the result as comma-separated values + console.log(result.join(",")); +} + +main(); From 22c296867638ff5a149c96a2ae7a128516f8f8c5 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 1 Mar 2025 11:17:55 -0800 Subject: [PATCH 08/53] include only assigned --- .github/workflows/stale-issue-helper.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 4bfc83dee..f2780530f 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -40,3 +40,4 @@ jobs: exempt-issue-labels: "needs-triage,no-stale" exempt-pr-labels: "no-stale,no-stale" exempt-assignees: ${{ steps.excluded-assignees.outputs.excluded_assignees }} + include-only-assigned: true From a6160ce3433427ba5258645290b028a3291540e5 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 1 Mar 2025 11:20:05 -0800 Subject: [PATCH 09/53] fx --- .github/workflows/stale-issue-helper.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index f2780530f..2c5a00b19 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -23,8 +23,9 @@ jobs: - name: Compute excluded assignees id: excluded-assignees run: | - node ./scripts/getExcludedAssignees.js sestinj,Patrick-Erichsen,tomasz-stefaniak,RomneyDa ${{ matrix.assignee }} + result=$(node ./scripts/getExcludedAssignees.js sestinj,Patrick-Erichsen,tomasz-stefaniak,RomneyDa ${{ matrix.assignee }}) + echo "Result: $result" echo "excluded_assignees=$result" >> $GITHUB_OUTPUT - uses: actions/stale@v9 From 0b78baf289283ab73359980d29a3648064220538 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 1 Mar 2025 11:26:54 -0800 Subject: [PATCH 10/53] env --- .github/workflows/stale-issue-helper.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 2c5a00b19..6b8747e8a 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -9,9 +9,11 @@ on: jobs: stale: runs-on: ubuntu-latest + env: + TEAM_MEMBERS: "sestinj,Patrick-Erichsen,tomasz-stefaniak,RomneyDa" strategy: matrix: - assignee: [sestinj, Patrick-Erichsen, tomasz-stefaniak, RomneyDa] + assignee: ${{ env.TEAM_MEMBERS }} steps: - uses: actions/checkout@v4 @@ -23,7 +25,7 @@ jobs: - name: Compute excluded assignees id: excluded-assignees run: | - result=$(node ./scripts/getExcludedAssignees.js sestinj,Patrick-Erichsen,tomasz-stefaniak,RomneyDa ${{ matrix.assignee }}) + result=$(node ./scripts/getExcludedAssignees.js ${{ env.TEAM_MEMBERS }} ${{ matrix.assignee }}) echo "Result: $result" echo "excluded_assignees=$result" >> $GITHUB_OUTPUT @@ -39,6 +41,6 @@ jobs: stale-pr-label: "stale" debug-only: true exempt-issue-labels: "needs-triage,no-stale" - exempt-pr-labels: "no-stale,no-stale" + exempt-pr-labels: "no-stale" exempt-assignees: ${{ steps.excluded-assignees.outputs.excluded_assignees }} include-only-assigned: true From db35636b71c05e787efc1af35ece6cfd993dd759 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 1 Mar 2025 11:28:02 -0800 Subject: [PATCH 11/53] fix --- .github/workflows/stale-issue-helper.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 6b8747e8a..891908f7c 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -13,7 +13,7 @@ jobs: TEAM_MEMBERS: "sestinj,Patrick-Erichsen,tomasz-stefaniak,RomneyDa" strategy: matrix: - assignee: ${{ env.TEAM_MEMBERS }} + assignee: [sestinj, Patrick-Erichsen, tomasz-stefaniak, RomneyDa] steps: - uses: actions/checkout@v4 From 2376ed817a15187ea1e8f2f2545881b4d2788aa4 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Sun, 2 Mar 2025 15:51:37 -0800 Subject: [PATCH 12/53] handle URI query params --- core/core.ts | 20 ++++++---- core/index.d.ts | 3 +- core/protocol/coreWebview.ts | 5 ++- extensions/vscode/package.json | 1 + .../vscode/src/extension/VsCodeExtension.ts | 39 ++++++++++++++++++- .../vscode/src/stubs/WorkOsAuthProvider.ts | 13 +++---- extensions/vscode/src/stubs/uriHandler.ts | 10 +++++ gui/src/components/TabBar/TabBar.tsx | 4 -- 8 files changed, 73 insertions(+), 22 deletions(-) create mode 100644 extensions/vscode/src/stubs/uriHandler.ts diff --git a/core/core.ts b/core/core.ts index 6d78ca855..c5b5a064a 100644 --- a/core/core.ts +++ b/core/core.ts @@ -950,15 +950,21 @@ export class Core { }); // - on("didChangeSelectedProfile", (msg) => { - void this.configHandler.setSelectedProfile(msg.data.id); - void this.configHandler.reloadConfig(); + on("didChangeSelectedProfile", async (msg) => { + await this.configHandler.setSelectedProfile(msg.data.id); + await this.configHandler.reloadConfig(); }); - on("didChangeSelectedOrg", (msg) => { - void this.configHandler.setSelectedOrgId(msg.data.id); - void this.configHandler.reloadConfig(); - void this.configHandler.loadAssistantsForSelectedOrg(); + on("didChangeSelectedOrg", async (msg) => { + await this.configHandler.setSelectedOrgId(msg.data.id); + await this.configHandler.loadAssistantsForSelectedOrg(); + if (msg.data.profileId) { + this.invoke("didChangeSelectedProfile", { + id: msg.data.profileId, + }); + } else { + await this.configHandler.reloadConfig(); + } }); on("didChangeControlPlaneSessionInfo", async (msg) => { diff --git a/core/index.d.ts b/core/index.d.ts index 7cbf0e25b..f34a7fbc9 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -920,8 +920,9 @@ export interface BaseCompletionOptions { } export interface ModelCapability { - uploadImage?: boolean; tools?: boolean; + uploadImage?: boolean; + outputImage?: boolean; } export interface ModelDescription { diff --git a/core/protocol/coreWebview.ts b/core/protocol/coreWebview.ts index 67b5919a4..5e71e5f11 100644 --- a/core/protocol/coreWebview.ts +++ b/core/protocol/coreWebview.ts @@ -5,7 +5,10 @@ import { ToWebviewFromIdeOrCoreProtocol } from "./webview.js"; export type ToCoreFromWebviewProtocol = ToCoreFromIdeOrWebviewProtocol & { didChangeSelectedProfile: [{ id: string | null }, void]; - didChangeSelectedOrg: [{ id: string | null }, void]; + didChangeSelectedOrg: [ + { id: string | null; profileId?: string | null }, + void, + ]; }; export type ToWebviewFromCoreProtocol = ToWebviewFromIdeOrCoreProtocol & { didChangeAvailableProfiles: [ diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 366da7ff5..9ee40b4a0 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -52,6 +52,7 @@ "llama" ], "activationEvents": [ + "onUri", "onStartupFinished", "onView:continueGUIView" ], diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index 8953c91a0..814f6be97 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -28,6 +28,7 @@ import { registerAllPromptFilesCompletionProviders } from "../lang-server/prompt import EditDecorationManager from "../quickEdit/EditDecorationManager"; import { QuickEdit } from "../quickEdit/QuickEditQuickPick"; import { setupRemoteConfigSync } from "../stubs/activation"; +import { UriEventHandler } from "../stubs/uriHandler"; import { getControlPlaneSessionInfo, WorkOsAuthProvider, @@ -55,10 +56,11 @@ export class VsCodeExtension { private battery: Battery; private workOsAuthProvider: WorkOsAuthProvider; private fileSearch: FileSearch; + private uriHandler = new UriEventHandler(); constructor(context: vscode.ExtensionContext) { // Register auth provider - this.workOsAuthProvider = new WorkOsAuthProvider(context); + this.workOsAuthProvider = new WorkOsAuthProvider(context, this.uriHandler); this.workOsAuthProvider.refreshSessions(); context.subscriptions.push(this.workOsAuthProvider); @@ -193,6 +195,41 @@ export class VsCodeExtension { ), ); + // Handle uri events + this.uriHandler.event((uri) => { + const queryParams = new URLSearchParams(uri.query); + let profileId = queryParams.get("profile_id"); + let orgId = queryParams.get("org_id"); + + if (orgId) { + if (orgId === "null") { + orgId = null; + } + // In case org id is passed with profile id + // Make sure org is updated before profile is set + if (profileId) { + if (profileId === "null") { + profileId = null; + } + this.core.invoke("didChangeSelectedOrg", { + id: orgId, + profileId, + }); + } else { + this.core.invoke("didChangeSelectedOrg", { + id: orgId, + }); + } + } else if (profileId) { + if (profileId === "null") { + profileId = null; + } + this.core.invoke("didChangeSelectedProfile", { + id: profileId, + }); + } + }); + // Battery this.battery = new Battery(); context.subscriptions.push(this.battery); diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index 8f0e00c8c..30151d565 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -15,13 +15,13 @@ import { ExtensionContext, ProgressLocation, Uri, - UriHandler, window, workspace, } from "vscode"; import { PromiseAdapter, promiseFromEvent } from "./promiseUtils"; import { SecretStorage } from "./SecretStorage"; +import { UriEventHandler } from "./uriHandler"; const AUTH_NAME = "Continue"; @@ -35,11 +35,6 @@ const controlPlaneEnv = getControlPlaneEnvSync( const SESSIONS_SECRET_KEY = `${controlPlaneEnv.AUTH_TYPE}.sessions`; -class UriEventHandler extends EventEmitter implements UriHandler { - public handleUri(uri: Uri) { - this.fire(uri); - } -} // Function to generate a random string of specified length function generateRandomString(length: number): string { const possibleCharacters = @@ -83,13 +78,15 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { string, { promise: Promise; cancel: EventEmitter } >(); - private _uriHandler = new UriEventHandler(); private static EXPIRATION_TIME_MS = 1000 * 60 * 15; // 15 minutes private secretStorage: SecretStorage; - constructor(private readonly context: ExtensionContext) { + constructor( + private readonly context: ExtensionContext, + private readonly _uriHandler: UriEventHandler, + ) { this._disposable = Disposable.from( authentication.registerAuthenticationProvider( controlPlaneEnv.AUTH_TYPE, diff --git a/extensions/vscode/src/stubs/uriHandler.ts b/extensions/vscode/src/stubs/uriHandler.ts new file mode 100644 index 000000000..cc324f856 --- /dev/null +++ b/extensions/vscode/src/stubs/uriHandler.ts @@ -0,0 +1,10 @@ +import * as vscode from "vscode"; + +export class UriEventHandler + extends vscode.EventEmitter + implements vscode.UriHandler +{ + public handleUri(uri: vscode.Uri) { + this.fire(uri); + } +} diff --git a/gui/src/components/TabBar/TabBar.tsx b/gui/src/components/TabBar/TabBar.tsx index 859f6e90c..3b87a23c6 100644 --- a/gui/src/components/TabBar/TabBar.tsx +++ b/gui/src/components/TabBar/TabBar.tsx @@ -155,10 +155,6 @@ export function TabBar() { ); const tabs = useSelector((state: RootState) => state.tabs.tabs); - useEffect(() => { - console.log("session", currentSession); - }, [currentSession.id]); - // Simple UUID generator for our needs const generateId = useCallback(() => { return Date.now().toString(36) + Math.random().toString(36).substring(2); From b6bfb222f94b2528d33579cdff67be011dda8e55 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 19:53:47 -0800 Subject: [PATCH 13/53] auto close --- .github/workflows/stale-issue-helper.yaml | 31 +++-------------------- scripts/getExcludedAssignees.js | 27 -------------------- 2 files changed, 4 insertions(+), 54 deletions(-) delete mode 100644 scripts/getExcludedAssignees.js diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 891908f7c..e05e45c40 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -9,38 +9,15 @@ on: jobs: stale: runs-on: ubuntu-latest - env: - TEAM_MEMBERS: "sestinj,Patrick-Erichsen,tomasz-stefaniak,RomneyDa" - strategy: - matrix: - assignee: [sestinj, Patrick-Erichsen, tomasz-stefaniak, RomneyDa] steps: - - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version-file: .nvmrc - - - name: Compute excluded assignees - id: excluded-assignees - run: | - result=$(node ./scripts/getExcludedAssignees.js ${{ env.TEAM_MEMBERS }} ${{ matrix.assignee }}) - - echo "Result: $result" - echo "excluded_assignees=$result" >> $GITHUB_OUTPUT - - uses: actions/stale@v9 with: - stale-issue-message: "This issue hasn't been updated in a while. @${{ matrix.assignee }} can you take a look?" - stale-pr-message: "This PR hasn't been updated in a while. @${{ matrix.assignee }} can you take a look?" - days-before-stale: 180 - days-before-close: -1 - days-before-pr-close: -1 + close-issue-message: "This issue was closed because it hasn't been updated for 120 days. If it's still important, please reopen + comment and we will glady take another look." + stale-issue-message: "It looks like this issue hasn't been updated in 90 days. If there's still no activity after 120 days, it will be closed." + days-before-stale: 90 + days-before-close: 120 stale-issue-label: "stale" stale-pr-label: "stale" debug-only: true exempt-issue-labels: "needs-triage,no-stale" exempt-pr-labels: "no-stale" - exempt-assignees: ${{ steps.excluded-assignees.outputs.excluded_assignees }} - include-only-assigned: true diff --git a/scripts/getExcludedAssignees.js b/scripts/getExcludedAssignees.js deleted file mode 100644 index e6ac5904c..000000000 --- a/scripts/getExcludedAssignees.js +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env node - -function removeStringFromList(list, stringToRemove) { - return list.filter((item) => item !== stringToRemove); -} - -function main() { - // Get command line arguments - const args = process.argv.slice(2); - - if (args.length < 2) { - console.error( - "Usage: node script.js ", - ); - process.exit(1); - } - - const list = args[0].split(","); - const stringToRemove = args[1]; - - const result = removeStringFromList(list, stringToRemove); - - // Output the result as comma-separated values - console.log(result.join(",")); -} - -main(); From 2f71a8edf0e8ef9c686ee8db6a41b3cbf7c22051 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 19:55:14 -0800 Subject: [PATCH 14/53] don't close/mark prs stale --- .github/workflows/stale-issue-helper.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index e05e45c40..2e0f0fdcd 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -16,6 +16,8 @@ jobs: stale-issue-message: "It looks like this issue hasn't been updated in 90 days. If there's still no activity after 120 days, it will be closed." days-before-stale: 90 days-before-close: 120 + days-before-pr-stale: -1 + days-before-pr-close: -1 stale-issue-label: "stale" stale-pr-label: "stale" debug-only: true From 567d2f146e6addffd44b849648c39a1b8e0bbd4d Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 20:00:59 -0800 Subject: [PATCH 15/53] update messages --- .github/workflows/stale-issue-helper.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 2e0f0fdcd..b5f32c704 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -13,7 +13,7 @@ jobs: - uses: actions/stale@v9 with: close-issue-message: "This issue was closed because it hasn't been updated for 120 days. If it's still important, please reopen + comment and we will glady take another look." - stale-issue-message: "It looks like this issue hasn't been updated in 90 days. If there's still no activity after 120 days, it will be closed." + stale-issue-message: "This issue hasn't been updated in 90 days and will be closed after 120 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue." days-before-stale: 90 days-before-close: 120 days-before-pr-stale: -1 From d0b7d1a0e0b4f15562f70a2d6443f6dc83040a09 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 20:09:58 -0800 Subject: [PATCH 16/53] first round: close issues before 90 days --- .github/workflows/stale-issue-helper.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index b5f32c704..70159939e 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -14,12 +14,11 @@ jobs: with: close-issue-message: "This issue was closed because it hasn't been updated for 120 days. If it's still important, please reopen + comment and we will glady take another look." stale-issue-message: "This issue hasn't been updated in 90 days and will be closed after 120 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue." - days-before-stale: 90 - days-before-close: 120 + days-before-stale: -1 + days-before-close: 90 days-before-pr-stale: -1 days-before-pr-close: -1 stale-issue-label: "stale" stale-pr-label: "stale" - debug-only: true - exempt-issue-labels: "needs-triage,no-stale" + exempt-issue-labels: "needs-triage,no-stale,high,highest" exempt-pr-labels: "no-stale" From d4e46a946bd8551659aec1cd26c4645fa3e76225 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 20:18:40 -0800 Subject: [PATCH 17/53] update msg --- .github/workflows/stale-issue-helper.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 70159939e..4e6e39d3d 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/stale@v9 with: - close-issue-message: "This issue was closed because it hasn't been updated for 120 days. If it's still important, please reopen + comment and we will glady take another look." + close-issue-message: "This issue was closed because it hasn't been updated for 120 days. If it's still important, please reopen + comment and we'll gladly take another look!" stale-issue-message: "This issue hasn't been updated in 90 days and will be closed after 120 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue." days-before-stale: -1 days-before-close: 90 From dd9ac81b44213f27eff617c9e70bded6454a39c9 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 20:19:51 -0800 Subject: [PATCH 18/53] mark stale --- .github/workflows/stale-issue-helper.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 4e6e39d3d..30e1ad773 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -13,8 +13,8 @@ jobs: - uses: actions/stale@v9 with: close-issue-message: "This issue was closed because it hasn't been updated for 120 days. If it's still important, please reopen + comment and we'll gladly take another look!" - stale-issue-message: "This issue hasn't been updated in 90 days and will be closed after 120 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue." - days-before-stale: -1 + # stale-issue-message: "This issue hasn't been updated in 90 days and will be closed after 120 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue." + days-before-stale: 90 days-before-close: 90 days-before-pr-stale: -1 days-before-pr-close: -1 From d9d79b259ee4969d409b7497362d7038f8b4fc2d Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 20:22:52 -0800 Subject: [PATCH 19/53] mark stale --- .github/workflows/stale-issue-helper.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 30e1ad773..9df56ba06 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -12,10 +12,10 @@ jobs: steps: - uses: actions/stale@v9 with: - close-issue-message: "This issue was closed because it hasn't been updated for 120 days. If it's still important, please reopen + comment and we'll gladly take another look!" - # stale-issue-message: "This issue hasn't been updated in 90 days and will be closed after 120 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue." + close-issue-message: "This issue was closed because it hasn't been updated for 100 days. If it's still important, please reopen + comment and we'll gladly take another look!" + stale-issue-message: "This issue hasn't been updated in 90 days and will be closed after an additional 10 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue." days-before-stale: 90 - days-before-close: 90 + days-before-close: 100 days-before-pr-stale: -1 days-before-pr-close: -1 stale-issue-label: "stale" From 899c9f5349dd5a5bc97a8177ffbc75715b364ac8 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 20:24:07 -0800 Subject: [PATCH 20/53] permissions --- .github/workflows/stale-issue-helper.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 9df56ba06..f4f9d46c7 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -8,6 +8,9 @@ on: jobs: stale: + permissions: + issues: write + pull-requests: write runs-on: ubuntu-latest steps: - uses: actions/stale@v9 From 8ac5f1dc213d56cac004459d516cdca7abbfaaae Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 20:37:54 -0800 Subject: [PATCH 21/53] update name --- .github/workflows/stale-issue-helper.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index f4f9d46c7..6f4ddd0b3 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -1,4 +1,4 @@ -name: "Label stale issues and PRs" +name: "Label and close stale issues" on: push: branches: From dbfebd5a734fbb661d6e7009e3d31030c6de8445 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 20:40:28 -0800 Subject: [PATCH 22/53] update close --- .github/workflows/stale-issue-helper.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 6f4ddd0b3..ce58d0933 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/stale@v9 with: - close-issue-message: "This issue was closed because it hasn't been updated for 100 days. If it's still important, please reopen + comment and we'll gladly take another look!" + close-issue-message: "This issue was closed because it wasn't updated for 10 days after being marked stale. If it's still important, please reopen + comment and we'll gladly take another look!" stale-issue-message: "This issue hasn't been updated in 90 days and will be closed after an additional 10 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue." days-before-stale: 90 - days-before-close: 100 + days-before-close: 10 days-before-pr-stale: -1 days-before-pr-close: -1 stale-issue-label: "stale" From 937b74f380d5b49f57c71f5cce19f9bf843443ee Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 20:44:09 -0800 Subject: [PATCH 23/53] update title --- .github/workflows/stale-issue-helper.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index ce58d0933..38e2a0226 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -1,4 +1,4 @@ -name: "Label and close stale issues" +name: "Label / close stale issues" on: push: branches: From 3fd2685a610cbaf26c624165ee72bbec0551bf7c Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 20:47:06 -0800 Subject: [PATCH 24/53] increase ops --- .github/workflows/stale-issue-helper.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 38e2a0226..c37a3aa1b 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -21,6 +21,7 @@ jobs: days-before-close: 10 days-before-pr-stale: -1 days-before-pr-close: -1 + operations-per-run: 100 stale-issue-label: "stale" stale-pr-label: "stale" exempt-issue-labels: "needs-triage,no-stale,high,highest" From 75387a18a0cbf710c117f066feaec83d0b36c635 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 20:48:47 -0800 Subject: [PATCH 25/53] increase ops --- .github/workflows/stale-issue-helper.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index c37a3aa1b..8f10ebcb5 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -21,7 +21,7 @@ jobs: days-before-close: 10 days-before-pr-stale: -1 days-before-pr-close: -1 - operations-per-run: 100 + operations-per-run: 2000 stale-issue-label: "stale" stale-pr-label: "stale" exempt-issue-labels: "needs-triage,no-stale,high,highest" From 58b5ad94cca789be64e91dad6f5b958d532d501c Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 2 Mar 2025 21:01:19 -0800 Subject: [PATCH 26/53] remove push trigger --- .github/workflows/stale-issue-helper.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml index 8f10ebcb5..067f4c60f 100644 --- a/.github/workflows/stale-issue-helper.yaml +++ b/.github/workflows/stale-issue-helper.yaml @@ -1,8 +1,5 @@ name: "Label / close stale issues" on: - push: - branches: - - nate/stale-issue-helper schedule: - cron: "30 1 * * *" @@ -21,7 +18,7 @@ jobs: days-before-close: 10 days-before-pr-stale: -1 days-before-pr-close: -1 - operations-per-run: 2000 + operations-per-run: 1000 stale-issue-label: "stale" stale-pr-label: "stale" exempt-issue-labels: "needs-triage,no-stale,high,highest" From e997f40b16c782c8d3d62618f00aa61d5c0898d7 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Sun, 2 Mar 2025 22:39:35 -0800 Subject: [PATCH 27/53] clean up --- core/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/index.d.ts b/core/index.d.ts index f34a7fbc9..7cbf0e25b 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -920,9 +920,8 @@ export interface BaseCompletionOptions { } export interface ModelCapability { - tools?: boolean; uploadImage?: boolean; - outputImage?: boolean; + tools?: boolean; } export interface ModelDescription { From 892f89e0e23f9ef1cac2eef40d82c25ba8abc153 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 3 Mar 2025 16:08:15 -0800 Subject: [PATCH 28/53] use URI.resolve --- core/util/uri.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/core/util/uri.ts b/core/util/uri.ts index 13d7956ac..a5a84d3b4 100644 --- a/core/util/uri.ts +++ b/core/util/uri.ts @@ -116,19 +116,30 @@ export function getLastNUriRelativePathParts( } export function joinPathsToUri(uri: string, ...pathSegments: string[]) { - const components = URI.parse(uri); + let baseUri = uri; + if (baseUri.at(-1) !== "/") { + baseUri += "/"; + } const segments = pathSegments.map((segment) => pathToUriPathSegment(segment)); - components.path = `${components.path}/${segments.join("/")}`; - return URI.serialize(components); + return URI.resolve(baseUri, segments.join("/")); } +// const components = URI.parse(uri); +// return URI.serialize(components); +// components.path = `${components.path}/${segments.join("/")}`; + export function joinEncodedUriPathSegmentToUri( uri: string, pathSegment: string, ) { - const components = URI.parse(uri); - components.path = `${components.path}/${pathSegment}`; - return URI.serialize(components); + let baseUri = uri; + if (baseUri.at(-1) !== "/") { + baseUri += "/"; + } + return URI.resolve(baseUri, pathSegment); + // const components = URI.parse(uri); + // components.path = `${components.path}/${pathSegment}`; + // return URI.serialize(components); } export function getShortestUniqueRelativeUriPaths( From a8d9a312a6efb935edca0de7cd8e77fb6d9a2660 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 3 Mar 2025 16:12:30 -0800 Subject: [PATCH 29/53] cleanup --- core/util/uri.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/core/util/uri.ts b/core/util/uri.ts index a5a84d3b4..e180a0a69 100644 --- a/core/util/uri.ts +++ b/core/util/uri.ts @@ -124,10 +124,6 @@ export function joinPathsToUri(uri: string, ...pathSegments: string[]) { return URI.resolve(baseUri, segments.join("/")); } -// const components = URI.parse(uri); -// return URI.serialize(components); -// components.path = `${components.path}/${segments.join("/")}`; - export function joinEncodedUriPathSegmentToUri( uri: string, pathSegment: string, @@ -137,9 +133,6 @@ export function joinEncodedUriPathSegmentToUri( baseUri += "/"; } return URI.resolve(baseUri, pathSegment); - // const components = URI.parse(uri); - // components.path = `${components.path}/${pathSegment}`; - // return URI.serialize(components); } export function getShortestUniqueRelativeUriPaths( From 93193606654d001ff0d98b1c40677ff8aa6a4d88 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 4 Mar 2025 14:06:07 -0800 Subject: [PATCH 30/53] blocktype param --- docs/docs/customize/deep-dives/development-data.md | 2 +- docs/docs/customize/deep-dives/docs.mdx | 2 +- docs/docs/customize/deep-dives/prompt-files.md | 2 +- docs/docs/customize/deep-dives/rules.md | 2 +- docs/docs/customize/tools.mdx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/docs/customize/deep-dives/development-data.md b/docs/docs/customize/deep-dives/development-data.md index 976c02833..da9f5136c 100644 --- a/docs/docs/customize/deep-dives/development-data.md +++ b/docs/docs/customize/deep-dives/development-data.md @@ -14,7 +14,7 @@ You can read more about how development data is generated as a byproduct of LLM- You can also configure custom destinations for your data, including remote HTTP endpoints and local file directories. -For hub assistants, data destinations are configured in `data` blocks. Visit the hub to [explore example data blocks](https://hub.continue.dev/explore/data) or [create your own](https://hub.continue.dev/new?type=block&block=data). +For hub assistants, data destinations are configured in `data` blocks. Visit the hub to [explore example data blocks](https://hub.continue.dev/explore/data) or [create your own](https://hub.continue.dev/new?type=block&blockType=data). See more details about adding `data` blocks to your configuration files in the [YAML specification](../../yaml-reference.md#data) diff --git a/docs/docs/customize/deep-dives/docs.mdx b/docs/docs/customize/deep-dives/docs.mdx index 7a5be2263..4a2aac376 100644 --- a/docs/docs/customize/deep-dives/docs.mdx +++ b/docs/docs/customize/deep-dives/docs.mdx @@ -64,7 +64,7 @@ Pre-indexed docs are only available in VS Code because the VS Code extension shi ### Hub `docs` Blocks -@Docs uses [`docs` blocks](../../hub/blocks/block-types.md#docs) in Assistants from the hub. Visit the hub to [explore `docs` blocks](https://hub.continue.dev/explore/docs) or [create your own](https://hub.continue.dev/new?type=block&block=docs). +@Docs uses [`docs` blocks](../../hub/blocks/block-types.md#docs) in Assistants from the hub. Visit the hub to [explore `docs` blocks](https://hub.continue.dev/explore/docs) or [create your own](https://hub.continue.dev/new?type=block&blockType=docs). ### Through the `@Docs` Context Provider diff --git a/docs/docs/customize/deep-dives/prompt-files.md b/docs/docs/customize/deep-dives/prompt-files.md index 1ab90e94a..f5c834c17 100644 --- a/docs/docs/customize/deep-dives/prompt-files.md +++ b/docs/docs/customize/deep-dives/prompt-files.md @@ -4,7 +4,7 @@ title: Prompt files Prompt files provide a convenient way to standardize common patterns and share a collection of LLM prompts with your team. They make it easy to build and use these prompts. -On the [hub](../../hub/introduction.md), prompt files are stored within [prompt blocks](../../hub/blocks/block-types.md#prompts), which show up as [slash commands](../slash-commands.mdx) in Chat. Visit the hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&block=rules). +On the [hub](../../hub/introduction.md), prompt files are stored within [prompt blocks](../../hub/blocks/block-types.md#prompts), which show up as [slash commands](../slash-commands.mdx) in Chat. Visit the hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&blockType=rules). Prompt files can also be stored within your project's root directory as `.prompt` files. See below. diff --git a/docs/docs/customize/deep-dives/rules.md b/docs/docs/customize/deep-dives/rules.md index eac9137ce..59f816c15 100644 --- a/docs/docs/customize/deep-dives/rules.md +++ b/docs/docs/customize/deep-dives/rules.md @@ -9,7 +9,7 @@ Rules are used to provide instructions to **chat** models. They are inserted int ## Hub `rules` blocks -Rules can be added to an Assistant on the Continue Hub. Explore available rules [here](https://hub.continue.dev/explore/rules), or [create your own](https://hub.continue.dev/new?type=block&block=rules) in the Hub. +Rules can be added to an Assistant on the Continue Hub. Explore available rules [here](https://hub.continue.dev/explore/rules), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub. ## `.continuerules` diff --git a/docs/docs/customize/tools.mdx b/docs/docs/customize/tools.mdx index 45280697e..1aad549f1 100644 --- a/docs/docs/customize/tools.mdx +++ b/docs/docs/customize/tools.mdx @@ -30,7 +30,7 @@ Currently custom tools can be configured using the [Model Context Protocol](http MCP Servers can be added to hub Assistants using `mcpServers` blocks. You can explore available MCP server blocks [here](https://hub.continue.dev/explore/mcp). -To set up your own MCP server, read the [MCP quickstart](https://modelcontextprotocol.io/quickstart) and then [create an `mcpServers` block](https://hub.continue.dev/new?type=block&block=mcpServers) or add the following to your [config file](../customize/deep-dives/configuration.md): +To set up your own MCP server, read the [MCP quickstart](https://modelcontextprotocol.io/quickstart) and then [create an `mcpServers` block](https://hub.continue.dev/new?type=block&blockType=mcpServers) or add the following to your [config file](../customize/deep-dives/configuration.md): From 9404e00e91aed089cd3a8cd344a138af95f83740 Mon Sep 17 00:00:00 2001 From: Piotr Czekaj Date: Wed, 5 Mar 2025 11:47:53 +0100 Subject: [PATCH 31/53] Fix invalid mime type in Jetbrains IDE connection.url.toString() contains values like: jar:file:/Users/some.username/Library/Application%20Support/JetBrains/IntelliJIdea2024.3/plugins/continue-intellij-extension/lib/instrumented-continue-intellij-extension-1.0.2.jar!/webview/index.html if user has "js" in his home folder name then index.html will be treated as text/javascript and continue dev sidebar will output html source code instead of working app --- .../factories/CustomhandlerFactory.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/factories/CustomhandlerFactory.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/factories/CustomhandlerFactory.kt index 1c683253d..489ef9006 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/factories/CustomhandlerFactory.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/factories/CustomhandlerFactory.kt @@ -111,7 +111,10 @@ class OpenedConnection(private val connection: URLConnection?) : ) { try { if (connection != null) { - val url = connection.url.toString() + val fullUrl = connection.url.toString() + // Extract only the resource path after the JAR prefix to prevent incorrect mime type matching + // (e.g., if a user's home folder contains "js" in the path) + val url = fullUrl.substringAfterLast("jar!/", fullUrl) when { url.contains("css") -> cefResponse.mimeType = "text/css" url.contains("js") -> cefResponse.mimeType = "text/javascript" From f5a76456f9e17f8e774cb4d81e78a5cf434780a0 Mon Sep 17 00:00:00 2001 From: Nicholas Weatherburn Date: Wed, 5 Mar 2025 17:23:43 -0500 Subject: [PATCH 32/53] Enable Custom LLMs to use Tools by allowing customStreamChat to return ChatMessages as well as strings --- core/index.d.ts | 2 +- core/llm/llms/CustomLLM.ts | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/core/index.d.ts b/core/index.d.ts index 7cbf0e25b..b92370395 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -543,7 +543,7 @@ export interface CustomLLMWithOptionals { signal: AbortSignal, options: CompletionOptions, fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise, - ) => AsyncGenerator; + ) => AsyncGenerator; listModels?: ( fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise, ) => Promise; diff --git a/core/llm/llms/CustomLLM.ts b/core/llm/llms/CustomLLM.ts index 062f141f6..e04ea0ab7 100644 --- a/core/llm/llms/CustomLLM.ts +++ b/core/llm/llms/CustomLLM.ts @@ -1,4 +1,5 @@ import { ChatMessage, CompletionOptions, CustomLLM } from "../../index.js"; +import { renderChatMessage } from "../../util/messageContent.js"; import { BaseLLM } from "../index.js"; class CustomLLMClass extends BaseLLM { @@ -18,7 +19,7 @@ class CustomLLMClass extends BaseLLM { signal: AbortSignal, options: CompletionOptions, fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise, - ) => AsyncGenerator; + ) => AsyncGenerator; constructor(custom: CustomLLM) { super(custom.options || { model: "custom" }); @@ -38,7 +39,11 @@ class CustomLLMClass extends BaseLLM { options, (...args) => this.fetch(...args), )) { - yield { role: "assistant", content }; + if (typeof content === "string") { + yield { role: "assistant", content }; + } else { + yield content; + } } } else { for await (const update of super._streamChat(messages, signal, options)) { @@ -68,7 +73,11 @@ class CustomLLMClass extends BaseLLM { options, (...args) => this.fetch(...args), )) { - yield content; + if (typeof content === "string") { + yield content; + } else { + yield renderChatMessage(content); + } } } else { throw new Error( From f6d08a3d0ad3de8e33c4554538a4a8d3cae4469b Mon Sep 17 00:00:00 2001 From: sammyvoncheese Date: Wed, 5 Mar 2025 19:08:08 -0500 Subject: [PATCH 34/53] Update toolSupport.ts 3 Ollama logic changes. - Added logic to pull off the model name from a model which includes an extended path like "hf.co/DevQuasar/ibm-granite.granite-3.2-8b-instruct-preview-GGUF:F16" - added a "granite-3" check to support Hf format for the model name - changed the string compare to look for the model names in the whole string --- core/llm/toolSupport.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index 1e23cbf3e..ebe6599f8 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -57,9 +57,18 @@ export const PROVIDER_TOOL_SUPPORT: Record< }, // https://ollama.com/search?c=tools ollama: (model) => { + let modelName = ""; + // Extract the model name after the last slash to support other registries + if(model.includes("/")) { + let parts = model.split('/'); + modelName = parts[parts.length - 1]; + } else { + modelName = model; + } + if ( ["vision", "math", "guard", "mistrallite", "mistral-openorca"].some( - (part) => model.toLowerCase().includes(part), + (part) => modelName.toLowerCase().includes(part), ) ) { return false; @@ -79,10 +88,11 @@ export const PROVIDER_TOOL_SUPPORT: Record< "nemotron", "llama3-groq", "granite3", + "granite-3", "aya-expanse", "firefunction-v2", "mistral", - ].some((part) => model.toLowerCase().startsWith(part)) + ].some((part) => modelName.toLowerCase().includes(part)) ) { return true; } From a72cb1c47cdf351ae74c445559b3a7c5dc97522d Mon Sep 17 00:00:00 2001 From: Ian Dolge Date: Wed, 5 Mar 2025 17:50:44 -0800 Subject: [PATCH 35/53] Filter for files ending with .prompt in global Prompt Files --- core/util/paths.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/util/paths.ts b/core/util/paths.ts index bd5a69e1a..31ed8bb02 100644 --- a/core/util/paths.ts +++ b/core/util/paths.ts @@ -368,7 +368,7 @@ export function readAllGlobalPromptFiles( if (stats.isDirectory()) { const nestedPromptFiles = readAllGlobalPromptFiles(filepath); promptFiles.push(...nestedPromptFiles); - } else { + } else if (file.endsWith(".prompt")) { const content = fs.readFileSync(filepath, "utf8"); promptFiles.push({ path: filepath, content }); } From ec891338b1d8e5ab80faabf8f0306cc7554c1b85 Mon Sep 17 00:00:00 2001 From: aadarshkt Date: Thu, 6 Mar 2025 17:54:26 +0530 Subject: [PATCH 36/53] typo at various locations --- docs/docs/customize/deep-dives/docs.mdx | 4 ++-- docs/docs/troubleshooting.mdx | 2 +- extensions/vscode/src/diff/vertical/manager.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/docs/customize/deep-dives/docs.mdx b/docs/docs/customize/deep-dives/docs.mdx index 7a5be2263..5f65bb660 100644 --- a/docs/docs/customize/deep-dives/docs.mdx +++ b/docs/docs/customize/deep-dives/docs.mdx @@ -137,7 +137,7 @@ As with [@Codebase context provider configuration](./codebase#configuration), yo context: - provider: docs params: - nRetrieve: 25 # The number of docs to retreive from the embeddings query + nRetrieve: 25 # The number of docs to retrieve from the embeddings query nFinal: 5 # The number of docs chunks to return IF reranking useReranking: true # use reranking if a reranker is configured (defaults to true) ``` @@ -149,7 +149,7 @@ As with [@Codebase context provider configuration](./codebase#configuration), yo { "name": "docs", "params": { - "nRetrieve": 25, // The number of docs to retreive from the embeddings query + "nRetrieve": 25, // The number of docs to retrieve from the embeddings query "nFinal": 5, // The number of docs chunks to return IF reranking "useReranking": true // use reranking if a reranker is configured (defaults to true) } diff --git a/docs/docs/troubleshooting.mdx b/docs/docs/troubleshooting.mdx index 79ebefecb..3065bdc28 100644 --- a/docs/docs/troubleshooting.mdx +++ b/docs/docs/troubleshooting.mdx @@ -41,7 +41,7 @@ If you're getting a response from the LLM that doesn't seem to make sense, you c 1. Open the "Output" panel (right next to the terminal) 2. In the dropdown, select "Continue - LLM Prompts/Completions" -3. View the exact prompts that were sent to the LLM and the completions recieved +3. View the exact prompts that were sent to the LLM and the completions received ### JetBrains diff --git a/extensions/vscode/src/diff/vertical/manager.ts b/extensions/vscode/src/diff/vertical/manager.ts index a62406b00..d1cb496ea 100644 --- a/extensions/vscode/src/diff/vertical/manager.ts +++ b/extensions/vscode/src/diff/vertical/manager.ts @@ -230,7 +230,7 @@ export class VerticalDiffManager { ); if (!diffHandler) { - console.warn("Issue occured while creating new vertical diff handler"); + console.warn("Issue occurred while creating new vertical diff handler"); return; } @@ -353,7 +353,7 @@ export class VerticalDiffManager { ); if (!diffHandler) { - console.warn("Issue occured while creating new vertical diff handler"); + console.warn("Issue occurred while creating new vertical diff handler"); return undefined; } From 6bc0bfc5f1f77de9228c0ffda6cbb602bc8828e5 Mon Sep 17 00:00:00 2001 From: ferenci84 Date: Thu, 6 Mar 2025 14:05:14 +0100 Subject: [PATCH 37/53] Add citations to the log --- core/llm/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/llm/index.ts b/core/llm/index.ts index ccbad6699..8b63b5660 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -763,6 +763,7 @@ export abstract class BaseLLM implements ILLM { } let completion = ""; + let citations: null | string[] = null try { if (this.templateMessages) { @@ -790,6 +791,8 @@ export abstract class BaseLLM implements ILLM { completion = renderChatMessage(msg); } else { // Stream true + console.log("Streaming"); + const stream = this.openaiAdapter.chatCompletionStream( { ...body, @@ -802,6 +805,9 @@ export abstract class BaseLLM implements ILLM { if (result) { yield result; } + if (!citations && (chunk as any).citations && Array.isArray((chunk as any).citations)) { + citations = (chunk as any).citations; + } } } } else { @@ -824,6 +830,10 @@ export abstract class BaseLLM implements ILLM { if (logEnabled && this.writeLog) { await this.writeLog(`Completion:\n${completion}\n\n`); + + if (citations) { + await this.writeLog(`Citations:\n${citations.map((c, i) => `${i + 1}: ${c}`).join("\n")}\n\n`); + } } return { From 55c8871ecb2dae3fe2640dbfda09b298dfac5c0b Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Fri, 7 Mar 2025 06:18:52 -0500 Subject: [PATCH 38/53] Set VSCODE_VERSION when running 'extest get-chromedriver' If we only set the VSCODE_VERSION when running 'extest get-vscode', then we might get a version of chromedriver that is incompatible with the version of vscode we download. --- 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 366da7ff5..ec2e14779 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -594,7 +594,7 @@ "e2e:compile": "tsc -p ./tsconfig.e2e.json", "e2e:build": "npm --prefix ../../gui run build && npm run package", "e2e:create-storage": "mkdir -p ./e2e/storage", - "e2e:get-chromedriver": "extest get-chromedriver --storage ./e2e/storage", + "e2e:get-chromedriver": "CODE_VERSION=\"1.95.0\" extest get-chromedriver --storage ./e2e/storage", "e2e:get-vscode": "CODE_VERSION=\"1.95.0\" extest get-vscode --storage ./e2e/storage", "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", From e1119119108c1e2c09bf8e8a839ec95de654a7e2 Mon Sep 17 00:00:00 2001 From: Bastin Florian <33825469+BastinFlorian@users.noreply.github.com> Date: Fri, 7 Mar 2025 15:55:36 +0100 Subject: [PATCH 39/53] FIX(AZURE): Fix azure codestral documentation when deploying codestral in Azure AI Foundry Based on this issue: https://github.com/continuedev/continue/issues/3735 Update the documentation to use Codestral deployed in Azure with Azure AI Foundry --- docs/docs/customize/model-providers/top-level/azure.mdx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/docs/customize/model-providers/top-level/azure.mdx b/docs/docs/customize/model-providers/top-level/azure.mdx index cbb955bca..6ccb0508d 100644 --- a/docs/docs/customize/model-providers/top-level/azure.mdx +++ b/docs/docs/customize/model-providers/top-level/azure.mdx @@ -51,7 +51,7 @@ We recommend configuring **GPT-4o** as your chat model. ## Autocomplete model -We recommend configuring **Codestral** as your autocomplete model. +We recommend configuring **Codestral** as your autocomplete model. If you use Azure AI Foundry to deploy Codestral: @@ -60,6 +60,8 @@ We recommend configuring **Codestral** as your autocomplete model. - name: Codestral provider: mistral model: codestral-latest + apiBase: https://..models.ai.azure.com/v1, + apiKey: roles: - autocomplete ``` @@ -70,7 +72,9 @@ We recommend configuring **Codestral** as your autocomplete model. "tabAutocompleteModel": { "title": "Codestral", "provider": "mistral", - "model": "codestral-latest" + "model": "codestral-latest", + "apiBase": "https://..models.ai.azure.com/v1", + "apiKey": "" } } ``` From f7d3d21abbaa9ce3020ddf24e1b3a3853d0d20ec Mon Sep 17 00:00:00 2001 From: Bastin Florian <33825469+BastinFlorian@users.noreply.github.com> Date: Fri, 7 Mar 2025 15:58:22 +0100 Subject: [PATCH 40/53] FIX(AZURE): minor change --- docs/docs/customize/model-providers/top-level/azure.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/customize/model-providers/top-level/azure.mdx b/docs/docs/customize/model-providers/top-level/azure.mdx index 6ccb0508d..2c201d938 100644 --- a/docs/docs/customize/model-providers/top-level/azure.mdx +++ b/docs/docs/customize/model-providers/top-level/azure.mdx @@ -60,7 +60,7 @@ We recommend configuring **Codestral** as your autocomplete model. If you use Az - name: Codestral provider: mistral model: codestral-latest - apiBase: https://..models.ai.azure.com/v1, + apiBase: https://..models.ai.azure.com/v1 apiKey: roles: - autocomplete From 54c172b69a123aec1ef1f5ffbabda00e7510761e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Mar 2025 16:16:57 +0000 Subject: [PATCH 41/53] Bump axios from 1.7.9 to 1.8.2 in /core Bumps [axios](https://github.com/axios/axios) from 1.7.9 to 1.8.2. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v1.7.9...v1.8.2) --- updated-dependencies: - dependency-name: axios dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- core/package-lock.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/package-lock.json b/core/package-lock.json index abe4271f8..a15d33faf 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -6163,9 +6163,10 @@ "integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==" }, "node_modules/axios": { - "version": "1.7.9", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", - "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz", + "integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==", + "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", From 66e4db7f7c6f6be7a2ae59f50db2301a6dc38bde Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Fri, 7 Mar 2025 09:52:31 -0800 Subject: [PATCH 42/53] should ignore p1 --- core/core.ts | 4 ++ core/indexing/shouldIgnore.test.ts | 53 ++++++++++++++++++++ core/indexing/shouldIgnore.ts | 80 ++++++++++++++++++++++++++++++ core/test/testDir.ts | 4 +- 4 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 core/indexing/shouldIgnore.test.ts create mode 100644 core/indexing/shouldIgnore.ts diff --git a/core/core.ts b/core/core.ts index 180ce8642..dd05484d3 100644 --- a/core/core.ts +++ b/core/core.ts @@ -829,6 +829,10 @@ export class Core { // Codebase indexing on("index/forceReIndex", async ({ data }) => { + const { config } = await this.configHandler.loadConfig(); + if (config?.disableIndexing) { + return; // TODO silent in case of commands? + } if (data?.shouldClearIndexes) { const codebaseIndexer = await this.codebaseIndexerPromise; await codebaseIndexer.clearIndexes(); diff --git a/core/indexing/shouldIgnore.test.ts b/core/indexing/shouldIgnore.test.ts new file mode 100644 index 000000000..31981c134 --- /dev/null +++ b/core/indexing/shouldIgnore.test.ts @@ -0,0 +1,53 @@ +// Generated by continue + +// Import modules +import { describe, expect, test } from "@jest/globals"; +import { testIde } from "../test/fixtures"; +import { + TEST_DIR, + addToTestDir, + setUpTestDir, + tearDownTestDir, +} from "../test/testDir"; +import { shouldIgnore } from "./shouldIgnore"; + +// Test for the shouldIgnore function +describe("shouldIgnore", () => { + beforeEach(() => { + setUpTestDir(); + }); + + afterEach(() => { + tearDownTestDir(); + }); + + test("should return true if a file is ignored by .gitignore", async () => { + addToTestDir([ + ["/ignored-file.txt", "content"], + ["/kept-file.txt", "content"], + ["/.gitignore", "ignored-file.txt\nignored-folder/"], + "/ignored-folder/", + ["/ignored-folder/file.txt", "content"], + ]); + const result1 = await shouldIgnore( + TEST_DIR + "/ignored-file.txt", + TEST_DIR, + testIde, + ); + expect(result1).toBe(true); + + const result2 = await shouldIgnore( + TEST_DIR + "/ignored-folder", + TEST_DIR, + testIde, + ); + expect(result2).toBe(true); + + const result3 = await shouldIgnore( + TEST_DIR + "/kept-file.txt", + TEST_DIR, + testIde, + ); + expect(result3).toBe(false); + }); +}); diff --git a/core/indexing/shouldIgnore.ts b/core/indexing/shouldIgnore.ts new file mode 100644 index 000000000..5af63394b --- /dev/null +++ b/core/indexing/shouldIgnore.ts @@ -0,0 +1,80 @@ +import ignore from "ignore"; +import { FileType, IDE } from "../index"; +import { getUriPathBasename } from "../util/uri"; +import { getGlobalContinueIgArray, gitIgArrayFromFile } from "./ignore"; + +interface IgnoreContext { + ignore: ReturnType; + dirname: string; +} + +export async function shouldIgnore( + fileUri: string, + rootDirUri: string, + ide: IDE, + ignoreFiles: string[] = [".gitignore", ".continueignore"], +): Promise { + let currentDir = fileUri; + + while (currentDir !== rootDirUri && currentDir.startsWith(rootDirUri)) { + const dirEntries = await ide.listDir(currentDir); + const dirs = dirEntries + .filter(([_, uriType]) => uriType === FileType.File) + .map(([uri, _]) => uri); + + const ignoreContexts = await getIgnoreContextsInDir( + currentDir, + dirs, + ignoreFiles, + ide, + ); + + const relativePath = fileUri.substring(currentDir.length + 1); + + for (const context of ignoreContexts) { + if (context.ignore.ignores(relativePath)) { + return true; + } + } + + currentDir = getParentDir(currentDir); + } + + return false; +} + +async function getIgnoreContextsInDir( + dirUri: string, + entries: string[], + ignoreFiles: string[], + ide: IDE, +): Promise { + const ignoreEntries = entries.filter((entryUri) => + ignoreFiles.includes(getUriPathBasename(entryUri)), + ); + const patterns = await Promise.all( + ignoreEntries.map(async (entryUri) => { + const fileContent = await ide.readFile(entryUri); + return gitIgArrayFromFile(fileContent); + }), + ); + + const globalPatterns = getGlobalContinueIgArray(); + + return [ + ...patterns.map((patterns) => ({ + ignore: ignore().add(patterns), + dirname: dirUri, + })), + { + ignore: ignore().add(globalPatterns), + dirname: "/", + }, + ]; +} + +function getParentDir(uri: string): string { + const splitUri = uri.split("/"); + splitUri.pop(); + return splitUri.join("/"); +} diff --git a/core/test/testDir.ts b/core/test/testDir.ts index 9b0473b46..0e34f509b 100644 --- a/core/test/testDir.ts +++ b/core/test/testDir.ts @@ -1,7 +1,7 @@ import fs from "fs"; import os from "os"; import path from "path"; -import { localPathToUri, localPathOrUriToPath } from "../util/pathToUri"; +import { localPathOrUriToPath, localPathToUri } from "../util/pathToUri"; // Want this outside of the git repository so we can change branches in tests export const TEST_DIR_PATH = path.join(os.tmpdir(), "testWorkspaceDir"); @@ -26,7 +26,7 @@ export function tearDownTestDir() { "index/index.ts" creates an empty index/index.ts ["index/index.ts", "hello"] creates index/index.ts with contents "hello" */ -export function addToTestDir(pathsOrUris: (string | string[])[]) { +export function addToTestDir(pathsOrUris: (string | [string, string])[]) { // Allow tests to use URIs or local paths const paths = pathsOrUris.map((val) => { if (Array.isArray(val)) { From a2034e801db2469870f0acbe69c3b2512d00aec9 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Fri, 7 Mar 2025 13:01:37 -0800 Subject: [PATCH 43/53] shouldignore working --- core/core.ts | 34 ++++++-- core/indexing/shouldIgnore.test.ts | 109 ++++++++++++++++++++---- core/indexing/shouldIgnore.ts | 130 +++++++++++++++-------------- 3 files changed, 184 insertions(+), 89 deletions(-) diff --git a/core/core.ts b/core/core.ts index dd05484d3..874810967 100644 --- a/core/core.ts +++ b/core/core.ts @@ -53,6 +53,7 @@ import { type IndexingProgressUpdate, } from "."; +import { shouldIgnore } from "./indexing/shouldIgnore"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import type { IMessenger, Message } from "./protocol/messenger"; @@ -890,30 +891,45 @@ export class Core { uri.endsWith(".gitignore") ) { // Reindex the workspaces - this.invoke("index/forceReIndex", undefined); + this.invoke("index/forceReIndex", { + shouldClearIndexes: true, + }); } else { // Reindex the file - await this.refreshCodebaseIndexFiles([uri]); + const ignore = await shouldIgnore(uri, this.ide); + if (!ignore) { + await this.refreshCodebaseIndexFiles([uri]); + } } } } }); - on("files/created", async ({ data }) => { - if (data?.uris?.length) { + const refreshIfNotIgnored = async (uris: string[]) => { + const toRefresh: string[] = []; + for (const uri of uris) { + const ignore = await shouldIgnore(uri, ide); + if (!ignore) { + toRefresh.push(uri); + } + } + if (toRefresh.length > 0) { this.messenger.send("refreshSubmenuItems", { providers: ["file"], }); - await this.refreshCodebaseIndexFiles(data.uris); + await this.refreshCodebaseIndexFiles(toRefresh); + } + }; + + on("files/created", async ({ data }) => { + if (data?.uris?.length) { + void refreshIfNotIgnored(data.uris); } }); on("files/deleted", async ({ data }) => { if (data?.uris?.length) { - this.messenger.send("refreshSubmenuItems", { - providers: ["file"], - }); - await this.refreshCodebaseIndexFiles(data.uris); + void refreshIfNotIgnored(data.uris); } }); on("files/opened", async ({ data }) => { diff --git a/core/indexing/shouldIgnore.test.ts b/core/indexing/shouldIgnore.test.ts index 31981c134..1d1ac857c 100644 --- a/core/indexing/shouldIgnore.test.ts +++ b/core/indexing/shouldIgnore.test.ts @@ -1,7 +1,5 @@ // Generated by continue -// Import modules -import { describe, expect, test } from "@jest/globals"; import { testIde } from "../test/fixtures"; import { TEST_DIR, @@ -9,6 +7,7 @@ import { setUpTestDir, tearDownTestDir, } from "../test/testDir"; + import { shouldIgnore } from "./shouldIgnore"; // Test for the shouldIgnore function @@ -23,31 +22,105 @@ describe("shouldIgnore", () => { test("should return true if a file is ignored by .gitignore", async () => { addToTestDir([ - ["/ignored-file.txt", "content"], - ["/kept-file.txt", "content"], - ["/.gitignore", "ignored-file.txt\nignored-folder/"], - "/ignored-folder/", - ["/ignored-folder/file.txt", "content"], + ["ignored-file.txt", "content"], + [".gitignore", "ignored-file.txt"], ]); - const result1 = await shouldIgnore( - TEST_DIR + "/ignored-file.txt", + const result = await shouldIgnore(TEST_DIR + "/ignored-file.txt", testIde, [ TEST_DIR, + ]); + expect(result).toBe(true); + }); + test("should return true if a folder is ignored by .continueignore", async () => { + addToTestDir([ + "ignored-folder/", + ["ignored-folder/file.txt", "content"], + [".continueignore", "ignored-folder/"], + ]); + const result = await shouldIgnore( + TEST_DIR + "/ignored-folder/file.txt", testIde, + [TEST_DIR], ); - expect(result1).toBe(true); + expect(result).toBe(true); + }); + test("should return false if a file is not ignored", async () => { + addToTestDir([["kept-file.txt", "contents"]]); + const result = await shouldIgnore(TEST_DIR + "/kept-file.txt", testIde, [ + TEST_DIR, + ]); + expect(result).toBe(false); + }); + test("should return true if a file is ignored by .gitignore with spaces in file name", async () => { + addToTestDir([ + ["ignored file.txt", "content"], + [".gitignore", "ignored file.txt"], + ]); + const result = await shouldIgnore(TEST_DIR + "/ignored file.txt", testIde, [ + TEST_DIR, + ]); + expect(result).toBe(true); + }); - const result2 = await shouldIgnore( - TEST_DIR + "/ignored-folder", - TEST_DIR, + test("should return true if a .continueignore override ignores file", async () => { + addToTestDir([ + ["override-file.txt", "content"], + [".gitignore", "override-file.txt"], + [".continueignore", "!override-file.txt"], + ]); + const result = await shouldIgnore( + TEST_DIR + "/override-file.txt", testIde, + [TEST_DIR], ); - expect(result2).toBe(true); + expect(result).toBe(false); + }); - const result3 = await shouldIgnore( - TEST_DIR + "/kept-file.txt", - TEST_DIR, + test("should return true for deeply nested file ignored by ignore files at multiple levels", async () => { + addToTestDir([ + "level1/", + "level1/level2/", + "level1/level2/level3/", + ["level1/level2/level3/ignored-file.txt", "content"], + ["level1/.gitignore", "level2/"], + ["level1/level2/.continueignore", "level3/"], + ]); + const result = await shouldIgnore( + TEST_DIR + "/level1/level2/level3/ignored-file.txt", testIde, + [TEST_DIR], ); - expect(result3).toBe(false); + expect(result).toBe(true); + }); + + test("should return false if a file with spaces is not ignored", async () => { + addToTestDir([["kept file.txt", "contents"]]); + const result = await shouldIgnore(TEST_DIR + "/kept file.txt", testIde, [ + TEST_DIR, + ]); + expect(result).toBe(false); + }); + + test("should handle multiple levels of directories with some files ignored", async () => { + addToTestDir([ + "nested/", + "nested/dir1/", + "nested/dir2/", + ["nested/dir1/.gitignore", "ignored.txt"], + ["nested/dir1/ignored.txt", "content"], + ["nested/dir2/kept.txt", "content"], + ]); + const ignoredResult = await shouldIgnore( + TEST_DIR + "/nested/dir1/ignored.txt", + testIde, + [TEST_DIR], + ); + expect(ignoredResult).toBe(true); + + const keptResult = await shouldIgnore( + TEST_DIR + "/nested/dir2/kept.txt", + testIde, + [TEST_DIR], + ); + expect(keptResult).toBe(false); }); }); diff --git a/core/indexing/shouldIgnore.ts b/core/indexing/shouldIgnore.ts index 5af63394b..9170bae3e 100644 --- a/core/indexing/shouldIgnore.ts +++ b/core/indexing/shouldIgnore.ts @@ -1,80 +1,86 @@ import ignore from "ignore"; -import { FileType, IDE } from "../index"; -import { getUriPathBasename } from "../util/uri"; -import { getGlobalContinueIgArray, gitIgArrayFromFile } from "./ignore"; +import type { FileType, IDE } from "../"; +import { findUriInDirs } from "../util/uri"; +import { + DEFAULT_IGNORE, + getGlobalContinueIgArray, + gitIgArrayFromFile, +} from "./ignore"; -interface IgnoreContext { - ignore: ReturnType; - dirname: string; -} +/* + Process: + 1. Check global/default ignores + 2. Walk UP tree from file, checking ignores at each level + TODO there might be issues with symlinks here +*/ export async function shouldIgnore( fileUri: string, - rootDirUri: string, ide: IDE, - ignoreFiles: string[] = [".gitignore", ".continueignore"], + rootDirCandidates?: string[], ): Promise { - let currentDir = fileUri; + const rootDirUris = rootDirCandidates ?? (await ide.getWorkspaceDirs()); + const { + foundInDir: rootDir, + uri, + relativePathOrBasename, + } = findUriInDirs(fileUri, rootDirUris); + if (!rootDir) { + throw new Error("Should ignore: file uri not found in root dirs"); + } - while (currentDir !== rootDirUri && currentDir.startsWith(rootDirUri)) { + // Global/default ignores + const globalPatterns = getGlobalContinueIgArray(); + const rootIgnoreContext = ignore().add(globalPatterns).add(DEFAULT_IGNORE); + if (rootIgnoreContext.ignores(relativePathOrBasename)) { + return true; + } + + let currentDir = uri; + while (currentDir !== rootDir) { + // Go to parent dir of file + const splitUri = currentDir.split("/"); + splitUri.pop(); + currentDir = splitUri.join("/"); + + // Get all files in the dir const dirEntries = await ide.listDir(currentDir); - const dirs = dirEntries - .filter(([_, uriType]) => uriType === FileType.File) - .map(([uri, _]) => uri); + const dirFiles = dirEntries + .filter(([_, entryType]) => entryType === (1 as FileType.File)) + .map(([name, _]) => name); - const ignoreContexts = await getIgnoreContextsInDir( - currentDir, - dirs, - ignoreFiles, - ide, + // Find ignore files and get ignore arrays from their contexts + const gitIgnoreFile = dirFiles.find((name) => name === ".gitignore"); + const continueIgnoreFile = dirFiles.find( + (name) => name === ".continueignore", ); - const relativePath = fileUri.substring(currentDir.length + 1); - - for (const context of ignoreContexts) { - if (context.ignore.ignores(relativePath)) { - return true; + const getGitIgnorePatterns = async () => { + if (gitIgnoreFile) { + const contents = await ide.readFile(`${currentDir}/.gitignore`); + return gitIgArrayFromFile(contents); } - } + return []; + }; + const getContinueIgnorePatterns = async () => { + if (continueIgnoreFile) { + const contents = await ide.readFile(`${currentDir}/.continueignore`); + return gitIgArrayFromFile(contents); + } + return []; + }; - currentDir = getParentDir(currentDir); + const ignoreArrays = await Promise.all([ + getGitIgnorePatterns(), + getContinueIgnorePatterns(), + ]); + const ignoreContext = ignore().add(ignoreArrays[0]).add(ignoreArrays[1]); + + const relativePath = uri.substring(currentDir.length + 1); + if (ignoreContext.ignores(relativePath)) { + return true; + } } return false; } - -async function getIgnoreContextsInDir( - dirUri: string, - entries: string[], - ignoreFiles: string[], - ide: IDE, -): Promise { - const ignoreEntries = entries.filter((entryUri) => - ignoreFiles.includes(getUriPathBasename(entryUri)), - ); - const patterns = await Promise.all( - ignoreEntries.map(async (entryUri) => { - const fileContent = await ide.readFile(entryUri); - return gitIgArrayFromFile(fileContent); - }), - ); - - const globalPatterns = getGlobalContinueIgArray(); - - return [ - ...patterns.map((patterns) => ({ - ignore: ignore().add(patterns), - dirname: dirUri, - })), - { - ignore: ignore().add(globalPatterns), - dirname: "/", - }, - ]; -} - -function getParentDir(uri: string): string { - const splitUri = uri.split("/"); - splitUri.pop(); - return splitUri.join("/"); -} From 98b56b04732ba459f05a0e1e968e453218ca7208 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 7 Mar 2025 13:46:34 -0800 Subject: [PATCH 44/53] bump --- 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 b6c71a29c..1de735944 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": "1.1.4", + "version": "1.1.5", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From daa418109b320f4f40f3164992e5c45f7f144c09 Mon Sep 17 00:00:00 2001 From: Alexey Elin Date: Fri, 7 Mar 2025 20:35:40 +0300 Subject: [PATCH 45/53] (fix): GitLabMergeRequest context provider doesn't work when the git origin is https --- .../GitLabMergeRequestContextProvider.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/core/context/providers/GitLabMergeRequestContextProvider.ts b/core/context/providers/GitLabMergeRequestContextProvider.ts index 3e8f77a67..b4d3fe2ed 100644 --- a/core/context/providers/GitLabMergeRequestContextProvider.ts +++ b/core/context/providers/GitLabMergeRequestContextProvider.ts @@ -94,7 +94,7 @@ class GitLabMergeRequestContextProvider extends BaseContextProvider { }); } - private async getRemoteBranchName( + private async getRemoteBranchInfo( extras: ContextProviderExtras, ): Promise { const subprocess = await getSubprocess(extras); @@ -121,9 +121,16 @@ class GitLabMergeRequestContextProvider extends BaseContextProvider { const remoteUrl = await subprocess(`git remote get-url ${branchRemote}`); - const urlMatches = /:(?.*).git/.exec(remoteUrl); + let urlMatches: RegExpExecArray | null; + if (/https?.*/.test(remoteUrl)) { + const pathname = new URL(remoteUrl).pathname; + urlMatches = /\/(?.*?)(?:(?=\.git)|$)/.exec(pathname) + } else { + // ssh + urlMatches = /:(?.*).git/.exec(remoteUrl) + } - const project = urlMatches?.groups?.project ?? null; + const project = urlMatches?.groups?.projectPath ?? null; return { branch: remoteBranch, @@ -135,7 +142,7 @@ class GitLabMergeRequestContextProvider extends BaseContextProvider { query: string, extras: ContextProviderExtras, ): Promise { - const { branch, project } = await this.getRemoteBranchName(extras); + const { branch, project } = await this.getRemoteBranchInfo(extras); const api = await this.getApi(); From fda4cc8096f94548194ac0899ef327ff57f2df45 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 7 Mar 2025 15:33:48 -0800 Subject: [PATCH 46/53] skip ssh on dependabot PRs --- .github/workflows/pr_checks.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 258ec33e2..02b458d21 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -275,7 +275,7 @@ jobs: cd core npm test env: - IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork }} + IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork == true && github.actor == 'dependabot[bot]' }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} @@ -436,7 +436,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 - if: ${{ github.event.pull_request.head.repo.fork == false }} + if: ${{ github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' }} - name: Set up Xvfb run: | @@ -446,7 +446,7 @@ jobs: - name: Run e2e tests run: | cd extensions/vscode - IGNORE_SSH_TESTS="${{ github.event.pull_request.head.repo.fork }}" TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }} + IGNORE_SSH_TESTS="${{ github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' }}" TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }} env: DISPLAY: :99 From 8765df11fcac1092487ffd1fc842c29dc1e4d0fc Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Fri, 7 Mar 2025 15:52:19 -0800 Subject: [PATCH 47/53] speed tests --- core/commands/slash/onboard.ts | 8 +- core/core.ts | 2 +- core/indexing/ignore.ts | 4 + core/indexing/shouldIgnore.test.ts | 55 +++++- core/indexing/shouldIgnore.ts | 79 ++++---- core/indexing/walkDir.test.ts | 43 ++++- core/indexing/walkDir.ts | 267 +++++++++++++------------- core/promptFiles/v2/getPromptFiles.ts | 2 +- 8 files changed, 256 insertions(+), 204 deletions(-) diff --git a/core/commands/slash/onboard.ts b/core/commands/slash/onboard.ts index d6fedcafb..b53c8d3a9 100644 --- a/core/commands/slash/onboard.ts +++ b/core/commands/slash/onboard.ts @@ -2,8 +2,7 @@ import ignore from "ignore"; import type { FileType, IDE, SlashCommand } from "../.."; import { - defaultIgnoreDir, - defaultIgnoreFile, + DEFAULT_IGNORE, getGlobalContinueIgArray, gitIgArrayFromFile, } from "../../indexing/ignore"; @@ -58,10 +57,7 @@ const OnboardSlashCommand: SlashCommand = { }; async function getEntriesFilteredByIgnore(dir: string, ide: IDE) { - const ig = ignore() - .add(defaultIgnoreDir) - .add(defaultIgnoreFile) - .add(getGlobalContinueIgArray()); + const ig = ignore().add(DEFAULT_IGNORE).add(getGlobalContinueIgArray()); const entries = await ide.listDir(dir); const ignoreUri = joinPathsToUri(dir, ".gitignore"); diff --git a/core/core.ts b/core/core.ts index 874810967..33ff03776 100644 --- a/core/core.ts +++ b/core/core.ts @@ -26,7 +26,6 @@ import { streamDiffLines } from "./edit/streamDiffLines"; import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer"; import DocsService from "./indexing/docs/DocsService"; import { getAllSuggestedDocs } from "./indexing/docs/suggestions"; -import { defaultIgnoreFile } from "./indexing/ignore.js"; import Ollama from "./llm/llms/Ollama"; import { createNewPromptFileV2 } from "./promptFiles/v2/createNewPromptFile"; import { callTool } from "./tools/callTool"; @@ -53,6 +52,7 @@ import { type IndexingProgressUpdate, } from "."; +import { defaultIgnoreFile } from "./indexing/ignore"; import { shouldIgnore } from "./indexing/shouldIgnore"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import type { IMessenger, Message } from "./protocol/messenger"; diff --git a/core/indexing/ignore.ts b/core/indexing/ignore.ts index 6075bdb26..7f5e8a039 100644 --- a/core/indexing/ignore.ts +++ b/core/indexing/ignore.ts @@ -114,6 +114,10 @@ export const defaultIgnoreDir = ignore().add(DEFAULT_IGNORE_DIRS); export const DEFAULT_IGNORE = DEFAULT_IGNORE_FILETYPES.join("\n") + "\n" + DEFAULT_IGNORE_DIRS.join("\n"); +export const defaultIgnoreFileAndDir = ignore() + .add(defaultIgnoreFile) + .add(defaultIgnoreDir); + export function gitIgArrayFromFile(file: string) { return file .split(/\r?\n/) // Split on new line diff --git a/core/indexing/shouldIgnore.test.ts b/core/indexing/shouldIgnore.test.ts index 1d1ac857c..c1935e7d9 100644 --- a/core/indexing/shouldIgnore.test.ts +++ b/core/indexing/shouldIgnore.test.ts @@ -32,7 +32,6 @@ describe("shouldIgnore", () => { }); test("should return true if a folder is ignored by .continueignore", async () => { addToTestDir([ - "ignored-folder/", ["ignored-folder/file.txt", "content"], [".continueignore", "ignored-folder/"], ]); @@ -77,9 +76,6 @@ describe("shouldIgnore", () => { test("should return true for deeply nested file ignored by ignore files at multiple levels", async () => { addToTestDir([ - "level1/", - "level1/level2/", - "level1/level2/level3/", ["level1/level2/level3/ignored-file.txt", "content"], ["level1/.gitignore", "level2/"], ["level1/level2/.continueignore", "level3/"], @@ -102,9 +98,6 @@ describe("shouldIgnore", () => { test("should handle multiple levels of directories with some files ignored", async () => { addToTestDir([ - "nested/", - "nested/dir1/", - "nested/dir2/", ["nested/dir1/.gitignore", "ignored.txt"], ["nested/dir1/ignored.txt", "content"], ["nested/dir2/kept.txt", "content"], @@ -123,4 +116,52 @@ describe("shouldIgnore", () => { ); expect(keptResult).toBe(false); }); + + test("should respect default file and folder ignores top level", async () => { + addToTestDir([ + [".env", "contents"], + ["go.sum", "contents"], + ".idea/", + [".idea/test.xml", "contents"], + ]); + let result = await shouldIgnore(TEST_DIR + "/.env", testIde, [TEST_DIR]); + expect(result).toBe(true); + + result = await shouldIgnore(TEST_DIR + "/go.sum", testIde, [TEST_DIR]); + expect(result).toBe(true); + + result = await shouldIgnore(TEST_DIR + "/.idea", testIde, [TEST_DIR]); + expect(result).toBe(true); + + result = await shouldIgnore(TEST_DIR + "/.idea/test.xml", testIde, [ + TEST_DIR, + ]); + expect(result).toBe(true); + }); + + test("should respect default file and folder ignores at nested level", async () => { + addToTestDir([ + "nested/.idea/test.xml", + ["nested/.env", "contents"], + ["nested/go.sum", "contents"], + ]); + + let result = await shouldIgnore(TEST_DIR + "/nested/.idea", testIde, [ + TEST_DIR, + ]); + expect(result).toBe(true); + + result = await shouldIgnore(TEST_DIR + "/nested/.idea/test.xml", testIde, [ + TEST_DIR, + ]); + expect(result).toBe(true); + + result = await shouldIgnore(TEST_DIR + "/nested/.env", testIde, [TEST_DIR]); + expect(result).toBe(true); + + result = await shouldIgnore(TEST_DIR + "/nested/go.sum", testIde, [ + TEST_DIR, + ]); + expect(result).toBe(true); + }); }); diff --git a/core/indexing/shouldIgnore.ts b/core/indexing/shouldIgnore.ts index 9170bae3e..dd82a0457 100644 --- a/core/indexing/shouldIgnore.ts +++ b/core/indexing/shouldIgnore.ts @@ -1,11 +1,8 @@ import ignore from "ignore"; import type { FileType, IDE } from "../"; -import { findUriInDirs } from "../util/uri"; -import { - DEFAULT_IGNORE, - getGlobalContinueIgArray, - gitIgArrayFromFile, -} from "./ignore"; +import { findUriInDirs, getUriPathBasename } from "../util/uri"; +import { defaultIgnoreFileAndDir, getGlobalContinueIgArray } from "./ignore"; +import { getIgnoreContext } from "./walkDir"; /* Process: @@ -20,23 +17,19 @@ export async function shouldIgnore( rootDirCandidates?: string[], ): Promise { const rootDirUris = rootDirCandidates ?? (await ide.getWorkspaceDirs()); - const { - foundInDir: rootDir, - uri, - relativePathOrBasename, - } = findUriInDirs(fileUri, rootDirUris); - if (!rootDir) { - throw new Error("Should ignore: file uri not found in root dirs"); - } + const { foundInDir: rootDir, uri } = findUriInDirs(fileUri, rootDirUris); - // Global/default ignores - const globalPatterns = getGlobalContinueIgArray(); - const rootIgnoreContext = ignore().add(globalPatterns).add(DEFAULT_IGNORE); - if (rootIgnoreContext.ignores(relativePathOrBasename)) { + if (!rootDir) { return true; } + const defaultAndGlobalIgnores = ignore() + .add(defaultIgnoreFileAndDir) + .add(getGlobalContinueIgArray()); + let currentDir = uri; + let directParent = true; + let fileType = 1 as FileType.File as FileType; while (currentDir !== rootDir) { // Go to parent dir of file const splitUri = currentDir.split("/"); @@ -45,38 +38,32 @@ export async function shouldIgnore( // Get all files in the dir const dirEntries = await ide.listDir(currentDir); - const dirFiles = dirEntries - .filter(([_, entryType]) => entryType === (1 as FileType.File)) - .map(([name, _]) => name); - // Find ignore files and get ignore arrays from their contexts - const gitIgnoreFile = dirFiles.find((name) => name === ".gitignore"); - const continueIgnoreFile = dirFiles.find( - (name) => name === ".continueignore", + // Check if the file is a symbolic link, ignore if so + if (directParent) { + directParent = false; + const baseName = getUriPathBasename(fileUri); + const entry = dirEntries.find(([name, _]) => name === baseName); + if (entry) { + fileType = entry[1]; + if (fileType === (64 as FileType.SymbolicLink)) { + return true; + } + } + } + + const ignoreContext = await getIgnoreContext( + currentDir, + dirEntries, + ide, + defaultAndGlobalIgnores, ); - const getGitIgnorePatterns = async () => { - if (gitIgnoreFile) { - const contents = await ide.readFile(`${currentDir}/.gitignore`); - return gitIgArrayFromFile(contents); - } - return []; - }; - const getContinueIgnorePatterns = async () => { - if (continueIgnoreFile) { - const contents = await ide.readFile(`${currentDir}/.continueignore`); - return gitIgArrayFromFile(contents); - } - return []; - }; + let relativePath = uri.substring(currentDir.length + 1); + if (fileType === (2 as FileType.Directory)) { + relativePath += "/"; + } - const ignoreArrays = await Promise.all([ - getGitIgnorePatterns(), - getContinueIgnorePatterns(), - ]); - const ignoreContext = ignore().add(ignoreArrays[0]).add(ignoreArrays[1]); - - const relativePath = uri.substring(currentDir.length + 1); if (ignoreContext.ignores(relativePath)) { return true; } diff --git a/core/indexing/walkDir.test.ts b/core/indexing/walkDir.test.ts index 8a9d26e7e..8ded86670 100644 --- a/core/indexing/walkDir.test.ts +++ b/core/indexing/walkDir.test.ts @@ -1,14 +1,14 @@ // Generated by continue -import { testIde } from "../test/fixtures"; -import { - setUpTestDir, - tearDownTestDir, - addToTestDir, - TEST_DIR_PATH, -} from "../test/testDir"; -import { walkDir, walkDirAsync, walkDirs } from "../indexing/walkDir"; import fs from "fs"; import path from "path"; +import { walkDir, walkDirAsync, walkDirs } from "../indexing/walkDir"; +import { testIde } from "../test/fixtures"; +import { + addToTestDir, + setUpTestDir, + tearDownTestDir, + TEST_DIR_PATH, +} from "../test/testDir"; describe("walkDir functions", () => { beforeEach(async () => { @@ -19,6 +19,27 @@ describe("walkDir functions", () => { tearDownTestDir(); }); + // describe.only("test speed", () => { + // it("should walk a simple directory structure", async () => { + // addToTestDir([ + // "src/", + // ["src/file1.ts", "content1"], + // ["src/file2.ts", "content2"], + // "src/nested/", + // ["src/nested/file3.ts", "content3"], + // ]); + + // const dir = await testIde.getWorkspaceDirs(); + + // const start = Date.now(); + // for (let i = 0; i < 10000; i++) { + // await walkDir(dir[0], testIde); + // } + // const passed = Date.now() - start; + // console.log(`Test took ${passed} ms`); + // }); + // }); + describe("walkDir", () => { it("should walk a simple directory structure", async () => { addToTestDir([ @@ -313,6 +334,9 @@ describe("walkDir functions", () => { ["node_modules/package/index.js", "content"], ["dist/bundle.js", "content"], ["coverage/lcov.env", "content"], + ["nested/node_modules/package/index.js", "content"], + ["nested/dist/bundle.js", "content"], + ["nested/coverage/lcov.env", "content"], ]); const files = await walkDir( @@ -327,6 +351,9 @@ describe("walkDir functions", () => { expect(files).not.toContain(".git/config"); expect(files).not.toContain("node_modules/package/index.js"); expect(files).not.toContain("coverage/lcov.info"); + expect(files).not.toContain("nested/node_modules/package/index.js"); + expect(files).not.toContain("nested/dist/bundle.js"); + expect(files).not.toContain("nested/coverage/lcov.env"); }); it("should handle directory-specific ignore patterns correctly", async () => { diff --git a/core/indexing/walkDir.ts b/core/indexing/walkDir.ts index 4e97e01d4..757163d96 100644 --- a/core/indexing/walkDir.ts +++ b/core/indexing/walkDir.ts @@ -2,27 +2,23 @@ import ignore, { Ignore } from "ignore"; import type { FileType, IDE } from ".."; +import { joinPathsToUri } from "../util/uri"; import { - DEFAULT_IGNORE_DIRS, - DEFAULT_IGNORE_FILETYPES, - defaultIgnoreDir, - defaultIgnoreFile, + defaultIgnoreFileAndDir, getGlobalContinueIgArray, gitIgArrayFromFile, } from "./ignore"; -import { joinPathsToUri } from "../util/uri"; export interface WalkerOptions { - ignoreFiles?: string[]; onlyDirs?: boolean; returnRelativeUrisPaths?: boolean; - additionalIgnoreRules?: string[]; } type Entry = [string, FileType]; // helper struct used for the DFS walk type WalkableEntry = { + name: string; relativeUriPath: string; uri: string; type: FileType; @@ -41,143 +37,110 @@ type IgnoreContext = { }; class DFSWalker { - private readonly ignoreFileNames: Set; - constructor( private readonly uri: string, private readonly ide: IDE, private readonly options: WalkerOptions, - ) { - this.ignoreFileNames = new Set(options.ignoreFiles); - } + ) {} // walk is a depth-first search implementation public async *walk(): AsyncGenerator { - const root = this.newRootWalkContext(); - const stack = [root]; - for (let cur = stack.pop(); cur; cur = stack.pop()) { - const walkableEntries = await this.listDirForWalking(cur.walkableEntry); - const ignoreContexts = await this.getIgnoreToApplyInDir( - cur, - walkableEntries, - ); - for (const w of walkableEntries) { - if (!this.shouldInclude(w, ignoreContexts)) { - continue; - } - if (this.entryIsDirectory(w.entry)) { - stack.push({ - walkableEntry: w, - ignoreContexts: ignoreContexts, - }); - if (this.options.onlyDirs) { - // when onlyDirs is enabled the walker will only return directory names - if (this.options.returnRelativeUrisPaths) { - yield w.relativeUriPath; - } else { - yield w.uri; - } - } - } else { - // Note that shouldInclude handles skipping files if options.onlyDirs is true - if (this.options.returnRelativeUrisPaths) { - yield w.relativeUriPath; - } else { - yield w.uri; - } - } - } - } - } + const defaultAndGlobalIgnores = ignore() + .add(defaultIgnoreFileAndDir) + .add(getGlobalContinueIgArray()); - private newRootWalkContext(): WalkContext { - const globalIgnoreFile = getGlobalContinueIgArray(); - return { + const rootContext: WalkContext = { walkableEntry: { + name: "", relativeUriPath: "", uri: this.uri, type: 2 as FileType.Directory, entry: ["", 2 as FileType.Directory], }, - ignoreContexts: [ + ignoreContexts: [], + }; + const stack = [rootContext]; + + for (let cur = stack.pop(); cur; cur = stack.pop()) { + // Only directories will be added to the stack + const entries = await this.ide.listDir(cur.walkableEntry.uri); + + const newIgnore = await getIgnoreContext( + cur.walkableEntry.uri, + entries, + this.ide, + defaultAndGlobalIgnores, + ); + + const ignoreContexts = [ + ...cur.ignoreContexts, { - ignore: ignore() - .add(defaultIgnoreDir) - .add(defaultIgnoreFile) - .add(globalIgnoreFile), - dirname: "", + ignore: newIgnore, + dirname: cur.walkableEntry.relativeUriPath, }, - ], - }; - } + ]; - private async listDirForWalking( - walkableEntry: WalkableEntry, - ): Promise { - const entries = await this.ide.listDir(walkableEntry.uri); - return entries.map((e) => ({ - relativeUriPath: `${walkableEntry.relativeUriPath}${walkableEntry.relativeUriPath ? "/" : ""}${e[0]}`, - uri: joinPathsToUri(walkableEntry.uri, e[0]), - type: e[1], - entry: e, - })); - } + for (const entry of entries) { + if (this.entryIsSymlink(entry)) { + // If called from the root, a symlink either links to a real file in this repository, + // and therefore will be walked OR it links to something outside of the repository and + // we do not want to index it + continue; + } + const walkableEntry = { + name: entry[0], + relativeUriPath: `${cur.walkableEntry.relativeUriPath}${cur.walkableEntry.relativeUriPath ? "/" : ""}${entry[0]}`, + uri: joinPathsToUri(cur.walkableEntry.uri, entry[0]), + type: entry[1], + entry: entry, + }; - private async getIgnoreToApplyInDir( - curDir: WalkContext, - entriesInDir: WalkableEntry[], - ): Promise { - const ignoreFilesInDir = await this.loadIgnoreFiles(entriesInDir); - if (ignoreFilesInDir.length === 0) { - return curDir.ignoreContexts; - } - const patterns = ignoreFilesInDir.map((c) => gitIgArrayFromFile(c)).flat(); - const newIgnoreContext = { - ignore: ignore().add(patterns), - dirname: curDir.walkableEntry.relativeUriPath, - }; - return [...curDir.ignoreContexts, newIgnoreContext]; - } + let relPath = walkableEntry.relativeUriPath; + if (this.entryIsDirectory(entry)) { + relPath = `${relPath}/`; + } else { + if (this.options.onlyDirs) { + continue; + } + } + let shouldInclude = true; + for (const ig of ignoreContexts) { + // remove the directory name and path separator from the match path, unless this an ignore file + // in the root directory + const prefixLength = + ig.dirname.length === 0 ? 0 : ig.dirname.length + 1; + // The ignore library expects a path relative to the ignore file location + const matchPath = relPath.substring(prefixLength); + if (ig.ignore.ignores(matchPath)) { + shouldInclude = false; + } + } + if (!shouldInclude) { + continue; + } - private async loadIgnoreFiles(entries: WalkableEntry[]): Promise { - const ignoreEntries = entries.filter((w) => - this.entryIsIgnoreFile(w.entry), - ); - const promises = ignoreEntries.map(async (w) => { - return await this.ide.readFile(w.uri); - }); - return Promise.all(promises); - } - - private shouldInclude( - walkableEntry: WalkableEntry, - ignoreContexts: IgnoreContext[], - ) { - if (this.entryIsSymlink(walkableEntry.entry)) { - // If called from the root, a symlink either links to a real file in this repository, - // and therefore will be walked OR it links to something outside of the repository and - // we do not want to index it - return false; - } - let relPath = walkableEntry.relativeUriPath; - if (this.entryIsDirectory(walkableEntry.entry)) { - relPath = `${relPath}/`; - } else { - if (this.options.onlyDirs) { - return false; + if (this.entryIsDirectory(entry)) { + stack.push({ + walkableEntry, + ignoreContexts, + }); + if (this.options.onlyDirs) { + // when onlyDirs is enabled the walker will only return directory names + if (this.options.returnRelativeUrisPaths) { + yield walkableEntry.relativeUriPath; + } else { + yield walkableEntry.uri; + } + } + } else { + if (this.options.returnRelativeUrisPaths) { + yield walkableEntry.relativeUriPath; + } else { + yield walkableEntry.uri; + } + } } } - for (const ig of ignoreContexts) { - // remove the directory name and path separator from the match path, unless this an ignore file - // in the root directory - const prefixLength = ig.dirname.length === 0 ? 0 : ig.dirname.length + 1; - // The ignore library expects a path relative to the ignore file location - const matchPath = relPath.substring(prefixLength); - if (ig.ignore.ignores(matchPath)) { - return false; - } - } - return true; } private entryIsDirectory(entry: Entry) { @@ -187,21 +150,9 @@ class DFSWalker { private entryIsSymlink(entry: Entry) { return entry[1] === (64 as FileType.SymbolicLink); } - - private entryIsIgnoreFile(e: Entry): boolean { - if ( - e[1] === (2 as FileType.Directory) || - e[1] === (64 as FileType.SymbolicLink) - ) { - return false; - } - return this.ignoreFileNames.has(e[0]); - } } const defaultOptions: WalkerOptions = { - ignoreFiles: [".gitignore", ".continueignore"], - additionalIgnoreRules: [...DEFAULT_IGNORE_DIRS, ...DEFAULT_IGNORE_FILETYPES], onlyDirs: false, returnRelativeUrisPaths: false, }; @@ -238,3 +189,49 @@ export async function walkDirs( ); return results.flat(); } + +export async function getIgnoreContext( + currentDir: string, + currentDirEntries: Entry[], + ide: IDE, + defaultAndGlobalIgnores: Ignore, +) { + const dirFiles = currentDirEntries + .filter(([_, entryType]) => entryType === (1 as FileType.File)) + .map(([name, _]) => name); + + // Find ignore files and get ignore arrays from their contexts + // These are done separately so that .continueignore can override .gitignore + const gitIgnoreFile = dirFiles.find((name) => name === ".gitignore"); + const continueIgnoreFile = dirFiles.find( + (name) => name === ".continueignore", + ); + + const getGitIgnorePatterns = async () => { + if (gitIgnoreFile) { + const contents = await ide.readFile(`${currentDir}/.gitignore`); + return gitIgArrayFromFile(contents); + } + return []; + }; + const getContinueIgnorePatterns = async () => { + if (continueIgnoreFile) { + const contents = await ide.readFile(`${currentDir}/.continueignore`); + return gitIgArrayFromFile(contents); + } + return []; + }; + + const ignoreArrays = await Promise.all([ + getGitIgnorePatterns(), + getContinueIgnorePatterns(), + ]); + + // Note precedence here! + const ignoreContext = ignore() + .add(ignoreArrays[0]) // gitignore + .add(defaultAndGlobalIgnores) // default file/folder ignores followed by global .continueignore - this is combined for speed + .add(ignoreArrays[1]); // local .continueignore + + return ignoreContext; +} diff --git a/core/promptFiles/v2/getPromptFiles.ts b/core/promptFiles/v2/getPromptFiles.ts index d991d140a..7859c7cf7 100644 --- a/core/promptFiles/v2/getPromptFiles.ts +++ b/core/promptFiles/v2/getPromptFiles.ts @@ -16,7 +16,7 @@ export async function getPromptFilesFromDir( return []; } - const uris = await walkDir(dir, ide, { ignoreFiles: [] }); + const uris = await walkDir(dir, ide); const promptFilePaths = uris.filter((p) => p.endsWith(".prompt")); const results = promptFilePaths.map(async (uri) => { const content = await ide.readFile(uri); // make a try catch From 06bfaee488163cc217236a8169ab006bb409ea28 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Fri, 7 Mar 2025 15:56:59 -0800 Subject: [PATCH 48/53] did change active ignores --- core/core.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/core/core.ts b/core/core.ts index 33ff03776..a3fe41f2b 100644 --- a/core/core.ts +++ b/core/core.ts @@ -1,7 +1,4 @@ -import path from "path"; - import { fetchwithRequestOptions } from "@continuedev/fetch"; -import ignore from "ignore"; import * as URI from "uri-js"; import { v4 as uuidv4 } from "uuid"; @@ -52,7 +49,6 @@ import { type IndexingProgressUpdate, } from "."; -import { defaultIgnoreFile } from "./indexing/ignore"; import { shouldIgnore } from "./indexing/shouldIgnore"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import type { IMessenger, Message } from "./protocol/messenger"; @@ -995,19 +991,15 @@ export class Core { }); on("didChangeActiveTextEditor", async ({ data: { filepath } }) => { - const ignoreInstance = ignore().add(defaultIgnoreFile); - let rootDirectory = await this.ide.getWorkspaceDirs(); - const relativeFilePath = path.relative(rootDirectory[0], filepath); try { - if (!ignoreInstance.ignores(relativeFilePath)) { + const ignore = shouldIgnore(filepath, this.ide); + if (!ignore) { recentlyEditedFilesCache.set(filepath, filepath); } } catch (e) { - if (e instanceof RangeError) { - // do nothing, this can happen when editing a file outside the workspace such as `../extensions/.continue-debug/config.json` - } else { - console.debug("unhandled ignores error", relativeFilePath, e); - } + console.error( + `didChangeActiveTextEditor: failed to udpate recentlyEditedFiles cache for ${filepath}`, + ); } }); From 1edb910bcbfe40b9c58d38479f14d5d437bfd61e Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Fri, 7 Mar 2025 15:58:34 -0800 Subject: [PATCH 49/53] cleanup --- core/core.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/core.ts b/core/core.ts index a3fe41f2b..7a45bcd03 100644 --- a/core/core.ts +++ b/core/core.ts @@ -998,7 +998,7 @@ export class Core { } } catch (e) { console.error( - `didChangeActiveTextEditor: failed to udpate recentlyEditedFiles cache for ${filepath}`, + `didChangeActiveTextEditor: failed to update recentlyEditedFiles cache for ${filepath}`, ); } }); From dbfc346de43ae41a49c516b2375f3e7ea3312803 Mon Sep 17 00:00:00 2001 From: baipaiha Date: Sat, 8 Mar 2025 01:00:07 +0100 Subject: [PATCH 50/53] docs: fix bad yaml-reference links --- docs/docs/customize/deep-dives/configuration.md | 2 +- docs/docs/yaml-migration.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docs/customize/deep-dives/configuration.md b/docs/docs/customize/deep-dives/configuration.md index 11522e86f..5cd0ebf24 100644 --- a/docs/docs/customize/deep-dives/configuration.md +++ b/docs/docs/customize/deep-dives/configuration.md @@ -18,7 +18,7 @@ To open your configuration file, you can click the "gear" icon in the bottom rig When you save a config file from the IDE, Continue will automatically refresh to take into account your changes. A config file is automatically created the first time you use Continue, and always automatically generated with default values if it doesn't exist. -See the full reference for `config.yaml` [here](../../reference.md). +See the full reference for `config.yaml` [here](../../yaml-reference.md). ## Deprecated configuration methods diff --git a/docs/docs/yaml-migration.md b/docs/docs/yaml-migration.md index 0a7773670..4619018f2 100644 --- a/docs/docs/yaml-migration.md +++ b/docs/docs/yaml-migration.md @@ -12,7 +12,7 @@ See also - [Intro to YAML](https://yaml.org/) - [JSON Continue Config Reference](/json-reference) -- [YAML Continue Config Reference](/reference) +- [YAML Continue Config Reference](/yaml-reference) ## Create YAML file @@ -37,9 +37,9 @@ Add all model configurations in `config.json`, including models in `models`, `ta - `inlineEdit` -> e.g. `roles: [chat, edit]` - `applyCodeBlock` -> e.g. `roles: [chat, apply]` -Model-level `requestOptions` remain, with minor changes. See [YAML Continue Config Reference](/reference#requestoptions) +Model-level `requestOptions` remain, with minor changes. See [YAML Continue Config Reference](/yaml-reference#requestoptions) -Model-level `completionOptions` are replaced by `defaultCompletionOptions`, with minor changes. See [YAML Continue Config Reference](/reference#completionoptions) +Model-level `completionOptions` are replaced by `defaultCompletionOptions`, with minor changes. See [YAML Continue Config Reference](/yaml-reference#completionoptions) From b2568b7296d19262b605c0fa3043970d5624e3ab Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Fri, 7 Mar 2025 16:11:52 -0800 Subject: [PATCH 51/53] account for disable indexing --- core/core.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/core/core.ts b/core/core.ts index 7a45bcd03..c4370aac2 100644 --- a/core/core.ts +++ b/core/core.ts @@ -827,7 +827,7 @@ export class Core { // Codebase indexing on("index/forceReIndex", async ({ data }) => { const { config } = await this.configHandler.loadConfig(); - if (config?.disableIndexing) { + if (!config || config.disableIndexing) { return; // TODO silent in case of commands? } if (data?.shouldClearIndexes) { @@ -891,10 +891,13 @@ export class Core { shouldClearIndexes: true, }); } else { - // Reindex the file - const ignore = await shouldIgnore(uri, this.ide); - if (!ignore) { - await this.refreshCodebaseIndexFiles([uri]); + const { config } = await this.configHandler.loadConfig(); + if (config && !config.disableIndexing) { + // Reindex the file + const ignore = await shouldIgnore(uri, this.ide); + if (!ignore) { + await this.refreshCodebaseIndexFiles([uri]); + } } } } @@ -913,7 +916,10 @@ export class Core { this.messenger.send("refreshSubmenuItems", { providers: ["file"], }); - await this.refreshCodebaseIndexFiles(toRefresh); + const { config } = await this.configHandler.loadConfig(); + if (config && !config.disableIndexing) { + await this.refreshCodebaseIndexFiles(toRefresh); + } } }; From d42f32b022c63a30b6315cf3607a1f88dc6adc4b Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 7 Mar 2025 17:46:00 -0800 Subject: [PATCH 52/53] increase timeout for o1/o1-preview tests --- core/llm/llm.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/llm/llm.test.ts b/core/llm/llm.test.ts index 9912b862e..ff897d5a3 100644 --- a/core/llm/llm.test.ts +++ b/core/llm/llm.test.ts @@ -205,10 +205,11 @@ describe("LLM", () => { }); testLLM( new OpenAI({ apiKey: process.env.OPENAI_API_KEY, model: "o1-preview" }), - { skip: false, timeout: 20000 }, + { skip: false, timeout: 60000 }, ); testLLM(new OpenAI({ apiKey: process.env.OPENAI_API_KEY, model: "o1" }), { skip: false, + timeout: 60000, }); testLLM( new Gemini({ From fe036fa5096311bae5095cf432abda717f52e093 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 7 Mar 2025 17:40:13 -0800 Subject: [PATCH 53/53] cache the .test-extensions folder to avoid flaky tests due to VS Code Extension Marketplace timeout --- .github/workflows/pr_checks.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 02b458d21..5fe472a10 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -409,6 +409,14 @@ jobs: path: extensions/vscode/node_modules key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} + # We don't want to cache the Continue extension, so it is deleted at the end of the job + - uses: actions/cache@v4 + id: test-extensions-cache + with: + path: extensions/vscode/e2e/.test-extensions + # package.json used as the key because that's where the download script is defined + key: vscode-test-extensions-${{ hashFiles('extensions/vscode/package.json') }} + - name: Download build artifact uses: actions/download-artifact@v4 with: @@ -450,6 +458,11 @@ jobs: env: DISPLAY: :99 + - name: Delete continue from test extensions + run: | + cd extensions/vscode + rm -rf e2e/.test-extensions/continue* + - name: Upload e2e test screenshots if: failure() uses: actions/upload-artifact@v4