summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-22 20:39:13 +0800
committersumneko <sumneko@hotmail.com>2019-04-22 20:39:13 +0800
commit01143c5e09c15c4aae278a2728db753619b35530 (patch)
tree4a27a5648bb1ef7b5c9a441ea54812198944122a /server
parentc5795bf0220f0da45c7962862675edfc28ebb0f4 (diff)
downloadlua-language-server-01143c5e09c15c4aae278a2728db753619b35530.zip
EmmyClass 也要显示表的内容
Diffstat (limited to 'server')
-rw-r--r--server/src/core/hover/hover.lua5
-rw-r--r--server/test/hover/init.lua26
2 files changed, 24 insertions, 7 deletions
diff --git a/server/src/core/hover/hover.lua b/server/src/core/hover/hover.lua
index a7fcca19..058ddd4a 100644
--- a/server/src/core/hover/hover.lua
+++ b/server/src/core/hover/hover.lua
@@ -17,6 +17,11 @@ local OriginTypes = {
}
local function findClass(value)
+ -- 检查是否有emmy
+ local emmy = value:getEmmy()
+ if emmy then
+ return emmy:getType()
+ end
-- 检查对象元表
local metaValue = value:getMetaTable()
if not metaValue then
diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua
index bdd26932..79904e6c 100644
--- a/server/test/hover/init.lua
+++ b/server/test/hover/init.lua
@@ -470,7 +470,7 @@ TEST[[
local <?x?> = class()
]]
[[
-local x: *Class
+local x: *Class {}
]]
TEST[[
@@ -478,7 +478,7 @@ TEST[[
<?x?> = class()
]]
[[
-global x: *Class
+global x: *Class {}
]]
TEST[[
@@ -488,7 +488,7 @@ local t = {
}
]]
[[
-field x: *Class
+field x: *Class {}
]]
TEST[[
@@ -496,7 +496,7 @@ TEST[[
local <?x?> = class()
]]
[[
-local x: *Class
+local x: *Class {}
]]
TEST[[
@@ -504,7 +504,7 @@ TEST[[
<?x?> = class()
]]
[[
-global x: *Class
+global x: *Class {}
]]
TEST[[
@@ -514,7 +514,7 @@ local t = {
}
]]
[[
-field x: *Class
+field x: *Class {}
]]
TEST[[
@@ -522,5 +522,17 @@ TEST[[
local <?x?> = class()
]]
[[
-local x: *A|B|C
+local x: *A|B|C {}
+]]
+
+TEST[[
+---@class Class
+local <?x?> = {
+ b = 1
+}
+]]
+[[
+local x: *Class {
+ b: number = 1,
+}
]]