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

Function preloadLanguagesForFiles

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

Source from the content-addressed store, hash-verified

1021 * (#1628). C++ was already covered; Objective-C was not.
1022 */
1023export function preloadLanguagesForFiles(
1024 files: string[],
1025 overrides?: Record<string, Language>,
1026 rootDir?: string
1027): Language[] {
1028 const languages = [...new Set(files.map((f) => detectLanguage(f, undefined, overrides, rootDir)))];
1029 // A Flow-typed `.js` is read with the TSX grammar (see detectLanguage).
1030 if ((languages.includes('javascript') || languages.includes('jsx')) && !languages.includes('tsx')) languages.push('tsx');
1031 if (languages.includes('c')) {
1032 for (const ambiguous of ['cpp', 'objc'] as const) {
1033 if (!languages.includes(ambiguous)) languages.push(ambiguous);
1034 }
1035 }
1036 // An `.inc` path-detects as PHP but may read as Pascal (#2279) — unless
1037 // codegraph.json maps `.inc` explicitly, which detectLanguage never overrides.
1038 if (
1039 !languages.includes('pascal') &&
1040 !(overrides && overrides['.inc']) &&
1041 files.some((f) => f.toLowerCase().endsWith('.inc'))
1042 ) {
1043 languages.push('pascal');
1044 }
1045 return languages;
1046}
1047
1048export class ScopeIgnore {
1049 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