File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,16 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`.
9393 end
9494 end
9595 ```
96+ * ` CHG ` [ #1332 ] infer parameter type when function in table
97+ ``` lua
98+ --- @class A
99+ --- @field f fun ( x : string )
100+
101+ --- @type A
102+ local t = {
103+ f = function (x ) end -- > `x` is inferred as `string`
104+ }
105+ ```
96106* ` CHG ` find reference: respect ` includeDeclaration ` (although I don't know how to turn off this option in VSCode)
97107* ` FIX ` [ #1567 ]
98108* ` FIX ` [ #1593 ]
@@ -107,6 +117,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`.
107117[ #1153 ] : https://github.com/sumneko/lua-language-server/issues/1153
108118[ #1177 ] : https://github.com/sumneko/lua-language-server/issues/1177
109119[ #1202 ] : https://github.com/sumneko/lua-language-server/issues/1202
120+ [ #1332 ] : https://github.com/sumneko/lua-language-server/issues/1332
110121[ #1458 ] : https://github.com/sumneko/lua-language-server/issues/1458
111122[ #1557 ] : https://github.com/sumneko/lua-language-server/issues/1557
112123[ #1558 ] : https://github.com/sumneko/lua-language-server/issues/1558
Original file line number Diff line number Diff line change @@ -1108,6 +1108,12 @@ local compilerSwitch = util.switch()
11081108 end
11091109 end
11101110 end
1111+
1112+ -- { f = function (<?x?>) end }
1113+ if source .parent .type == ' tablefield'
1114+ or source .parent .type == ' tableindex' then
1115+ vm .setNode (source , vm .compileNode (source .parent ))
1116+ end
11111117 end )
11121118 : case ' paren'
11131119 : call (function (source )
Original file line number Diff line number Diff line change @@ -3866,3 +3866,13 @@ local function f()
38663866 end
38673867end
38683868]]
3869+
3870+ TEST ' string' [[
3871+ ---@class A
3872+ ---@field f fun(x: string)
3873+
3874+ ---@type A
3875+ local t = {
3876+ f = function (<?x?>) end
3877+ }
3878+ ]]
You can’t perform that action at this time.
0 commit comments