LanguageExtractor.extractVariables is declared and documented but never called
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- devtools
Research direction
Start in src/extraction/tree-sitter-types.ts: the extractVariables hook is declared near line 308, and VariableInfo and its doc comment sit near lines 30-32. Then find the private extractVariable method in the core extractor and see where its per-language branches and variableTypes array dispatch. Done means either the hook is called before those branches with a test covering it, or the declaration and doc comment are removed. The issue leaves that choice to the maintainers, so confirm it before editing.
Written by the indexing model from the issue text.
Description
src/extraction/tree-sitter-types.ts declares a language hook that nothing calls:
// :308, as of b635dd46
extractVariables?: (node: SyntaxNode, source: string) => VariableInfo[];
VariableInfo is exported at :32, and the interface documentation at :30 refers to it — "Returned by a language's extractVariables hook" — so it reads as a supported extension point. A repo-wide search finds zero call sites in src/. Variables are actually dispatched through the private extractVariable (singular), which reads per-language } else if (this.language === …) branches plus the declarative variableTypes array.
$ grep -rn "extractVariables" src/ | grep -v tree-sitter-types | wc -l
0
Why it matters
A language author writing a new extractor finds the hook, implements it, and gets nothing back: no error, no warning, no node. That is precisely the failure mode this codebase otherwise avoids — silent misses are preferred over wrong edges, but a documented API that silently does nothing is neither.
I hit it adding Nim support. Nim's declared names live in variable_declaration > symbol_declaration_list > symbol_declaration > name, never as a direct child of the declaration, so extractVariables was the obvious hook to write. It did nothing. The working answer was a new } else if (this.language === 'nim') branch in the core's extractVariable — a core edit that a language's own file should not require just to declare variables.
Suggested fix
Either wire it up — call it from extractVariable when present, ahead of the per-language branches, since the shape it already declares is the right one — or delete the declaration and its doc comment so the next person does not follow it. If it is being kept as future work, a one-line "declared, not yet called" note at the declaration would be enough to stop the trap.
Found while adding Nim support (#2463).
- Dominant language
- C
- Stars
- 73.2k
- Forks
- 4.7k
- Avg merge
- 2h 13m
- Merged PRs (30d)
- 418
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from colbymchenry/codegraph
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
colbymchenry/codegraph#2634 ·
Maintainers usually reply within 1 day
-
Windows: bundled Node v24.16.0 can abort at exit (nodejs/node#56645); please bundle Node >= 24.20.0Possibly taken @Ancienttwo claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
colbymchenry/codegraph#2617 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 Under an hour Newbie friendliness 72/100
colbymchenry/codegraph#2482 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
colbymchenry/codegraph#1900 · 2 comments · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
colbymchenry/codegraph#1700 ·
Maintainers usually reply within 1 day
All issues in colbymchenry/codegraph
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
OpenPrinting/cups#1772 ·
Maintainers usually reply within 1 day
-
tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
antoxa2584x/nfsu2-sw#44 · 1 reaction ·
Maintainers usually reply within 1 day