Tencent / LuaHelper

LuaHelper is a High-performance lua VSCode plugin, Language Server Protocol for lua.
Other
588 stars 91 forks source link

多维数组类型,注解不能正常解析 #179

Open GingerWine opened 1 year ago

GingerWine commented 1 year ago

测试代码

如下:

---@type number[][] 
local mdArray = {{1,2,3}, {4,5,6}}  
local subArray = mdArray[1]
local element = subArray[1]

预期

mdArray 被识别为 number[][] subArray 被识别为 number[] element 被识别为 number

实际识别结果

image image image

临时解决方法

将 ---@type number[][] 改为 ---@type (number[])[] 如下:

---@type (number[])[] 
local mdArray = {{1,2,3}, {4,5,6}}  
local subArray = mdArray[1]
local element = subArray[1]

则可以正常解析: image

但这样写确实有点丑,并且不太方便