Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for 循环没有注释提示 #20

Closed
kaishiqi opened this issue Apr 8, 2021 · 3 comments
Closed

for 循环没有注释提示 #20

kaishiqi opened this issue Apr 8, 2021 · 3 comments

Comments

@kaishiqi
Copy link

kaishiqi commented Apr 8, 2021

---@class Cat
local Cat = class()

function Cat:test()
end


---@type table<string, Cat>
local catsMap = {}


---@return table<string, Cat>
function getCatsMap()
    return catsMap
end


---@param catData Cat
for catId, catData in pairs(getCatsMap()) do
    catData:test()  -- 这句打的时候没提示
end

如题,这是一个简单的例子,for循环中的提示还是蛮常用的,期待这个支持能早日向emmet一样。
这是我在vscod中用到的最好用的插件了,所以很期待能早日解决这个需求,感激不尽~谢谢辛苦付出的作者

@yinfei8
Copy link
Collaborator

yinfei8 commented Apr 8, 2021

恩,好的,多谢反馈,这个例子我们会尽快验证并解决

@yinfei8
Copy link
Collaborator

yinfei8 commented Apr 8, 2021

非常感谢你的反馈
目前最新的0.1.50版本已经修复了上面的bug

注解有很强的推导跟踪功能,你上面的例子可以最简化如下面的:

---@class Cat
local Cat = class()

function Cat:test()
end

---@type table<string, Cat>
local catsMap = {}


function getCatsMap()
    return catsMap
end

for catId, catData in pairs(getCatsMap()) do
    
end

为了验证注解是否生效,鼠标可以放在测试的变量上面,如果弹出的hover框有内容,表示注解生效了
image

@kaishiqi
Copy link
Author

kaishiqi commented Apr 9, 2021

亲测已修!感谢作者的辛勤,又可以愉快的coding了

@kaishiqi kaishiqi closed this as completed Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants