Skip to content

Commit 3101cfb

Browse files
committed
FIX Sometimes providing incorrect autocompletion when chaining calls
1 parent f437ac3 commit 3101cfb

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
## Unreleased
44
<!-- Add all new changes here. They will be moved under a version at release -->
55

6+
## 3.9.3
7+
* `FIX` Sometimes providing incorrect autocompletion when chaining calls
8+
69
## 3.9.2
710
`2024-6-6`
811
* `NEW` Reference workspace symbols in comments using `[some text](lua://symbolName)` syntax

script/core/completion/completion.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,12 @@ local function findCall(state, position)
15941594
end
15951595
end
15961596
end)
1597+
if not call then
1598+
return nil
1599+
end
1600+
if call.node.finish > position then
1601+
return nil
1602+
end
15971603
return call
15981604
end
15991605

test/completion/common.lua

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4462,3 +4462,30 @@ new 'A' {
44624462
kind = define.CompletionItemKind.Property,
44634463
}
44644464
}
4465+
4466+
TEST [[
4467+
---@enum(key) enum
4468+
local t = {
4469+
a = 1,
4470+
b = 2,
4471+
c = 3,
4472+
}
4473+
4474+
---@class A
4475+
local M
4476+
4477+
---@param optional enum
4478+
function M:optional(optional)
4479+
end
4480+
4481+
---@return A
4482+
function M:self()
4483+
return self
4484+
end
4485+
4486+
---@type A
4487+
local m
4488+
4489+
m:self(<??>):optional()
4490+
]]
4491+
(nil)

0 commit comments

Comments
 (0)