Port extraction quality improvements from PR #15

- Fix arrow function extraction: explicitly call extractFunction() for
  arrow functions/function expressions in variable declarations instead
  of silently skipping them (all 6 arrow function tests now pass)
- Best-candidate resolution: collect candidates from all strategies and
  return highest confidence match instead of first match
- Fix graph traversal 'both' direction: correctly determine next node
  for mixed incoming/outgoing edges in BFS and DFS

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Colby McHenry
2026-02-09 23:55:00 -06:00
co-authored by Claude Opus 4.6
parent d80900f653
commit 94c8d5ccaa
3 changed files with 23 additions and 9 deletions
+3 -2
View File
@@ -1294,9 +1294,10 @@ export class TreeSitterExtractor {
if (nameNode) {
const name = getNodeText(nameNode, this.source);
// Skip if it looks like a function (arrow function or function expression)
// Arrow functions / function expressions: extract as function instead of variable
if (valueNode && (valueNode.type === 'arrow_function' || valueNode.type === 'function_expression')) {
continue; // Already handled by function extraction
this.extractFunction(valueNode);
continue;
}
// Capture first 100 chars of initializer for context (stored in signature for searchability)