Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

LanguageExtractor.extractVariables is declared and documented but never called

Open
#2,465 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from colbymchenry/codegraph

All issues in colbymchenry/codegraph

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.