diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 6cf26a4f1..578e0974b 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -285,6 +285,7 @@ jobs: cd core npm test env: + IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} @@ -443,6 +444,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 }} - name: Set up Xvfb run: | @@ -452,7 +454,7 @@ jobs: - name: Run e2e tests run: | cd extensions/vscode - TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }} + IGNORE_SSH_TESTS="${{ github.event.pull_request.head.repo.fork }}" TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }} env: DISPLAY: :99 diff --git a/core/autocomplete/CompletionProvider.ts b/core/autocomplete/CompletionProvider.ts index 77aadbdf5..32e8a4127 100644 --- a/core/autocomplete/CompletionProvider.ts +++ b/core/autocomplete/CompletionProvider.ts @@ -246,6 +246,7 @@ export class CompletionProvider { completionOptions, cacheHit, filepath: helper.filepath, + numLines: completion.split("\n").length, completionId: helper.input.completionId, gitRepo: await this.ide.getRepoName(helper.filepath), uniqueId: await this.ide.getUniqueId(), diff --git a/core/autocomplete/util/types.ts b/core/autocomplete/util/types.ts index b6379dd61..3959bff9c 100644 --- a/core/autocomplete/util/types.ts +++ b/core/autocomplete/util/types.ts @@ -1,10 +1,4 @@ -import { - Position, - Range, - RangeInFile, - RangeInFileWithContents, - TabAutocompleteOptions, -} from "../.."; +import { Position, Range, RangeInFile, TabAutocompleteOptions } from "../.."; import { AutocompleteCodeSnippet } from "../snippets/types"; export type RecentlyEditedRange = RangeInFile & { @@ -42,6 +36,7 @@ export interface AutocompleteOutcome extends TabAutocompleteOptions { modelName: string; completionOptions: any; cacheHit: boolean; + numLines: number; filepath: string; gitRepo?: string; completionId: string; diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 0badc4700..e1c2a17e4 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -338,11 +338,11 @@ export class ConfigHandler { this.updateListeners.push(listener); } - async reloadConfig() { + async reloadConfig(additionalContextProviders: IContextProvider[] = []) { // TODO: this isn't right, there are two different senses in which you want to "reload" const { config, errors, configLoadInterrupted } = - await this.currentProfile.reloadConfig(); + await this.currentProfile.reloadConfig(additionalContextProviders); if (config) { this.inactiveProfiles.forEach((profile) => profile.clearConfig()); @@ -392,6 +392,6 @@ export class ConfigHandler { registerCustomContextProvider(contextProvider: IContextProvider) { this.additionalContextProviders.push(contextProvider); - void this.reloadConfig(); + void this.reloadConfig(this.additionalContextProviders); } } diff --git a/core/config/ProfileLifecycleManager.ts b/core/config/ProfileLifecycleManager.ts index 07c6a2c7d..fc18f34b0 100644 --- a/core/config/ProfileLifecycleManager.ts +++ b/core/config/ProfileLifecycleManager.ts @@ -50,12 +50,12 @@ export class ProfileLifecycleManager { } // Clear saved config and reload - async reloadConfig(): Promise> { + async reloadConfig(additionalContextProviders: IContextProvider[] = []): Promise> { this.savedConfigResult = undefined; this.savedBrowserConfigResult = undefined; this.pendingConfigPromise = undefined; - return this.loadConfig([], true); + return this.loadConfig(additionalContextProviders, true); } async loadConfig( diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 5ee0620a6..86f975965 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -124,12 +124,14 @@ export default async function doLoadConfig( if (newConfig.analytics) { await TeamAnalytics.setup( - newConfig.analytics as any, // TODO: Need to get rid of index.d.ts once and for all + newConfig.analytics, uniqueId, ideInfo.extensionVersion, controlPlaneClient, controlPlaneProxyInfo, ); + } else { + await TeamAnalytics.shutdown(); } newConfig = await injectControlPlaneProxyInfo( diff --git a/core/control-plane/TeamAnalytics.ts b/core/control-plane/TeamAnalytics.ts index c9f543bb4..732567206 100644 --- a/core/control-plane/TeamAnalytics.ts +++ b/core/control-plane/TeamAnalytics.ts @@ -1,7 +1,5 @@ import os from "node:os"; -import { Analytics } from "@continuedev/config-types"; - import ContinueProxyAnalyticsProvider from "./analytics/ContinueProxyAnalyticsProvider.js"; import { ControlPlaneProxyInfo, @@ -10,9 +8,10 @@ import { import LogStashAnalyticsProvider from "./analytics/LogStashAnalyticsProvider.js"; import PostHogAnalyticsProvider from "./analytics/PostHogAnalyticsProvider.js"; import { ControlPlaneClient } from "./client.js"; +import { AnalyticsConfig } from "../index.js"; function createAnalyticsProvider( - config: Analytics, + config: AnalyticsConfig, ): IAnalyticsProvider | undefined { // @ts-ignore switch (config.provider) { @@ -42,7 +41,7 @@ export class TeamAnalytics { } static async setup( - config: Analytics, + config: AnalyticsConfig, uniqueId: string, extensionVersion: string, controlPlaneClient: ControlPlaneClient, @@ -52,22 +51,27 @@ export class TeamAnalytics { TeamAnalytics.os = os.platform(); TeamAnalytics.extensionVersion = extensionVersion; - if (!config) { - await TeamAnalytics.provider?.shutdown(); - TeamAnalytics.provider = undefined; - } else { - TeamAnalytics.provider = createAnalyticsProvider(config); - await TeamAnalytics.provider?.setup( - config, - uniqueId, - controlPlaneProxyInfo, - ); + TeamAnalytics.provider = createAnalyticsProvider(config); + await TeamAnalytics.provider?.setup( + config, + uniqueId, + controlPlaneProxyInfo, + ); - if (config.provider === "continue-proxy") { - ( - TeamAnalytics.provider as ContinueProxyAnalyticsProvider - ).controlPlaneClient = controlPlaneClient; - } + if (config.provider === "continue-proxy") { + ( + TeamAnalytics.provider as ContinueProxyAnalyticsProvider + ).controlPlaneClient = controlPlaneClient; + } + } + + static async shutdown() { + if (TeamAnalytics.provider) { + await TeamAnalytics.provider.shutdown(); + TeamAnalytics.provider = undefined; + TeamAnalytics.os = undefined; + TeamAnalytics.extensionVersion = undefined; + TeamAnalytics.uniqueId = "NOT_UNIQUE"; } } } diff --git a/core/control-plane/analytics/IAnalyticsProvider.ts b/core/control-plane/analytics/IAnalyticsProvider.ts index c069695d0..6631a7c50 100644 --- a/core/control-plane/analytics/IAnalyticsProvider.ts +++ b/core/control-plane/analytics/IAnalyticsProvider.ts @@ -1,4 +1,4 @@ -import { Analytics } from "@continuedev/config-types"; +import { AnalyticsConfig } from "../.."; export interface AnalyticsMetadata { extensionVersion: string; @@ -13,7 +13,7 @@ export interface ControlPlaneProxyInfo { export interface IAnalyticsProvider { capture(event: string, properties: { [key: string]: any }): Promise; setup( - config: Analytics, + config: AnalyticsConfig, uniqueId: string, controlPlaneProxyInfo?: ControlPlaneProxyInfo, ): Promise; diff --git a/core/index.d.ts b/core/index.d.ts index f65c10622..1184b412b 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -1105,7 +1105,7 @@ export interface ExperimentalConfig { } export interface AnalyticsConfig { - type: string; + provider: string; url?: string; clientKey?: string; } diff --git a/core/indexing/docs/crawlers/DefaultCrawler.ts b/core/indexing/docs/crawlers/DefaultCrawler.ts index 0f0d9e593..d5e717fc0 100644 --- a/core/indexing/docs/crawlers/DefaultCrawler.ts +++ b/core/indexing/docs/crawlers/DefaultCrawler.ts @@ -26,7 +26,7 @@ export class DefaultCrawler { }); if (!resp.ok) { const text = await resp.text(); - throw new Error(`Failed to crawl site: ${text}`); + throw new Error(`Failed to crawl site (${resp.status}): ${text}`); } const json = (await resp.json()) as PageData[]; return json; diff --git a/core/indexing/docs/crawlers/DocsCrawler.test.ts b/core/indexing/docs/crawlers/DocsCrawler.test.ts index d3a246cf9..96c6dc24d 100644 --- a/core/indexing/docs/crawlers/DocsCrawler.test.ts +++ b/core/indexing/docs/crawlers/DocsCrawler.test.ts @@ -152,11 +152,15 @@ describe("DocsCrawler", () => { ); commonDocsSites.forEach((url) => { - test(`Default crawler common site: ${url}`, async () => { - const { pages, crawler } = await runCrawl(url); - expect(pages.length).toBeGreaterThanOrEqual(1); - expect(crawler).toEqual("default"); - }); + test( + `Default crawler common site: ${url}`, + async () => { + const { pages, crawler } = await runCrawl(url); + expect(pages.length).toBeGreaterThanOrEqual(1); + expect(crawler).toEqual("default"); + }, + TIMEOUT_MS, + ); }); }); diff --git a/core/llm/llm.test.ts b/core/llm/llm.test.ts index 4831cf800..53729022a 100644 --- a/core/llm/llm.test.ts +++ b/core/llm/llm.test.ts @@ -178,6 +178,15 @@ function testLLM( } describe("LLM", () => { + if (process.env.IGNORE_API_KEY_TESTS === "true") { + test("Skipping API key tests", () => { + console.log( + "Skipping API key tests due to IGNORE_API_KEY_TESTS being set", + ); + }); + return; + } + testLLM( new Anthropic({ model: "claude-3-5-sonnet-latest", diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index 1d62950bc..7028aa723 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension pluginName=continue-intellij-extension pluginRepositoryUrl=https://github.com/continuedev/continue # SemVer format -> https://semver.org -pluginVersion=0.0.86 +pluginVersion=0.0.87 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild=223 # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension diff --git a/extensions/vscode/e2e/tests/SSH.test.ts b/extensions/vscode/e2e/tests/SSH.test.ts index 8683a35d3..f6b924b8e 100644 --- a/extensions/vscode/e2e/tests/SSH.test.ts +++ b/extensions/vscode/e2e/tests/SSH.test.ts @@ -1,18 +1,24 @@ import { EditorView, - TextEditor, InputBox, - Workbench, Key, - VSBrowser, + TextEditor, + Workbench, } from "vscode-extension-tester"; -import { DEFAULT_TIMEOUT } from "../constants"; -import { TestUtils } from "../TestUtils"; -import { SSHSelectors } from "../selectors/SSH.selectors"; import { AutocompleteActions } from "../actions/Autocomplete.actions"; +import { DEFAULT_TIMEOUT } from "../constants"; +import { SSHSelectors } from "../selectors/SSH.selectors"; +import { TestUtils } from "../TestUtils"; describe("SSH", function () { + if (process.env.IGNORE_SSH_TESTS === "true") { + it("Skipping SSH tests", () => { + console.log("Skipping SSH tests due to IGNORE_SSH_TESTS being set"); + }); + return; + } + it("Should display completions", async () => { await TestUtils.waitForSuccess(async () => { await new Workbench().executeCommand( diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 6ad3051a7..c688eda3f 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -214,7 +214,7 @@ "command": "continue.toggleFullScreen", "category": "Continue", "title": "Toggle Full Screen", - "icon": "$(fullscreen)", + "icon": "$(link-external)", "group": "Continue" }, {