diff --git a/binary/build.js b/binary/build.js index cf8a2420b..016afe9bd 100644 --- a/binary/build.js +++ b/binary/build.js @@ -240,7 +240,19 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { execCmdSync(`cd ${targetDir} && tar -xvzf build.tar.gz`); // Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found - fs.writeFileSync(`${targetDir}/package.json`, ""); + fs.writeFileSync( + `${targetDir}/package.json`, + JSON.stringify( + { + name: "binary", + version: "1.0.0", + author: "Continue Dev, Inc", + license: "Apache-2.0", + }, + undefined, + 2, + ), + ); // Copy to build directory for testing try { diff --git a/core/indexing/CodeSnippetsIndex.ts b/core/indexing/CodeSnippetsIndex.ts index 4dd56e4c2..0b97696bf 100644 --- a/core/indexing/CodeSnippetsIndex.ts +++ b/core/indexing/CodeSnippetsIndex.ts @@ -17,7 +17,6 @@ import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex.js"; import { IndexResultType, MarkCompleteCallback, - PathAndCacheKey, RefreshIndexResults, type CodebaseIndex, } from "./types.js"; diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index da06bb0d9..b377d5a2f 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -1,7 +1,7 @@ import * as fs from "fs/promises"; import { ConfigHandler } from "../config/ConfigHandler.js"; import { IContinueServerClient } from "../continueServer/interface.js"; -import { IDE, IndexTag, IndexingProgressUpdate } from "../index.js"; +import { IDE, IndexingProgressUpdate, IndexTag } from "../index.js"; import { extractMinimalStackTraceInfo } from "../util/extractMinimalStackTraceInfo.js"; import { getIndexSqlitePath, getLanceDbPath } from "../util/paths.js"; import { ChunkCodebaseIndex } from "./chunk/ChunkCodebaseIndex.js"; @@ -126,6 +126,12 @@ export class CodebaseIndexer { results.removeTag = []; results.addTag = []; results.del = []; + + // Don't update if nothing to update. Some of the indices might do unnecessary setup work + if (results.compute.length === 0) { + continue; + } + for await (const _ of index.update( tag, results, @@ -371,28 +377,33 @@ export class CodebaseIndexer { results.addTag.length + results.removeTag.length; let completedOps = 0; - for (const subResult of this.batchRefreshIndexResults(results)) { - for await (const { desc } of codebaseIndex.update( - tag, - subResult, - markComplete, - repoName, - )) { - yield { - progress: progress, - desc, - status: "indexing", - }; + + // Don't update if nothing to update. Some of the indices might do unnecessary setup work + if (totalOps > 0) { + for (const subResult of this.batchRefreshIndexResults(results)) { + for await (const { desc } of codebaseIndex.update( + tag, + subResult, + markComplete, + repoName, + )) { + yield { + progress: progress, + desc, + status: "indexing", + }; + } + completedOps += + subResult.compute.length + + subResult.del.length + + subResult.addTag.length + + subResult.removeTag.length; + progress = + (completedIndexCount + completedOps / totalOps) * + (1 / indexesToBuild.length); } - completedOps += - subResult.compute.length + - subResult.del.length + - subResult.addTag.length + - subResult.removeTag.length; - progress = - (completedIndexCount + completedOps / totalOps) * - (1 / indexesToBuild.length); } + await markComplete(lastUpdated, IndexResultType.UpdateLastUpdated); completedIndexCount += 1; } diff --git a/core/indexing/refreshIndex.ts b/core/indexing/refreshIndex.ts index c60a1a4d3..3404a22d5 100644 --- a/core/indexing/refreshIndex.ts +++ b/core/indexing/refreshIndex.ts @@ -1,8 +1,8 @@ import crypto from "node:crypto"; import * as fs from "node:fs"; +import plimit from "p-limit"; import { open, type Database } from "sqlite"; import sqlite3 from "sqlite3"; -import plimit from "p-limit"; import { IndexTag, IndexingProgressUpdate } from "../index.js"; import { getIndexSqlitePath } from "../util/paths.js"; import { @@ -391,7 +391,7 @@ export async function getComputeDeleteAddRemove( lastUpdated, async (items, resultType) => { // Update tag catalog - markComplete(items, resultType); + await markComplete(items, resultType); // Update the global cache const results: any = {