File tree 3 files changed +19
-0
lines changed
3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1
1
# changelog
2
2
3
3
## 3.7.0
4
+ * ` NEW ` support ` ---@type ` and ` --[[@as]] ` for return statement
4
5
* ` FIX ` wrong hover and signature for method with varargs and overloads
5
6
* ` FIX ` [ #2224 ]
6
7
Original file line number Diff line number Diff line change @@ -1168,6 +1168,16 @@ local compilerSwitch = util.switch()
1168
1168
vm .compileCallArg (source , call )
1169
1169
end
1170
1170
1171
+ if source .parent .type == ' return' then
1172
+ local myIndex = util .arrayIndexOf (source .parent , source )
1173
+ --- @cast myIndex -?
1174
+ local parentNode = vm .selectNode (source .parent , myIndex )
1175
+ if not parentNode :isEmpty () then
1176
+ vm .setNode (source , parentNode )
1177
+ return
1178
+ end
1179
+ end
1180
+
1171
1181
if source .parent .type == ' setglobal'
1172
1182
or source .parent .type == ' local'
1173
1183
or source .parent .type == ' setlocal'
Original file line number Diff line number Diff line change @@ -197,3 +197,11 @@ local b = {
197
197
c = 3,
198
198
}
199
199
]]
200
+
201
+ TEST [[
202
+ ---@class A
203
+ ---@field x integer
204
+
205
+ ---@type A
206
+ return <!{}!>
207
+ ]]
You can’t perform that action at this time.
0 commit comments