summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-08-18 12:27:27 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-08-18 12:27:27 +0800
commite713e3f7f9d88ea4683b74749bed6e26fe222288 (patch)
treec86a28242e6d920ff2ddf699cdf3776600a61349
parentb1cd3d1c9335200c7fd48c3f5766ad7b8869642a (diff)
downloadlua-language-server-e713e3f7f9d88ea4683b74749bed6e26fe222288.zip
improve hover
-rw-r--r--script/core/infer.lua2
-rw-r--r--test/hover/init.lua13
2 files changed, 15 insertions, 0 deletions
diff --git a/script/core/infer.lua b/script/core/infer.lua
index 8ac585f4..d6784c67 100644
--- a/script/core/infer.lua
+++ b/script/core/infer.lua
@@ -671,6 +671,8 @@ function m.getClass(source)
infers[def[1]] = true
end
end
+ cleanInfers(infers)
+ infers['nil'] = nil
local view = m.viewInfers(infers)
if view == 'any'
or view == 'nil' then
diff --git a/test/hover/init.lua b/test/hover/init.lua
index 9dc9a9a8..62db4b6d 100644
--- a/test/hover/init.lua
+++ b/test/hover/init.lua
@@ -1679,3 +1679,16 @@ t.<?x?>()
[[
field t.x: any
]]
+
+TEST [[
+---@class A
+local a
+
+local b = nil
+b = a
+
+print(b.<?x?>)
+]]
+[[
+field A.x: any
+]]