LuaLS / LuaLS/lua-language-server

Treat class field as special function (such as `type`)

Open
#1,734 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

In Factorio, all the API classes have a object_name field (not function!), which identifies their class name, much like type() does for base types. We're currently handling this with a plugin that rewrites this from obj.object_name to look like __object_name(obj) which is then tagged as "Lua.runtime.special": { "__object_name": "type" }, , to get it to work properly in type-tests, but it would be nice to be able to indicate that a class field "acts like type" in this way directly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing plugin rewrite from obj.object_name to __object_name(obj) and the Lua.runtime.special mapping to type. Trace how type-tests consume that mapping, then verify that a direct class-field declaration preserves the same behavior without the rewrite.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.