* Folder suggestions for creating a new note, mirroring the sidebar NOTES tree: * the vault root plus its real subfolders. Excludes `archive` (a separate * lifecycle area) and the redundant bare `inbox` (which is the root itself).
(folders: FolderEntry[])
| 83 | * lifecycle area) and the redundant bare `inbox` (which is the root itself). |
| 84 | */ |
| 85 | function buildNotesFolderSuggestions(folders: FolderEntry[]): PromptSuggestion[] { |
| 86 | const out: PromptSuggestion[] = [{ value: '', label: 'Vault root' }] |
| 87 | const seen = new Set<string>(['']) |
| 88 | for (const folder of folders) { |
| 89 | if (folder.folder !== 'inbox') continue // notes area only |
| 90 | const sub = normalizeMoveTarget(folder.subpath) |
| 91 | if (!sub || seen.has(sub)) continue |
| 92 | seen.add(sub) |
| 93 | const parts = sub.split('/') |
| 94 | out.push({ value: sub, detail: parts.slice(0, -1).join('/') || 'Vault root' }) |
| 95 | } |
| 96 | return out.sort((a, b) => { |
| 97 | const aDepth = a.value === '' ? -1 : a.value.split('/').length |
| 98 | const bDepth = b.value === '' ? -1 : b.value.split('/').length |
| 99 | return aDepth - bDepth || a.value.localeCompare(b.value) |
| 100 | }) |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Prompt for where a new note should be created. Defaults to `initialPath` |
no test coverage detected