diff options
Diffstat (limited to 'script/core/hover')
-rw-r--r-- | script/core/hover/description.lua | 7 | ||||
-rw-r--r-- | script/core/hover/label.lua | 29 |
2 files changed, 14 insertions, 22 deletions
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua index 327ddbe1..bcc3065a 100644 --- a/script/core/hover/description.lua +++ b/script/core/hover/description.lua @@ -225,13 +225,14 @@ local function getBindEnums(source, docGroup) end local function tryDocFieldUpComment(source) - if source.type ~= 'doc.field' then + if source.type ~= 'doc.field.name' then return end - if not source.bindGroup then + local docField = source.parent + if not docField.bindGroup then return end - local comment = getBindComment(source, source.bindGroup, source) + local comment = getBindComment(docField, docField.bindGroup, docField) return comment end diff --git a/script/core/hover/label.lua b/script/core/hover/label.lua index ce77dfe6..032f19c0 100644 --- a/script/core/hover/label.lua +++ b/script/core/hover/label.lua @@ -119,30 +119,21 @@ local function asField(source) return asValue(source, 'field') end -local function asDocField(source) - local name = source.field[1] +local function asDocFieldName(source) + local name = source[1] + local docField = source.parent local class - for _, doc in ipairs(source.bindGroup) do + for _, doc in ipairs(docField.bindGroup) do if doc.type == 'doc.class' then class = doc break end end - local infers = {} - for _, infer in ipairs(vm.getInfers(source.extends) or {}) do - infers[#infers+1] = infer - end + local view = infer.searchAndViewInfers(docField.extends) if not class then - return ('field ?.%s: %s'):format( - name, - searcher.viewInferType(infers) - ) - end - return ('field %s.%s: %s'):format( - class.class[1], - name, - searcher.viewInferType(infers) - ) + return ('field ?.%s: %s'):format(name, view) + end + return ('field %s.%s: %s'):format(class.class[1], name, view) end local function asString(source) @@ -211,7 +202,7 @@ return function (source, oop) return asDocFunction(source) elseif source.type == 'doc.type.name' then return asDocTypeName(source) - elseif source.type == 'doc.field' then - return asDocField(source) + elseif source.type == 'doc.field.name' then + return asDocFieldName(source) end end |