diff --git a/core/autocomplete/context/root-path-context/test/testUtils.ts b/core/autocomplete/context/root-path-context/test/testUtils.ts index 207b1d6d4..06bb9e55b 100644 --- a/core/autocomplete/context/root-path-context/test/testUtils.ts +++ b/core/autocomplete/context/root-path-context/test/testUtils.ts @@ -40,7 +40,7 @@ export async function testRootPathContext( // @ts-ignore .spyOn(service, "getSnippets") // @ts-ignore - .mockImplementation(async (_filepath, _endPosition) => { + .mockImplementation((_filePath, _endPosition) => { return []; }); diff --git a/core/config/ProfileLifecycleManager.ts b/core/config/ProfileLifecycleManager.ts index d0b830440..f61908e32 100644 --- a/core/config/ProfileLifecycleManager.ts +++ b/core/config/ProfileLifecycleManager.ts @@ -87,38 +87,40 @@ export class ProfileLifecycleManager { } // Set pending config promise - this.pendingConfigPromise = new Promise(async (resolve, reject) => { - let result: ConfigResult; - // This try catch is expected to catch high-level errors that aren't block-specific - // Like invalid json, invalid yaml, file read errors, etc. - // NOT block-specific loading errors - try { - result = await this.profileLoader.doLoadConfig(); - } catch (e) { - const message = - e instanceof Error - ? `${e.message}\n${e.stack ? e.stack : ""}` - : "Error loading config"; - result = { - errors: [ - { - fatal: true, - message, - }, - ], - config: undefined, - configLoadInterrupted: true, - }; - } + this.pendingConfigPromise = new Promise((resolve) => { + void (async () => { + let result: ConfigResult; + // This try catch is expected to catch high-level errors that aren't block-specific + // Like invalid json, invalid yaml, file read errors, etc. + // NOT block-specific loading errors + try { + result = await this.profileLoader.doLoadConfig(); + } catch (e) { + const message = + e instanceof Error + ? `${e.message}\n${e.stack ? e.stack : ""}` + : "Error loading config"; + result = { + errors: [ + { + fatal: true, + message, + }, + ], + config: undefined, + configLoadInterrupted: true, + }; + } - if (result.config) { - // Add registered context providers - result.config.contextProviders = ( - result.config.contextProviders ?? [] - ).concat(additionalContextProviders); - } + if (result.config) { + // Add registered context providers + result.config.contextProviders = ( + result.config.contextProviders ?? [] + ).concat(additionalContextProviders); + } - resolve(result); + resolve(result); + })(); }); // Wait for the config promise to resolve diff --git a/core/core.ts b/core/core.ts index edf56911b..0333b9696 100644 --- a/core/core.ts +++ b/core/core.ts @@ -145,8 +145,8 @@ export class Core { this.messenger, ); - MCPManagerSingleton.getInstance().onConnectionsRefreshed = async () => { - await this.configHandler.reloadConfig(); + MCPManagerSingleton.getInstance().onConnectionsRefreshed = () => { + void this.configHandler.reloadConfig(); }; this.codeBaseIndexer = new CodebaseIndexer( @@ -156,24 +156,26 @@ export class Core { this.globalContext.get("indexingPaused"), ); - this.configHandler.onConfigUpdate(async (result) => { - const serializedResult = await this.configHandler.getSerializedConfig(); - this.messenger.send("configUpdate", { - result: serializedResult, - profileId: - this.configHandler.currentProfile?.profileDescription.id || null, - organizations: this.configHandler.getSerializedOrgs(), - selectedOrgId: this.configHandler.currentOrg.id, - }); - - // update additional submenu context providers registered via VSCode API - const additionalProviders = - this.configHandler.getAdditionalSubmenuContextProviders(); - if (additionalProviders.length > 0) { - this.messenger.send("refreshSubmenuItems", { - providers: additionalProviders, + this.configHandler.onConfigUpdate((result) => { + void (async () => { + const serializedResult = await this.configHandler.getSerializedConfig(); + this.messenger.send("configUpdate", { + result: serializedResult, + profileId: + this.configHandler.currentProfile?.profileDescription.id || null, + organizations: this.configHandler.getSerializedOrgs(), + selectedOrgId: this.configHandler.currentOrg.id, }); - } + + // update additional submenu context providers registered via VSCode API + const additionalProviders = + this.configHandler.getAdditionalSubmenuContextProviders(); + if (additionalProviders.length > 0) { + this.messenger.send("refreshSubmenuItems", { + providers: additionalProviders, + }); + } + })(); }); // Dev Data Logger diff --git a/core/indexing/LanceDbIndex.ts b/core/indexing/LanceDbIndex.ts index 0bf6c94ca..0a285b15d 100644 --- a/core/indexing/LanceDbIndex.ts +++ b/core/indexing/LanceDbIndex.ts @@ -97,8 +97,8 @@ export class LanceDbIndex implements CodebaseIndex { contents TEXT NOT NULL )`); - await new Promise((resolve) => - migrate( + await new Promise((resolve) => { + void migrate( "lancedb_sqlite_artifact_id_column", async () => { try { @@ -118,8 +118,8 @@ export class LanceDbIndex implements CodebaseIndex { } }, () => resolve(undefined), - ), - ); + ); + }); } private async computeRows(items: PathAndCacheKey[]): Promise { diff --git a/core/indexing/chunk/chunk.ts b/core/indexing/chunk/chunk.ts index d51f368a2..9c6917dcb 100644 --- a/core/indexing/chunk/chunk.ts +++ b/core/indexing/chunk/chunk.ts @@ -50,21 +50,23 @@ export async function* chunkDocument({ maxChunkSize, )) { chunkPromises.push( - new Promise(async (resolve) => { - if ((await countTokensAsync(chunkWithoutId.content)) > maxChunkSize) { - // console.debug( - // `Chunk with more than ${maxChunkSize} tokens constructed: `, - // filepath, - // countTokens(chunkWithoutId.content), - // ); - return resolve(undefined); - } - resolve({ - ...chunkWithoutId, - digest, - index, - filepath, - }); + new Promise((resolve) => { + void (async () => { + if ((await countTokensAsync(chunkWithoutId.content)) > maxChunkSize) { + // console.debug( + // `Chunk with more than ${maxChunkSize} tokens constructed: `, + // filepath, + // countTokens(chunkWithoutId.content), + // ); + return resolve(undefined); + } + resolve({ + ...chunkWithoutId, + digest, + index, + filepath, + }); + })(); }), ); index++; diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index d82c34b20..6bd285520 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -186,7 +186,9 @@ export default class DocsService { private async init(configHandler: ConfigHandler) { const result = await configHandler.loadConfig(); await this.handleConfigUpdate(result); - configHandler.onConfigUpdate(this.handleConfigUpdate.bind(this)); + configHandler.onConfigUpdate( + this.handleConfigUpdate.bind(this) as (arg: any) => void, + ); } readonly statuses: Map = new Map(); diff --git a/core/indexing/docs/migrations.ts b/core/indexing/docs/migrations.ts index b9d5fbcf8..dc8879c67 100644 --- a/core/indexing/docs/migrations.ts +++ b/core/indexing/docs/migrations.ts @@ -6,8 +6,8 @@ import { editConfigFile, migrate } from "../../util/paths.js"; import DocsService, { SqliteDocsRow } from "./DocsService.js"; export async function runLanceMigrations(table: Table) { - await new Promise((resolve) => - migrate( + await new Promise((resolve) => { + void migrate( "rename_baseurl_column_for_lance_docs", async () => { try { @@ -21,8 +21,8 @@ export async function runLanceMigrations(table: Table) { } }, () => resolve(undefined), - ), - ); + ); + }); } export async function runSqliteMigrations(db: Database) {