MCPcopy
hub / github.com/codeaashu/claude-code / formatCallHierarchyItem

Function formatCallHierarchyItem

src/tools/LSPTool/formatters.ts:428–449  ·  view source on GitHub ↗

* Formats a CallHierarchyItem with its location * Validates URI before formatting to handle malformed LSP data

(
  item: CallHierarchyItem,
  cwd?: string,
)

Source from the content-addressed store, hash-verified

426 * Validates URI before formatting to handle malformed LSP data
427 */
428function formatCallHierarchyItem(
429 item: CallHierarchyItem,
430 cwd?: string,
431): string {
432 // Validate URI - handle undefined/null gracefully
433 if (!item.uri) {
434 logForDebugging(
435 'formatCallHierarchyItem: CallHierarchyItem has undefined URI',
436 { level: 'warn' },
437 )
438 return `${item.name} (${symbolKindToString(item.kind)}) - <unknown location>`
439 }
440
441 const filePath = formatUri(item.uri, cwd)
442 const line = item.range.start.line + 1
443 const kind = symbolKindToString(item.kind)
444 let result = `${item.name} (${kind}) - ${filePath}:${line}`
445 if (item.detail) {
446 result += ` [${item.detail}]`
447 }
448 return result
449}
450
451/**
452 * Formats prepareCallHierarchy result

Callers 1

Calls 3

logForDebuggingFunction · 0.85
symbolKindToStringFunction · 0.85
formatUriFunction · 0.70

Tested by

no test coverage detected