| 489 | |
| 490 | // Map file extension → query key |
| 491 | function getLanguageQueryKey(path: string): string | null { |
| 492 | const ext = path.match(/\.([a-zA-Z0-9]+)$/)?.[1]?.toLowerCase(); |
| 493 | switch (ext) { |
| 494 | case 'py': return 'python'; |
| 495 | case 'js': case 'jsx': return 'javascript'; |
| 496 | case 'ts': case 'tsx': return 'typescript'; |
| 497 | case 'java': return 'java'; |
| 498 | case 'c': case 'h': return 'c'; |
| 499 | case 'cpp': case 'hpp': case 'cc': return 'cpp'; |
| 500 | case 'go': return 'go'; |
| 501 | case 'rs': return 'rust'; |
| 502 | case 'rb': return 'ruby'; |
| 503 | case 'php': return 'php'; |
| 504 | case 'kt': case 'kts': return 'kotlin'; |
| 505 | case 'dart': return 'dart'; |
| 506 | case 'cs': return 'csharp'; |
| 507 | case 'swift': return 'swift'; |
| 508 | case 'pl': case 'pm': return 'perl'; |
| 509 | default: return null; |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | // Label a definition node type as Class / Function / Interface / etc. |
| 514 | function getNodeDisplayLabel(nodeType: string): string { |