diff --git a/core/config/handler.ts b/core/config/handler.ts index dada49e2c..fa8c84dc6 100644 --- a/core/config/handler.ts +++ b/core/config/handler.ts @@ -13,12 +13,12 @@ export class ConfigHandler { constructor( private readonly ide: IDE, - private ideSettingsPromise: Promise, + private ideSettings: IdeSettings, private readonly writeLog: (text: string) => Promise, private readonly onConfigUpdate: () => void, ) { this.ide = ide; - this.ideSettingsPromise = ideSettingsPromise; + this.ideSettings = ideSettings; this.writeLog = writeLog; this.onConfigUpdate = onConfigUpdate; try { @@ -29,7 +29,7 @@ export class ConfigHandler { } updateIdeSettings(ideSettings: IdeSettings) { - this.ideSettingsPromise = Promise.resolve(ideSettings); + this.ideSettings = ideSettings this.reloadConfig(); } @@ -62,14 +62,14 @@ export class ConfigHandler { const ideInfo = await this.ide.getIdeInfo(); const uniqueId = await this.ide.getUniqueId(); - const ideSettings = await this.ideSettingsPromise; + let remoteConfigServerUrl = undefined; try { remoteConfigServerUrl = - typeof ideSettings.remoteConfigServerUrl !== "string" || - ideSettings.remoteConfigServerUrl === "" + typeof this.ideSettings.remoteConfigServerUrl !== "string" || + this.ideSettings.remoteConfigServerUrl === "" ? undefined - : new URL(ideSettings.remoteConfigServerUrl); + : new URL(this.ideSettings.remoteConfigServerUrl); } catch (e) {} this.savedConfig = await loadFullConfigNode( diff --git a/core/context/retrieval/retrieval.ts b/core/context/retrieval/retrieval.ts index ff2132ba4..3ed076826 100644 --- a/core/context/retrieval/retrieval.ts +++ b/core/context/retrieval/retrieval.ts @@ -1,4 +1,9 @@ -import { BranchAndDir, Chunk, ContextItem, ContextProviderExtras } from "../../index.js"; +import { + BranchAndDir, + Chunk, + ContextItem, + ContextProviderExtras, +} from "../../index.js"; import { LanceDbIndex } from "../../indexing/LanceDbIndex.js"; import { deduplicateArray, getBasename } from "../../util/index.js"; diff --git a/core/indexing/LanceDbIndex.ts b/core/indexing/LanceDbIndex.ts index 9629a1910..83c355bba 100644 --- a/core/indexing/LanceDbIndex.ts +++ b/core/indexing/LanceDbIndex.ts @@ -40,7 +40,7 @@ export class LanceDbIndex implements CodebaseIndex { constructor( private readonly embeddingsProvider: EmbeddingsProvider, private readonly readFile: (filepath: string) => Promise, - private readonly continueServerClient: IContinueServerClient, + private readonly continueServerClient?: IContinueServerClient, ) {} private tableNameForTag(tag: IndexTag) { @@ -176,7 +176,7 @@ export class LanceDbIndex implements CodebaseIndex { }; // Check remote cache - if (this.continueServerClient.connected) { + if (this.continueServerClient?.connected) { try { const keys = results.compute.map(({ cacheKey }) => cacheKey); const resp = await this.continueServerClient.getFromIndexCache( diff --git a/extensions/vscode/src/extension/vscodeExtension.ts b/extensions/vscode/src/extension/vscodeExtension.ts index 4c9476fe0..ba15c0c25 100644 --- a/extensions/vscode/src/extension/vscodeExtension.ts +++ b/extensions/vscode/src/extension/vscodeExtension.ts @@ -76,6 +76,7 @@ export class VsCodeExtension { ); this.configHandler = new ConfigHandler( this.ide, + ideSettings, async (log: string) => { outputChannel.appendLine( "==========================================================================", @@ -88,7 +89,6 @@ export class VsCodeExtension { (() => this.webviewProtocol?.request("configUpdate", undefined)).bind( this, ), - continueServerClient, ); this.configHandler.reloadConfig();