MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / handleFileRenamed

Method handleFileRenamed

src/utils/DependencyCache.ts:217–229  ·  view source on GitHub ↗

* Handle file rename

(file: TFile, oldPath: string)

Source from the content-addressed store, hash-verified

215 * Handle file rename
216 */
217 private handleFileRenamed(file: TFile, oldPath: string): void {
218 // Get metadata for new path
219 const frontmatter = this.getFrontmatterForFile(file);
220
221 // Clear old path
222 this.clearFileFromIndexes(oldPath);
223
224 // Index new path if it's a task
225 if (this.isValidFile(file.path) && frontmatter && this.isTaskFileCallback(frontmatter)) {
226 this.indexTaskFile(file.path, frontmatter);
227 }
228 this.trigger(EVENT_DEPENDENCY_CACHE_CHANGED);
229 }
230
231 private getFrontmatterForFile(file: TFile): Record<string, unknown> | null {
232 const metadata = this.app.metadataCache.getFileCache(file);

Callers 1

setupEventListenersMethod · 0.95

Calls 5

getFrontmatterForFileMethod · 0.95
clearFileFromIndexesMethod · 0.95
isValidFileMethod · 0.95
indexTaskFileMethod · 0.95
triggerMethod · 0.65

Tested by

no test coverage detected