LuaLS / LuaLS/lua-language-server
Treat class field as special function (such as `type`)
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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