Skip to content

bad Diagnostics. (inject-field) #2746

Closed
@NeOzay

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?

Diagnostics/Syntax Checking

Expected Behaviour

the language server correctly deduces the type of the variable but indicates which is not declared.
only occurs when variables are declared at object creation.

image
image

Actual Behaviour

nothing

Reproduction steps

---@class test
---@field position number
local test = {
      position = 0,
      started = false,
}
  
---@param animation test
local function f1(animation)
  animation.position = 1 -- ok
  animation.started = false -- Diagnostics. (inject-field)
end

Additional Notes

No response

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions