Skip to content

Commit 200067b

Browse files
committed
fix #406 dont cache infer when not deep
1 parent 5c48724 commit 200067b

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

Diff for: changelog.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# changelog
22

3+
## 1.16.2
4+
* `FIX` [#406](https://github.com/sumneko/lua-language-server/issues/406)
5+
36
## 1.16.1
47
`2021-2-22`
58
* `FIX` signature: parameters may be misplaced

Diff for: script/parser/guide.lua

+5
Original file line numberDiff line numberDiff line change
@@ -2937,6 +2937,11 @@ end
29372937

29382938
function m.getRefCache(status, obj, mode)
29392939
local isDeep = status.deep
2940+
if mode == 'infer' then
2941+
if not isDeep then
2942+
return nil, nil
2943+
end
2944+
end
29402945
local globalCache = status.interface.cache and status.interface.cache() or {}
29412946
if m.isGlobal(obj) then
29422947
obj = m.getKeyName(obj)

Diff for: test/hover/init.lua

+13-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ t[any] = any
439439
]]
440440
[[
441441
local t: {
442-
[integer]: integer = 1,
442+
[number]: integer = 1,
443443
}
444444
]]
445445

@@ -1526,3 +1526,15 @@ local t: {
15261526
a: integer = 1,
15271527
}
15281528
]]
1529+
1530+
TEST [[
1531+
---@return number
1532+
local function f() end
1533+
local <?u?> = f()
1534+
print(u.x)
1535+
]]
1536+
[[
1537+
local u: number {
1538+
x: any,
1539+
}
1540+
]]

0 commit comments

Comments
 (0)