(rootDir: string, relativePath: string)
| 153 | } |
| 154 | |
| 155 | async function buildIdentifierDocsForFile(rootDir: string, relativePath: string): Promise<IdentifierDoc[]> { |
| 156 | const normalized = normalizeRelativePath(relativePath); |
| 157 | const fullPath = resolve(rootDir, normalized); |
| 158 | if (!isSupportedFile(fullPath)) return []; |
| 159 | |
| 160 | try { |
| 161 | const analysis = await analyzeFile(fullPath); |
| 162 | const flat = flattenSymbols(analysis.symbols); |
| 163 | return flat.map((symbol) => ({ |
| 164 | id: `${normalized}:${symbol.name}:${symbol.line}`, |
| 165 | path: normalized, |
| 166 | header: analysis.header, |
| 167 | name: symbol.name, |
| 168 | kind: symbol.kind, |
| 169 | line: symbol.line, |
| 170 | endLine: symbol.endLine, |
| 171 | signature: symbol.signature, |
| 172 | parentName: symbol.parentName, |
| 173 | text: `${symbol.name} ${symbol.kind} ${symbol.signature} ${normalized} ${analysis.header} ${symbol.parentName ?? ""}`, |
| 174 | })); |
| 175 | } catch { |
| 176 | return []; |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | async function buildIdentifierIndex(rootDir: string): Promise<IdentifierIndex> { |
| 181 | if (cachedIndex && cachedRootDir === rootDir && Date.now() - cachedAt < INDEX_TTL_MS) { |
no test coverage detected