Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function definition into a nested table is not handled properly #1561

Closed
carsakiller opened this issue Sep 17, 2022 · 0 comments
Closed

Function definition into a nested table is not handled properly #1561

carsakiller opened this issue Sep 17, 2022 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@carsakiller
Copy link
Collaborator

I have run into an interesting issue while documenting Busted and luassert.

When defining a function that lives inside some nested table, I am not receiving completions in another file.

Here is a minimal example:

---@class myClass
local myClass = { has = { nested = {} } }

---Nested Function
---@param arg string
---@return boolean rtrn
function myClass.has.nested.fn(arg) end

In that same file, I receive completions for:

myClass.has.nested.fn(arg)

However, in another file, I do not… with completions ending at the below:

---@type myClass
local e = {}

e.has.nested.

Even more interestingly, defining myClass as the below, makes completion start working again in other files.

---@class myClass
local myClass = {
    has = {
        nested = {
            ---@param arg string
            ---@return boolean
            fn = function(arg) end
        }
    }
}

This only appears to be a problem when defining a function using the full function name() end syntax, and does not occur when defining it in the table literal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants