MCPcopy
hub / github.com/callumalpass/tasknotes / updateFilterIndexesForFile

Method updateFilterIndexesForFile

src/utils/TaskManager.ts:385–410  ·  view source on GitHub ↗
(path: string, cache: unknown)

Source from the content-addressed store, hash-verified

383 }
384
385 private updateFilterIndexesForFile(path: string, cache: unknown): boolean {
386 if (!this.filterIndexesBuilt) {
387 return true;
388 }
389
390 if (!this.isValidFile(path)) {
391 return this.removeFilterIndexEntry(path);
392 }
393
394 const frontmatter = this.getFrontmatterFromCache(cache) ?? this.getFrontmatterForPath(path);
395 if (!frontmatter || !this.isTaskFile(frontmatter)) {
396 return this.removeFilterIndexEntry(path);
397 }
398
399 const nextEntry = this.createFilterIndexEntry(path, frontmatter);
400 const previousEntry = this.taskFilterEntries.get(path);
401 if (previousEntry?.signature === nextEntry.signature) {
402 return false;
403 }
404
405 if (previousEntry) {
406 this.removeFilterIndexEntry(path);
407 }
408 this.addFilterIndexEntry(nextEntry);
409 return true;
410 }
411
412 private updateFilterIndexesFromTaskInfo(path: string, taskInfo: TaskInfo): boolean {
413 if (!this.filterIndexesBuilt) {

Callers 2

handleFileChangedMethod · 0.95
handleFileRenamedMethod · 0.95

Calls 8

isValidFileMethod · 0.95
getFrontmatterForPathMethod · 0.95
isTaskFileMethod · 0.95
addFilterIndexEntryMethod · 0.95
getMethod · 0.65

Tested by

no test coverage detected