-
-
Notifications
You must be signed in to change notification settings - Fork 384
Closed
Labels
bugSomething isn't workingSomething isn't working
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?
Type Checking, Completion, Hover
Expected Behaviour
In the following example:
---@class A_Class
local A = { x = 5 }
function A:func()
for i = 1, self.x do
print(i)
end
self.y = 3
self.y = self.y + 3
end
When hovering over self.x
in the for
loop or trying to use auto-completion there, I expect to get x
as a suggestion with the type integer
.
It should be exactly the same result as if the self.y = self.y + 3
line is commented out.
---@class A_Class
local A = { x = 5 }
function A:func()
for i = 1, self.x do
print(i)
end
self.y = 3
--self.y = self.y + 3
end
Actual Behaviour
The type of self
is lost, but only in the for
statement. Auto completion doesn't suggest x
either.
This only happens when the line self.y = self.y + 3
is not removed or commented out. If it is removed, everything works as expected.
Reproduction steps
- Try the code snippets above in VS Code in version 3.6.10 of the LuaLS extension.
Additional Notes
No response
Log File
Let me know if you need it.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working