File tree Expand file tree Collapse file tree 5 files changed +31
-13
lines changed
Expand file tree Collapse file tree 5 files changed +31
-13
lines changed Original file line number Diff line number Diff line change 99 "stopOnEntry" : false ,
1010 "program" : " ${workspaceRoot}/test.lua" ,
1111 "luaexe" : " ${workspaceFolder}/bin/lua-language-server" ,
12- "cpath" : null ,
13- "arg" : [
14- ],
1512 "luaVersion" : " 5.4" ,
1613 "sourceCoding" : " utf8" ,
17- "console" : " internalConsole" ,
14+ "console" : " integratedTerminal" ,
15+ "internalConsoleOptions" : " openOnSessionStart" ,
1816 "outputCapture" : [
1917 " print" ,
2018 " stderr" ,
Original file line number Diff line number Diff line change 33## 3.6.22
44* ` FIX ` [ #2038 ]
55* ` FIX ` [ #2042 ]
6+ * ` FIX ` [ #2062 ]
7+ * ` FIX ` [ #2083 ]
68
7- [ #2042 ] : https://github.com/LuaLS/lua-language-server/issues/2042
89[ #2038 ] : https://github.com/LuaLS/lua-language-server/issues/2038
10+ [ #2042 ] : https://github.com/LuaLS/lua-language-server/issues/2042
11+ [ #2062 ] : https://github.com/LuaLS/lua-language-server/issues/2062
12+ [ #2083 ] : https://github.com/LuaLS/lua-language-server/issues/2083
913
1014## 3.6.21
1115` 2023-5-24 `
Original file line number Diff line number Diff line change 3232
3333--- @param funcNode vm.node
3434--- @param i integer
35+ --- @param uri uri
3536--- @return vm.node ?
36- local function getDefNode (funcNode , i )
37+ local function getDefNode (funcNode , i , uri )
3738 local defNode = vm .createNode ()
38- for f in funcNode :eachObject () do
39- if f .type == ' function'
40- or f .type == ' doc.type.function' then
41- local param = f .args and f .args [i ]
39+ for src in funcNode :eachObject () do
40+ if src .type == ' function'
41+ or src .type == ' doc.type.function' then
42+ local param = src .args and src .args [i ]
4243 if param then
4344 defNode :merge (vm .compileNode (param ))
4445 if param [1 ] == ' ...' then
4546 defNode :addOptional ()
4647 end
47-
48- expandGenerics (defNode )
4948 end
5049 end
5150 end
5251 if defNode :isEmpty () then
5352 return nil
5453 end
54+
55+ expandGenerics (defNode )
56+
5557 return defNode
5658end
5759
@@ -91,7 +93,7 @@ return function (uri, callback)
9193 if not refNode then
9294 goto CONTINUE
9395 end
94- local defNode = getDefNode (funcNode , i )
96+ local defNode = getDefNode (funcNode , i , uri )
9597 if not defNode then
9698 goto CONTINUE
9799 end
Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ function vm.bindDocs(source)
5555 vm .setNode (source , vm .compileNode (ast ))
5656 return true
5757 end
58+ if doc .type == ' doc.overload' then
59+ vm .setNode (source , vm .compileNode (doc ))
60+ end
5861 end
5962 return false
6063end
@@ -1020,6 +1023,7 @@ local function compileLocal(source)
10201023 vm .setNode (source , vm .compileNode (source .value ))
10211024 end
10221025 end
1026+
10231027 -- function x.y(self, ...) --> function x:y(...)
10241028 if source [1 ] == ' self'
10251029 and not hasMarkDoc
@@ -1031,6 +1035,7 @@ local function compileLocal(source)
10311035 vm .setNode (source , vm .compileNode (setfield .node ))
10321036 end
10331037 end
1038+
10341039 if source .parent .type == ' funcargs' and not hasMarkDoc and not hasMarkParam then
10351040 local func = source .parent .parent
10361041 -- local call ---@type fun(f: fun(x: number));call(function (x) end) --> x -> number
@@ -1055,6 +1060,7 @@ local function compileLocal(source)
10551060 vm .setNode (source , vm .declareGlobal (' type' , ' any' ))
10561061 end
10571062 end
1063+
10581064 -- for x in ... do
10591065 if source .parent .type == ' in' then
10601066 compileForVars (source .parent , source )
Original file line number Diff line number Diff line change @@ -1255,6 +1255,14 @@ local var
12551255func(var)
12561256]]
12571257
1258+ TEST [[
1259+ ---@class MyClass
1260+ ---@overload fun(x : string) : MyClass
1261+ local MyClass = {}
1262+
1263+ local w = MyClass(<!1!>)
1264+ ]]
1265+
12581266config .remove (nil , ' Lua.diagnostics.disable' , ' unused-local' )
12591267config .remove (nil , ' Lua.diagnostics.disable' , ' unused-function' )
12601268config .remove (nil , ' Lua.diagnostics.disable' , ' undefined-global' )
You can’t perform that action at this time.
0 commit comments