File tree Expand file tree Collapse file tree 2 files changed +47
-8
lines changed Expand file tree Collapse file tree 2 files changed +47
-8
lines changed Original file line number Diff line number Diff line change @@ -1588,18 +1588,12 @@ end
1588
1588
local function findCall (state , position )
1589
1589
local call
1590
1590
guide .eachSourceContain (state .ast , position , function (src )
1591
- if src .type == ' call' then
1592
- if not call or call .start < src .start then
1591
+ if src .type == ' call' and src . node . finish <= position then
1592
+ if not call or call .start < src .start then
1593
1593
call = src
1594
1594
end
1595
1595
end
1596
1596
end )
1597
- if not call then
1598
- return nil
1599
- end
1600
- if call .node .finish > position then
1601
- return nil
1602
- end
1603
1597
return call
1604
1598
end
1605
1599
Original file line number Diff line number Diff line change @@ -4489,3 +4489,48 @@ local m
4489
4489
m:self(<??>):optional()
4490
4490
]]
4491
4491
(nil )
4492
+
4493
+ TEST [[
4494
+ ---@enum(key) enum
4495
+ local t = {
4496
+ a = 1,
4497
+ b = 2,
4498
+ c = 3,
4499
+ }
4500
+
4501
+ ---@class A
4502
+ local M
4503
+
4504
+ ---@return A
4505
+ function M.create()
4506
+ return M
4507
+ end
4508
+
4509
+ ---@param optional enum
4510
+ ---@return self
4511
+ function M:optional(optional)
4512
+ return self
4513
+ end
4514
+
4515
+ ---@return A
4516
+ function M:self()
4517
+ return self
4518
+ end
4519
+
4520
+
4521
+ M.create():optional(<??>):self()
4522
+ ]]
4523
+ {
4524
+ {
4525
+ label = ' "a"' ,
4526
+ kind = define .CompletionItemKind .EnumMember ,
4527
+ },
4528
+ {
4529
+ label = ' "b"' ,
4530
+ kind = define .CompletionItemKind .EnumMember ,
4531
+ },
4532
+ {
4533
+ label = ' "c"' ,
4534
+ kind = define .CompletionItemKind .EnumMember ,
4535
+ },
4536
+ }
You can’t perform that action at this time.
0 commit comments