EmmyLua / IntelliJ-EmmyLua

Lua IDE/Debugger Plugin for IntelliJ IDEA
https://emmylua.github.io
Apache License 2.0
1.73k stars 290 forks source link

[Feature] Generic on a table with type suggestion #467

Open ghost opened 2 years ago

ghost commented 2 years ago

Windows 10 IntelliJ IDEA 2019.2.4

--- @generic T
--- @param value { value : T, get : (fun(val : T) : T) }
--- @return any
function Test(value)
    return value;
end

local value = Test({
    value = 2,
    get = function(val)
        return val; -- val should be showed as type number to
    end
});

What happens?(出现什么问题?)

The suggestions is not showing the defined param table content type correctly. image

What were you expecting to happen?(期望?)

To show the type corectly. image image