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

Method handleFilesChanged

core/core.ts:1242–1306  ·  view source on GitHub ↗
({
    data,
  }: Message<{
    uris?: string[];
  }>)

Source from the content-addressed store, hash-verified

1240 }
1241
1242 private async handleFilesChanged({
1243 data,
1244 }: Message<{
1245 uris?: string[];
1246 }>): Promise<void> {
1247 if (data?.uris?.length) {
1248 const diffCache = GitDiffCache.getInstance(getDiffFn(this.ide));
1249 diffCache.invalidate();
1250 walkDirCache.invalidate(); // safe approach for now - TODO - only invalidate on relevant changes
1251 const currentProfileUri =
1252 this.configHandler.currentProfile?.profileDescription.uri ?? "";
1253 for (const uri of data.uris) {
1254 if (URI.equal(uri, currentProfileUri)) {
1255 // Trigger a toast notification to provide UI feedback that config has been updated
1256 const showToast =
1257 this.globalContext.get("showConfigUpdateToast") ?? true;
1258 if (showToast) {
1259 const selection = await this.ide.showToast(
1260 "info",
1261 "Config updated",
1262 "Don't show again",
1263 );
1264 if (selection === "Don't show again") {
1265 this.globalContext.update("showConfigUpdateToast", false);
1266 }
1267 }
1268 await this.configHandler.reloadConfig(
1269 "Current profile config file updated",
1270 );
1271 continue;
1272 }
1273 if (isColocatedRulesFile(uri)) {
1274 try {
1275 const codebaseRulesCache = CodebaseRulesCache.getInstance();
1276 void codebaseRulesCache.update(this.ide, uri).then(() => {
1277 void this.configHandler.reloadConfig("Codebase rule update");
1278 });
1279 } catch (e) {
1280 Logger.error(`Failed to update codebase rule: ${e}`);
1281 }
1282 } else if (isContinueConfigRelatedUri(uri)) {
1283 await this.configHandler.reloadConfig(
1284 "Local config-related file updated",
1285 );
1286 } else if (
1287 uri.endsWith(".continueignore") ||
1288 uri.endsWith(".gitignore")
1289 ) {
1290 // Reindex the workspaces
1291 this.invoke("index/forceReIndex", {
1292 shouldClearIndexes: true,
1293 });
1294 } else {
1295 const { config } = await this.configHandler.loadConfig();
1296 if (config && !config.disableIndexing) {
1297 // Reindex the file
1298 const ignore = await shouldIgnore(uri, this.ide);
1299 if (!ignore) {

Callers

nothing calls this directly

Calls 14

invokeMethod · 0.95
getDiffFnFunction · 0.90
isColocatedRulesFileFunction · 0.90
shouldIgnoreFunction · 0.90
errorMethod · 0.80
getMethod · 0.65
showToastMethod · 0.65
updateMethod · 0.65
getInstanceMethod · 0.45
invalidateMethod · 0.45

Tested by

no test coverage detected