MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / handleFileRenamed

Method handleFileRenamed

src/utils/TaskManager.ts:225–247  ·  view source on GitHub ↗

* Handle file rename

(file: TFile, oldPath: string)

Source from the content-addressed store, hash-verified

223 * Handle file rename
224 */
225 private handleFileRenamed(file: TFile, oldPath: string): void {
226 const pendingTaskInfo = this.pendingTaskInfoByPath.get(oldPath);
227 if (pendingTaskInfo) {
228 this.pendingTaskInfoByPath.delete(oldPath);
229 this.pendingTaskInfoByPath.set(file.path, {
230 ...pendingTaskInfo,
231 id: file.path,
232 path: file.path,
233 });
234 }
235
236 // Cancel any pending debounced handlers for old path
237 const timeoutId = this.debouncedHandlers.get(oldPath);
238 if (timeoutId) {
239 window.clearTimeout(timeoutId);
240 this.debouncedHandlers.delete(oldPath);
241 }
242 this.removeFilterIndexEntry(oldPath);
243 this.updateFilterIndexesForFile(file.path, this.app.metadataCache.getFileCache(file));
244
245 this.trigger("file-renamed", { oldPath, newPath: file.path, file });
246 this.trigger("data-changed");
247 }
248
249 /**
250 * Check if a file path is valid for inclusion

Callers 1

Calls 8

getFileCacheMethod · 0.80
getMethod · 0.65
deleteMethod · 0.65
setMethod · 0.65
clearTimeoutMethod · 0.65
triggerMethod · 0.65

Tested by

no test coverage detected