MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / preloadLanguagesForFiles

Function preloadLanguagesForFiles

src/extraction/index.ts:1100–1125  ·  view source on GitHub ↗
(
  files: string[],
  overrides?: Record<string, Language>,
  rootDir?: string
)

Source from the content-addressed store, hash-verified

1098 * (#1628). C++ was already covered; Objective-C was not.
1099 */
1100export function preloadLanguagesForFiles(
1101 files: string[],
1102 overrides?: Record<string, Language>,
1103 rootDir?: string
1104): Language[] {
1105 const languages = [...new Set(files.map((f) => detectLanguage(f, undefined, overrides, rootDir)))];
1106 // A Flow-typed `.js` is read with the TSX grammar (see detectLanguage).
1107 if ((languages.includes('javascript') || languages.includes('jsx')) && !languages.includes('tsx')) languages.push('tsx');
1108 if (languages.includes('c')) {
1109 for (const ambiguous of ['cpp', 'objc'] as const) {
1110 if (!languages.includes(ambiguous)) languages.push(ambiguous);
1111 }
1112 }
1113 // An Objective-C++ file's C++ is read with the C++ grammar (objcpp-extractor.ts).
1114 if (!languages.includes('cpp') && files.some((f) => f.toLowerCase().endsWith('.mm'))) languages.push('cpp');
1115 // An `.inc` path-detects as PHP but may read as Pascal (#2279) — unless
1116 // codegraph.json maps `.inc` explicitly, which detectLanguage never overrides.
1117 if (
1118 !languages.includes('pascal') &&
1119 !(overrides && overrides['.inc']) &&
1120 files.some((f) => f.toLowerCase().endsWith('.inc'))
1121 ) {
1122 languages.push('pascal');
1123 }
1124 return languages;
1125}
1126
1127export class ScopeIgnore {
1128 private embedded: Array<{ root: string; matcher: Ignore }>;

Callers 4

indexAllMethod · 0.85
syncMethod · 0.85

Calls 3

detectLanguageFunction · 0.90
mapMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected