Skip to content

Feature Request: Hide a parameter from the annotation #2033

@Mayron

Description

@Mayron

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionUser has a question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions