summaryrefslogtreecommitdiff
path: root/test/completion/common.lua
diff options
context:
space:
mode:
authorCrollie Rollz <crollierollz@gmail.com>2022-04-03 01:45:58 +0800
committerCrollie Rollz <crollierollz@gmail.com>2022-04-03 02:50:52 +0800
commitaf68d1e84435b1fbbf30ef24658255206f1ff7b3 (patch)
tree53077c8b7944a102cfe283f4072e372188e44b9e /test/completion/common.lua
parent499cd3acfe00bc38899d1bab2ed1b39dd11e14f6 (diff)
downloadlua-language-server-af68d1e84435b1fbbf30ef24658255206f1ff7b3.zip
fix(completion): OOP emitter should have `self` arg
3db634a3a2e48a97772065e7e9da4d29a07a8098 Align docFUnc with the call index, rather than assume it's always the 2nd arg (where "self" is concerned this is the 3rd arg)
Diffstat (limited to 'test/completion/common.lua')
-rw-r--r--test/completion/common.lua22
1 files changed, 19 insertions, 3 deletions
diff --git a/test/completion/common.lua b/test/completion/common.lua
index 787549f7..22d9f554 100644
--- a/test/completion/common.lua
+++ b/test/completion/common.lua
@@ -2640,9 +2640,9 @@ class2:<??>
TEST [[
--- @class Emit
---- @field on fun(eventName: string, cb: function)
---- @field on fun(eventName: '"died"', cb: fun(i: integer))
---- @field on fun(eventName: '"won"', cb: fun(s: string))
+--- @field on fun(self: Emit, eventName: string, cb: function)
+--- @field on fun(self: Emit, eventName: '"died"', cb: fun(i: integer))
+--- @field on fun(self: Emit, eventName: '"won"', cb: fun(s: string))
local emit = {}
emit:on('<??>')
@@ -2656,6 +2656,22 @@ TEST [[
--- @field on fun(eventName: '"won"', cb: fun(s: string))
local emit = {}
+emit.on('died', <??>)
+]]
+{
+ [1] = {
+ label = 'fun(i: integer)',
+ kind = define.CompletionItemKind.Function,
+ }
+}
+
+TEST [[
+--- @class Emit
+--- @field on fun(self: Emit, eventName: string, cb: function)
+--- @field on fun(self: Emit, eventName: '"died"', cb: fun(i: integer))
+--- @field on fun(self: Emit, eventName: '"won"', cb: fun(s: string))
+local emit = {}
+
emit:on('won', <??>)
]]
{