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

Function preloadLanguagesForFiles

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

Source from the content-addressed store, hash-verified

1005 * (#1628). C++ was already covered; Objective-C was not.
1006 */
1007export function preloadLanguagesForFiles(
1008 files: string[],
1009 overrides?: Record<string, Language>,
1010 rootDir?: string
1011): Language[] {
1012 const languages = [...new Set(files.map((f) => detectLanguage(f, undefined, overrides, rootDir)))];
1013 // A Flow-typed `.js` is read with the TSX grammar (see detectLanguage).
1014 if ((languages.includes('javascript') || languages.includes('jsx')) && !languages.includes('tsx')) languages.push('tsx');
1015 if (languages.includes('c')) {
1016 for (const ambiguous of ['cpp', 'objc'] as const) {
1017 if (!languages.includes(ambiguous)) languages.push(ambiguous);
1018 }
1019 }
1020 // An `.inc` path-detects as PHP but may read as Pascal (#2279) — unless
1021 // codegraph.json maps `.inc` explicitly, which detectLanguage never overrides.
1022 if (
1023 !languages.includes('pascal') &&
1024 !(overrides && overrides['.inc']) &&
1025 files.some((f) => f.toLowerCase().endsWith('.inc'))
1026 ) {
1027 languages.push('pascal');
1028 }
1029 return languages;
1030}
1031
1032export class ScopeIgnore {
1033 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