Skip to content

Lua extractor is a thin pass-through; misses method calls, local functions, varargs #1478

Description

@Widthdom

Summary

The Lua reference extractor is a thin pass-through with minimal language-specific logic. Idiomatic Lua patterns produce no symbols or references:

  • Method calls via : colon syntax: obj:method()
  • local function foo() end declarations
  • function tbl.k.l(arg) table-key function definitions
  • Varargs function f(...) and function f(a, ...)
  • Table indexing as a reference site: local x = t.field

Evidence

  • src/CodeIndex/Indexer/References/Languages/LuaReferenceExtractor.cs:1-50EmitAdditionalCallReferences matches only the regex ^\s*(?<name>[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)?)\s+(?=[\"'\{A-Za-z_]) (command-style calls with space-separated args).

  • Reproducer:

    local M = {}
    local function helper() return 1 end
    function M.work(x, ...)
      return self:run(x)
    end
    return M

    Indexing this file produces effectively no symbol or reference data beyond what the generic scanner extracts.

Impact

  • Lua codebases (game scripting, OpenResty, Neovim plugins) get a degraded indexing experience compared to other supported languages.
  • references and callers against Lua targets return little useful data.

Proposed direction

  • Add explicit handlers for the four idioms above (method-colon, local function, table-key def, varargs).
  • Add a unit test for each idiom.
  • Reuse the container-stack pattern used by other extractors for nested function definitions.

Repro env

  • Branch: main @ 2ee912d (release v1.21.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions