MCPcopy
hub / github.com/giancarloerra/SocratiCode / getLanguageFromExtension

Function getLanguageFromExtension

src/constants.ts:389–399  ·  view source on GitHub ↗
(
  ext: string,
  override: Map<string, string> = EXTENSION_LANGUAGE_MAP,
)

Source from the content-addressed store, hash-verified

387 * matches what a native file of that language would get.
388 */
389export function getLanguageFromExtension(
390 ext: string,
391 override: Map<string, string> = EXTENSION_LANGUAGE_MAP,
392): string {
393 // Normalize so a caller passing an uppercase ext still matches the
394 // (lowercased) override keys; the only case-sensitive built-in key, `.R`,
395 // collapses to `.r` with the same value, so this changes nothing else.
396 const normalized = ext.toLowerCase();
397 const target = override.get(normalized) ?? normalized;
398 return EXTENSION_TO_LANGUAGE[target] || "plaintext";
399}

Callers 8

extractSymbolsAndCallsFunction · 0.85
buildCodeGraphFunction · 0.85
chunkFileContentFunction · 0.85
getGraphStatsFunction · 0.85
generateMermaidDiagramFunction · 0.85
buildFileVizDataFunction · 0.85
constants.test.tsFile · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected