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

Method refreshCodebaseIndex

core/indexing/CodebaseIndexer.ts:724–769  ·  view source on GitHub ↗
(paths: string[])

Source from the content-addressed store, hash-verified

722 }
723
724 public async refreshCodebaseIndex(paths: string[]) {
725 if (!this.indexingCancellationController.signal.aborted) {
726 this.indexingCancellationController.abort();
727 }
728 const localController = new AbortController();
729 this.indexingCancellationController = localController;
730
731 for await (const update of this.waitForDBIndex()) {
732 this.updateProgress(update);
733 }
734
735 await IndexLock.lock(paths.join(", ")); // acquire the index lock to prevent multiple windows to begin indexing
736 const indexLockTimestampUpdateInterval = setInterval(
737 () => void IndexLock.updateTimestamp(),
738 5_000,
739 );
740
741 try {
742 for await (const update of this.refreshDirs(
743 paths,
744 localController.signal,
745 )) {
746 this.updateProgress(update);
747
748 if (update.status === "failed") {
749 await this.sendIndexingErrorTelemetry(update);
750 }
751 }
752 } catch (e: any) {
753 console.log(`Failed refreshing codebase index directories: ${e}`);
754 await this.handleIndexingError(e);
755 }
756
757 clearInterval(indexLockTimestampUpdateInterval); // interval will also be cleared when window closes before indexing is finished
758 await IndexLock.unlock();
759
760 // Directly refresh submenu items
761 if (this.messenger) {
762 this.messenger.send("refreshSubmenuItems", {
763 providers: "all",
764 });
765 }
766 if (this.indexingCancellationController === localController) {
767 this.indexingCancellationController.abort();
768 }
769 }
770
771 public async refreshCodebaseIndexFiles(files: string[]) {
772 // Can be cancelled by codebase index but not vice versa

Callers 4

handleConfigUpdateMethod · 0.95
constructorMethod · 0.80

Calls 11

waitForDBIndexMethod · 0.95
updateProgressMethod · 0.95
refreshDirsMethod · 0.95
handleIndexingErrorMethod · 0.95
lockMethod · 0.80
updateTimestampMethod · 0.80
unlockMethod · 0.80
logMethod · 0.65
sendMethod · 0.65
abortMethod · 0.45

Tested by

no test coverage detected