LuaLS / LuaLS/lua-language-server
Override is prevented from linter
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
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
local a = {}
a.__index = a
function a:m1()
end
-- b inherit from a
local b = setmetatable({}, a)
-- override m2()
function b:m2() --- no warning generated
end
Actual Behaviour
local a = {}
a.__index = a
function a:m1()
end
-- b inherit from a
local b = setmetatable({}, a)
-- override m2()
function b:m2() --- duplicate field `m`
end
Reproduction steps
- Just copy the code and lint them
Additional Notes
Inheritance and override methods is prevent by LuaLS linter.
Override is a common and basic concept. But LuaLS seems can't recognize it but provide warnings.
In the case, m2 is not a duplicate field, but just shadowing or overriding.
Log File
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the diagnostic in the Visual Studio Code Extension using the Lua snippet under Diagnostics/Syntax Checking. Then trace the linter’s duplicate-field diagnostic and its handling of setmetatable inheritance; done means m2 is not reported as a duplicate while unrelated duplicate fields still are.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100