Skip to content

Commit 2e57e65

Browse files
committed
#400 fix signature behind }
1 parent 892f85f commit 2e57e65

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

Diff for: changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 1.16.1
44
* `FIX` signature: parameters may be misplaced
5+
* `FIX` [#400](https://github.com/sumneko/lua-language-server/issues/400)
56
* `FIX` runtime errors
67

78
## 1.16.0

Diff for: script/core/signature.lua

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@ local function findNearCall(uri, ast, pos)
1111
if src.type == 'call'
1212
or src.type == 'table'
1313
or src.type == 'function' then
14-
-- call()$
14+
-- call(),$
1515
if src.finish <= pos
1616
and text:sub(src.finish, src.finish) == ')' then
1717
return
1818
end
19+
-- {},$
20+
if src.finish <= pos
21+
and text:sub(src.finish, src.finish) == '}' then
22+
return
23+
end
1924
if not nearCall or nearCall.start < src.start then
2025
nearCall = src
2126
end

Diff for: test/signature/init.lua

+13
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,16 @@ function f2(c: any, d: any)
190190
]],
191191
arg = {21, 26},
192192
}
193+
194+
TEST [[
195+
local function f(a, b, c)
196+
end
197+
198+
f({},$)
199+
]]
200+
{
201+
label = [[
202+
function f(a: any, b: any, c: any)
203+
]],
204+
arg = {20, 25},
205+
}

0 commit comments

Comments
 (0)