Skip to content

Invalid autocomplete in class functions body #1824

Description

@AFCMS

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Linux

What is the issue affecting?

Completion

Expected Behaviour

Creating a table class including functions should not autocomplete other table fields inside them, but the actual local/globals values.

Actual Behaviour

Capture d’écran du 2023-01-14 09-49-33

Its strange, because it works sometimes.

Capture d’écran du 2023-01-14 09-51-04

Reproduction steps

---@class test_class
---@field test_field fun(s: string): integer
---@field test_field_2 fun(s: integer): string

---@param d test_class
function test_function(d)
    -- Do stuff
end

test_function({
    test_field = function(s)
        -- check it never autocomplete test_field_2 instead of the global/locals
    end,
})

Additional Notes

None

Log File

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions