( reference: string, sourcePath: string )
| 2630 | } |
| 2631 | |
| 2632 | private async resolveTaskReferencePath( |
| 2633 | reference: string, |
| 2634 | sourcePath: string |
| 2635 | ): Promise<string | null> { |
| 2636 | const linkPath = firstReferencePathCandidate(reference); |
| 2637 | if (!linkPath) return null; |
| 2638 | |
| 2639 | type Nullable<T> = T | null; |
| 2640 | type MetadataCacheWithLinkResolver = { |
| 2641 | getFirstLinkpathDest?: (linkpath: string, sourcePath: string) => Nullable<TFile>; |
| 2642 | }; |
| 2643 | const metadataCache = this.plugin.app.metadataCache as MetadataCacheWithLinkResolver | undefined; |
| 2644 | const resolvedFile = metadataCache?.getFirstLinkpathDest?.(linkPath, sourcePath); |
| 2645 | if (resolvedFile instanceof TFile) return normalizePath(resolvedFile.path); |
| 2646 | |
| 2647 | for (const candidate of taskReferencePathCandidates(linkPath)) { |
| 2648 | const task = await this.plugin.cacheManager.getTaskInfo(candidate); |
| 2649 | if (task) return task.path; |
| 2650 | } |
| 2651 | |
| 2652 | return normalizePath(linkPath); |
| 2653 | } |
| 2654 | |
| 2655 | private async requireTask(path: string): Promise<TaskInfo> { |
| 2656 | const normalizedPath = this.normalizeTaskPath(path); |
no test coverage detected