Lua: allow declaring custom module-loader functions so Require("path.lua") maps to import edges
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
No implementation files or tests are named. Start by tracing how standard Lua require calls become import edges and how per-project language configuration is handled, using the cited #906 configuration pattern and #660 dependency-edge fix as context. Add coverage for configured loader functions with string-literal and non-literal arguments; done means literal paths resolve to import edges and non-literals retain the current unresolved-call behavior.
由索引模型根据 Issue 内容生成。
描述
Summary
Feature request: let a project declare which functions act as module loaders, so calls like Require("Script/Foo.lua") become imports edges instead of unresolved calls.
Standard require("mod.name") already works — that is not the issue. The gap is codebases that ship their own loader, which is common in embedded Lua (games, plugin hosts) where the host defines a path-based loader rather than using package.path.
Current behaviour
On an indexed 2,107-file Lua game client:
unresolved_refscontains exactly 691 entries namedRequire, matching the number ofRequire(...)call sites in the source.- The whole index has 2
importsedges, both from a standardrequire("perf.profiler")in one file. - So the file→file dependency layer is empty, even though every path is a plain string literal:
Require("Script/Activity/ActivityMgrC.lua").
callers on a module file returns 0, and impact on it cannot see the files that load it.
Proposed
Config key listing loader function names, e.g.
{ "lua": { "loaderFunctions": ["Require", "Include"] } }
When a listed function is called with a string literal, resolve it against the project root (and any configured roots) and emit an imports edge to the target file node; fall back to the current unresolved-call behaviour when the argument is not a literal.
Precedent
- #660 — PHP
include/require(_once)were not mapped to dependency edges; fixed. Same shape of problem, except there the construct is language syntax, so no configuration was needed. For Lua the loader is user-defined, hence the config key. - #906 — custom extension → language mapping was accepted as opt-in config, so per-project language config already exists as a pattern.
Notes
Low priority relative to #1616: this one only degrades the dependency layer, and only for projects with a custom loader. Standard require users are unaffected.
- 主要语言
- C
- 星标
- 73.2k
- 派生
- 4.7k
- 平均合并
- 3 小时 12 分钟
- 30 天内合并 PR
- 589
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
colbymchenry/codegraph 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
colbymchenry/codegraph#2982 ·
维护者通常 1 天内回复
-
mcp: a non-object tools/call arguments crashes the handler and is reported as an internal error to retry可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
colbymchenry/codegraph#2981 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
colbymchenry/codegraph#2974 ·
维护者通常 1 天内回复
-
search: FTS special characters are deleted, not separated, so leaf(entry) matches nothing可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
colbymchenry/codegraph#2971 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
colbymchenry/codegraph#2959 ·
维护者通常 1 天内回复
查看 colbymchenry/codegraph 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 68/100
JustAResearcher/gpu-unlock-ada#110 ·
维护者通常 1 天内回复
-
documentation hygiene
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复