MCPcopy
hub / github.com/continuedev/continue / refreshFile

Method refreshFile

core/indexing/CodebaseIndexer.ts:241–291  ·  view source on GitHub ↗
(
    file: string,
    workspaceDirs: string[],
  )

Source from the content-addressed store, hash-verified

239 }
240
241 public async refreshFile(
242 file: string,
243 workspaceDirs: string[],
244 ): Promise<void> {
245 if (this.pauseToken.paused) {
246 // FIXME: by returning here, there is a chance that while paused a file is modified and
247 // then after unpausing the file is not reindexed
248 return;
249 }
250 const { foundInDir } = findUriInDirs(file, workspaceDirs);
251 if (!foundInDir) {
252 return;
253 }
254 const branch = await this.ide.getBranch(foundInDir);
255 const repoName = await this.ide.getRepoName(foundInDir);
256 const indexesToBuild = await this.getIndexesToBuild();
257 const stats = await this.ide.getFileStats([file]);
258 const filePath = Object.keys(stats)[0];
259 for (const index of indexesToBuild) {
260 const tag = {
261 directory: foundInDir,
262 branch,
263 artifactId: index.artifactId,
264 };
265 const [fullResults, fullLastUpdated, markComplete] =
266 await getComputeDeleteAddRemove(
267 tag,
268 { ...stats },
269 (filepath) => this.ide.readFile(filepath),
270 repoName,
271 );
272
273 const [results, lastUpdated] = this.singleFileIndexOps(
274 fullResults,
275 fullLastUpdated,
276 filePath,
277 );
278 // Don't update if nothing to update. Some of the indices might do unnecessary setup work
279 if (this.totalIndexOps(results) + lastUpdated.length === 0) {
280 continue;
281 }
282
283 for await (const _ of index.update(
284 tag,
285 results,
286 markComplete,
287 repoName,
288 )) {
289 }
290 }
291 }
292
293 private async *refreshFiles(
294 files: string[],

Callers 1

refreshFilesMethod · 0.95

Calls 10

getIndexesToBuildMethod · 0.95
singleFileIndexOpsMethod · 0.95
totalIndexOpsMethod · 0.95
findUriInDirsFunction · 0.85
getBranchMethod · 0.65
getRepoNameMethod · 0.65
getFileStatsMethod · 0.65
readFileMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected