LuaLS / LuaLS/lua-language-server
Feature Request: Hide a parameter from the annotation
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
I have a table with a metatable assigned to it to implement inheritance. The metatable's `__index` metamethod intercepts a call to a function on the original table and gets the actual function from the "parent" table and then injects another parameter into the function call.
For example, the user would call the function like this: `tbl:Execute("hello", "world")` and the function would be implemented like this:
```lua
function ParentTable:Execute(data, hello, world)
-- data is a special parameter controlled by the metatable and is given a table value
-- hello is assigned "hello" and world is assigned "world"
end
```
The problem with this is that VS Code and LuaLS warns the user that they didn't provide a value to `data`. I have to use `@overload` to every single method to say you can call this method with just "hello" and "world" arguments provided.
I want to be able to tell LuaLS to completely hide/ignore the `data` parameter and pretend it doesn't exist; essentially moving all other parameter indexes down by 1 to fill the empty spot, so "hello" is recognized as parameter 1 and "world" as parameter 2.
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 tracing how LuaLS handles function parameter annotations, @overload declarations, and calls intercepted through a metatable's __index metamethod. Done means LuaLS can hide the injected data parameter, shift the visible arguments, and stop warning when callers provide only hello and world.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100