feat: Add content-based C++ detection for .h headers
Addresses C++ classes missing from .h files where extension-based detection defaults to 'c' language which has no class extraction support. Adds looksLikeCpp() heuristic that scans first 8KB for C++-specific patterns (namespace, class, template, access specifiers) to promote .h files to 'cpp' language when C++ constructs are detected. Ensures cpp grammar is loaded alongside c to handle potential .h promotion during parsing.
This commit is contained in:
@@ -20,7 +20,7 @@ parentPort!.on('message', async (msg: { type: string; id?: number; filePath?: st
|
||||
} else if (msg.type === 'parse') {
|
||||
const { id, filePath, content } = msg;
|
||||
try {
|
||||
const language = detectLanguage(filePath!);
|
||||
const language = detectLanguage(filePath!, content);
|
||||
const result: ExtractionResult = extractFromSource(filePath!, content!, language);
|
||||
|
||||
// Periodic parser reset to reclaim WASM heap memory
|
||||
|
||||
Reference in New Issue
Block a user