MCPcopy Index your code
hub / github.com/codeaashu/claude-code / formatDocumentSymbolNode

Function formatDocumentSymbolNode

src/tools/LSPTool/formatters.ts:307–333  ·  view source on GitHub ↗

* Formats a single DocumentSymbol with indentation

(
  symbol: DocumentSymbol,
  indent: number = 0,
)

Source from the content-addressed store, hash-verified

305 * Formats a single DocumentSymbol with indentation
306 */
307function 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)

Callers 1

Calls 2

symbolKindToStringFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected