Skip to content

the visibility of the fields of a class is not correctly evaluated when they are defined directly in the object. #2752

Description

@NeOzay

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Completion, Diagnostics/Syntax Checking

Expected Behaviour

hides fields whose scope is not accessible during completion, and triggers a diagnostic when access is not authorized.

Actual Behaviour

the visibility of the fields of a class is not correctly evaluated when they are defined directly in the object.
harms for completion and invisible dianostic.

local class = vm.getParentClass(field)

function getParentClass(field) does not get the class when field is a parser.object of type 'tablefield'

Reproduction steps

---@class Class
local Class = {
	_privateF = 10
}
---@type Class
local instance
instance._privateF = 9

server config:

{
  "Lua.doc.privateName": [
    "_*"
  ],
}

Additional Notes

No response

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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