Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Lua: allow declaring custom module-loader functions so Require("path.lua") maps to import edges

未关闭
#1,617 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
lua
领域
devtools

调研方向

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_refs contains exactly 691 entries named Require, matching the number of Require(...) call sites in the source.
  • The whole index has 2 imports edges, both from a standard require("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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

colbymchenry/codegraph 的其他 Issue

查看 colbymchenry/codegraph 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。