diff options
-rw-r--r-- | script/core/hover/label.lua | 6 | ||||
-rw-r--r-- | test/completion/init.lua | 22 |
2 files changed, 24 insertions, 4 deletions
diff --git a/script/core/hover/label.lua b/script/core/hover/label.lua index dd309c41..2fb0b14c 100644 --- a/script/core/hover/label.lua +++ b/script/core/hover/label.lua @@ -127,10 +127,8 @@ local function asDocField(source) end end local infers = {} - for _, ext in ipairs(source.extends) do - for _, infer in ipairs(vm.getInfers(ext) or {}) do - infers[#infers+1] = infer - end + for _, infer in ipairs(vm.getInfers(source.extends) or {}) do + infers[#infers+1] = infer end if not class then return ('field ?.%s: %s'):format( diff --git a/test/completion/init.lua b/test/completion/init.lua index fc9233d8..5f79ea21 100644 --- a/test/completion/init.lua +++ b/test/completion/init.lua @@ -2093,3 +2093,25 @@ local s = f() s.$ ]] (EXISTS) + +Cared['description'] = true +TEST [[ +---@class cc +---@field aaa number +---@field bbb number + +---@type cc +local t +print(t.aa$) +]] +{ + { + label = 'aaa', + kind = define.CompletionItemKind.Field, + description = [[ +```lua +field cc.aaa: number +```]] + }, +} +Cared['description'] = nil |