(
folder: NoteFolder,
dirAbs: string,
dirReal: string,
topAbs: string,
isPrimaryRoot: boolean,
ancestors: Set<string>
)
| 2065 | async function collectBuiltinSearchCandidates(root: string): Promise<VaultTextSearchCandidate[]> { |
| 2066 | const files: Array<{ full: string; folder: NoteFolder }> = [] |
| 2067 | const walkFolder = async ( |
| 2068 | folder: NoteFolder, |
| 2069 | dirAbs: string, |
| 2070 | dirReal: string, |
| 2071 | topAbs: string, |
| 2072 | isPrimaryRoot: boolean, |
| 2073 | ancestors: Set<string> |
| 2074 | ): Promise<void> => { |
| 2075 | let entries: Dirent[] |
| 2076 | try { |
| 2077 | entries = await fs.readdir(dirAbs, { withFileTypes: true }) |
| 2078 | } catch { |
| 2079 | return |
| 2080 | } |
| 2081 | |
| 2082 | for (const entry of entries) { |
| 2083 | const full = path.join(dirAbs, entry.name) |
| 2084 | const childReal = await resolveDirDescent(full, entry, dirReal, ancestors) |
| 2085 | if (childReal !== null) { |
| 2086 | if (entry.name.startsWith('.')) continue |
| 2087 | if (isPrimaryRoot && dirAbs === topAbs && shouldHidePrimaryRootEntry(entry.name)) continue |
| 2088 | ancestors.add(childReal) |
| 2089 | await walkFolder(folder, full, childReal, topAbs, isPrimaryRoot, ancestors) |
| 2090 | ancestors.delete(childReal) |
| 2091 | continue |
| 2092 | } |
| 2093 | if (!(await isMarkdownNoteEntry(full, entry))) continue |
| 2094 | files.push({ full, folder }) |
| 2095 | } |
| 2096 | } |
| 2097 | |
| 2098 | for (const folder of SEARCHABLE_TEXT_FOLDERS) { |
| 2099 | const topAbs = await folderRoot(root, folder) |
no test coverage detected