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

Method getCachedTaskInfoSync

src/utils/TaskManager.ts:921–942  ·  view source on GitHub ↗

* Synchronous task info getter (reads from metadataCache)

(path: string)

Source from the content-addressed store, hash-verified

919 * Synchronous task info getter (reads from metadataCache)
920 */
921 getCachedTaskInfoSync(path: string): TaskInfo | null {
922 if (!this.isValidFile(path)) return null;
923
924 const file = this.app.vault.getAbstractFileByPath(path);
925 if (!(file instanceof TFile)) return null;
926
927 const pendingTaskInfo = this.getPendingTaskInfo(path);
928 const metadata = this.app.metadataCache.getFileCache(file);
929 if (!metadata?.frontmatter) {
930 return pendingTaskInfo;
931 }
932
933 const metadataTaskInfo = this.isTaskFile(metadata.frontmatter)
934 ? this.extractTaskInfoFromNative(path, metadata.frontmatter)
935 : null;
936 if (pendingTaskInfo && this.shouldUsePendingTaskInfo(pendingTaskInfo, metadataTaskInfo)) {
937 return pendingTaskInfo;
938 }
939
940 this.pendingTaskInfoByPath.delete(path);
941 return metadataTaskInfo;
942 }
943
944 private async readFrontmatterFromFile(file: TFile): Promise<Record<string, unknown> | null> {
945 try {

Calls 8

isValidFileMethod · 0.95
getPendingTaskInfoMethod · 0.95
isTaskFileMethod · 0.95
getAbstractFileByPathMethod · 0.80
getFileCacheMethod · 0.80
deleteMethod · 0.65

Tested by

no test coverage detected