LanguageExtractor.extractVariables is declared and documented but never called
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 半天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- devtools
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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).
- 主要语言
- C
- 星标
- 73.2k
- 派生
- 4.7k
- 平均合并
- 11 小时 28 分钟
- 30 天内合并 PR
- 596
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
colbymchenry/codegraph 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
colbymchenry/codegraph#1900 · 2 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
colbymchenry/codegraph#1700 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
colbymchenry/codegraph#1535 · 2 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 63/100
colbymchenry/codegraph#1403 ·
维护者通常 1 天内回复
-
agent-target
难度 2/5 1-3 小时 新手友好度 68/100
colbymchenry/codegraph#649 · 5 条评论 · 50 个 reaction ·
维护者通常 1 天内回复
查看 colbymchenry/codegraph 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
polhenarejos/pico-fido#302 ·
-
难度 2/5 1-3 小时 新手友好度 67/100
espressif/esp-vision#16 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 74/100
libsdl-org/SDL#16577 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
halt_error adds a trailing newline for non-string input, contrary to the manual可能已有人在做 @Huang-404-Q 今天认领。 未关闭
难度 1/5 1-3 小时 新手友好度 88/100
维护者通常 2 天内回复