Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#1,617 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
lua
Ambito
devtools

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C
Stelle
73.2k
Fork
4.7k
Merge medio
2h 13m
PR unite (30g)
418

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di colbymchenry/codegraph

Tutte le issue di colbymchenry/codegraph

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.