Skip to content

Commit 29b0c70

Browse files
committed
fix #842
1 parent 9471213 commit 29b0c70

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# changelog
22

33
## 2.5.3
4+
* `FIX` [#842](https://github.com/sumneko/lua-language-server/issues/844)
45
* `FIX` [#844](https://github.com/sumneko/lua-language-server/issues/844)
56

67
## 2.5.2

script/core/completion/completion.lua

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,20 +1354,6 @@ local function getCallEnumsAndFuncs(source, index, oop, call)
13541354
end
13551355
end
13561356
if source.type == 'doc.type.function' then
1357-
--[[
1358-
always use literal index, that is:
1359-
```
1360-
---@class Class
1361-
---@field f(x: number, y: boolean)
1362-
local c
1363-
1364-
c.f(1, true) -- correct
1365-
c:f(1, true) -- also correct
1366-
```
1367-
--]]
1368-
if oop then
1369-
index = index - 1
1370-
end
13711357
local arg = source.args[index]
13721358
if arg and arg.extends then
13731359
return pushCallEnumsAndFuncs(vm.getDefs(arg.extends))

test/completion/common.lua

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2593,7 +2593,7 @@ c:<??>
25932593

25942594
TEST [[
25952595
---@class Class
2596-
---@field on fun(x: "'aaa'"|"'bbb'")
2596+
---@field on fun(self, x: "'aaa'"|"'bbb'")
25972597
local c
25982598
25992599
c:on(<??>)
@@ -2605,7 +2605,7 @@ TEST [[
26052605
---@field on fun(x: "'aaa'"|"'bbb'")
26062606
local c
26072607
2608-
c:on('<??>')
2608+
c.on('<??>')
26092609
]]
26102610
(EXISTS)
26112611

@@ -3037,3 +3037,26 @@ end)
30373037
}
30383038
},
30393039
}
3040+
3041+
TEST [[
3042+
---@meta
3043+
3044+
---@alias testAlias
3045+
---| "'test1'"
3046+
---| "'test2'"
3047+
---| "'test3'"
3048+
3049+
---@class TestClass
3050+
local TestClass = {}
3051+
3052+
---@overload fun(self: TestClass, arg2: testAlias)
3053+
---@param arg1 integer
3054+
---@param arg2 testAlias
3055+
function TestClass:testFunc2(arg1, arg2) end
3056+
3057+
---@type TestClass
3058+
local t
3059+
3060+
t:testFunc2(<??>)
3061+
]]
3062+
(EXISTS)

0 commit comments

Comments
 (0)