( editor: Editor, sourceFile?: Nullable<TFile> )
| 1607 | } |
| 1608 | |
| 1609 | async openQuickActionsForTaskUnderCursor( |
| 1610 | editor: Editor, |
| 1611 | sourceFile?: Nullable<TFile> |
| 1612 | ): Promise<void> { |
| 1613 | try { |
| 1614 | const activeFile = sourceFile ?? this.app.workspace.getActiveFile(); |
| 1615 | if (!activeFile) { |
| 1616 | new Notice("No file is currently open"); |
| 1617 | return; |
| 1618 | } |
| 1619 | |
| 1620 | const detectionService = await this.getTaskLinkDetectionService(); |
| 1621 | const link = this.getTaskLinkAtCursor(editor, detectionService); |
| 1622 | if (!link) { |
| 1623 | new Notice("No task link found"); |
| 1624 | return; |
| 1625 | } |
| 1626 | |
| 1627 | const detected = await detectionService.detectTaskLink( |
| 1628 | link.match, |
| 1629 | activeFile.path, |
| 1630 | link.type |
| 1631 | ); |
| 1632 | if (!detected.isValidTaskLink || !detected.taskInfo) { |
| 1633 | new Notice("No task link found"); |
| 1634 | return; |
| 1635 | } |
| 1636 | |
| 1637 | await this.openQuickActionsForTaskInfo(detected.taskInfo); |
| 1638 | } catch (error) { |
| 1639 | tasknotesLogger.error("Error opening quick actions for task under cursor:", { |
| 1640 | category: "persistence", |
| 1641 | operation: "opening-quick-actions-task-under-cursor", |
| 1642 | error: error, |
| 1643 | }); |
| 1644 | new Notice("Failed to open quick actions"); |
| 1645 | } |
| 1646 | } |
| 1647 | |
| 1648 | async openTaskEditModalForCurrentTask(): Promise<void> { |
| 1649 | const activeFile = this.app.workspace.getActiveFile(); |
no test coverage detected