(projectValue: string)
| 617 | } |
| 618 | |
| 619 | private getProjectReferenceTask(projectValue: string): TaskInfo | null { |
| 620 | const trimmedProject = projectValue.trim(); |
| 621 | if (!this.isProjectNoteReference(trimmedProject)) { |
| 622 | return null; |
| 623 | } |
| 624 | |
| 625 | const parsedPath = parseLinkToPath(trimmedProject); |
| 626 | if (!parsedPath) { |
| 627 | return null; |
| 628 | } |
| 629 | |
| 630 | const pathWithoutExtension = parsedPath.replace(/\.md$/i, ""); |
| 631 | const resolvedFile = this.plugin.app.metadataCache.getFirstLinkpathDest( |
| 632 | pathWithoutExtension, |
| 633 | "" |
| 634 | ); |
| 635 | if (resolvedFile) { |
| 636 | const resolvedTask = this.plugin.cacheManager.getCachedTaskInfoSync(resolvedFile.path); |
| 637 | if (resolvedTask) { |
| 638 | return resolvedTask; |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | const candidatePaths = /\.md$/i.test(parsedPath) |
| 643 | ? [parsedPath] |
| 644 | : [parsedPath, `${parsedPath}.md`]; |
| 645 | for (const candidatePath of candidatePaths) { |
| 646 | const task = this.plugin.cacheManager.getCachedTaskInfoSync(candidatePath); |
| 647 | if (task) { |
| 648 | return task; |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | return null; |
| 653 | } |
| 654 | |
| 655 | private isProjectNoteReference(projectValue: string): boolean { |
| 656 | return ( |
no test coverage detected