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

Method addSubtaskToCurrentNote

src/main.ts:1828–1859  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1826 }
1827
1828 async addSubtaskToCurrentNote(): Promise<void> {
1829 try {
1830 const activeFile = this.app.workspace.getActiveFile();
1831 if (!activeFile) {
1832 new Notice("No file is currently open");
1833 return;
1834 }
1835
1836 const allTasks = await this.cacheManager.getAllTasks();
1837 const candidates = allTasks.filter((candidate) => candidate.path !== activeFile.path);
1838 if (candidates.length === 0) {
1839 new Notice(
1840 this.i18n.translate("contextMenus.task.organization.notices.noEligibleSubtasks")
1841 );
1842 return;
1843 }
1844
1845 openTaskSelector(this, candidates, (subtask) => {
1846 if (!subtask) return;
1847 void this.assignSelectedSubtaskToCurrentNote(activeFile, subtask);
1848 });
1849 } catch (error) {
1850 tasknotesLogger.error("Failed to add subtask to current note:", {
1851 category: "persistence",
1852 operation: "add-subtask-current-note",
1853 error: error,
1854 });
1855 new Notice(
1856 this.i18n.translate("contextMenus.task.organization.notices.subtaskSelectFailed")
1857 );
1858 }
1859 }
1860
1861 private async addSelectedProjectToTask(task: TaskInfo, projectFile: TFile): Promise<void> {
1862 try {

Callers 1

Calls 6

openTaskSelectorFunction · 0.90
getActiveFileMethod · 0.80
errorMethod · 0.80
translateMethod · 0.65
getAllTasksMethod · 0.45

Tested by

no test coverage detected