diff options
-rw-r--r-- | server/src/core/hover/hover.lua | 5 | ||||
-rw-r--r-- | server/test/hover/init.lua | 26 |
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, +} ]] |