* Formats a single DocumentSymbol with indentation
( symbol: DocumentSymbol, indent: number = 0, )
| 305 | * Formats a single DocumentSymbol with indentation |
| 306 | */ |
| 307 | function formatDocumentSymbolNode( |
| 308 | symbol: DocumentSymbol, |
| 309 | indent: number = 0, |
| 310 | ): string[] { |
| 311 | const lines: string[] = [] |
| 312 | const prefix = ' '.repeat(indent) |
| 313 | const kind = symbolKindToString(symbol.kind) |
| 314 | |
| 315 | let line = `${prefix}${symbol.name} (${kind})` |
| 316 | if (symbol.detail) { |
| 317 | line += ` ${symbol.detail}` |
| 318 | } |
| 319 | |
| 320 | const symbolLine = symbol.range.start.line + 1 |
| 321 | line += ` - Line ${symbolLine}` |
| 322 | |
| 323 | lines.push(line) |
| 324 | |
| 325 | // Recursively format children |
| 326 | if (symbol.children && symbol.children.length > 0) { |
| 327 | for (const child of symbol.children) { |
| 328 | lines.push(...formatDocumentSymbolNode(child, indent + 1)) |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | return lines |
| 333 | } |
| 334 | |
| 335 | /** |
| 336 | * Formats documentSymbol result (hierarchical outline) |
no test coverage detected