lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

---@return self

Open RomanSpector opened this issue 2 years ago • 3 comments

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

Expected Behaviour

image

Actual Behaviour

image

Reproduction steps

---@class Test1
local Test1 = {};

---@return self
function Test1:New()
    return setmetatable({}, { __indeex = self });
end

---@class Test2 : Test1
local Test2 = {};


local test1 = Test1:New();
local test2 = Test2:New();

Additional Notes

No response

Log File

No response

RomanSpector avatar Mar 12 '23 10:03 RomanSpector

Isn't this a duplicate of https://github.com/LuaLS/lua-language-server/issues/1505 ?

C3pa avatar Mar 18 '23 10:03 C3pa

Is this issue fixed?

zhangchongyu avatar Feb 11 '25 13:02 zhangchongyu

Is this issue fixed?

I don't think so. You may want to try the workaround mentioned here: https://github.com/LuaLS/lua-language-server/discussions/3057#discussioncomment-11983912

Or use CppCXY's new rust-based language server: https://github.com/LuaLS/lua-language-server/issues/3017 His server has better generic support, including the correct behavior mentioned in this issue.

tomlau10 avatar Feb 11 '25 15:02 tomlau10