diff options
Diffstat (limited to 'script')
-rw-r--r-- | script/core/completion.lua | 9 | ||||
-rw-r--r-- | script/parser/guide.lua | 8 |
2 files changed, 13 insertions, 4 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua index 931e97f5..25b9c901 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -1167,6 +1167,15 @@ local function getCallEnums(source, index) kind = define.CompletionItemKind.EnumMember, } end + for _, unit in ipairs(vm.getDocTypes(doc.extends)) do + if unit.type == 'doc.type.function' then + enums[#enums+1] = { + label = guide.getDocTypeUnitName(nil, unit), + description = doc.comment, + kind = define.CompletionItemKind.Function, + } + end + end return enums elseif doc.type == 'doc.vararg' and arg.type == '...' then diff --git a/script/parser/guide.lua b/script/parser/guide.lua index 022be26d..d5e6d29d 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -2941,17 +2941,17 @@ local function getDocAliasExtends(status, typeUnit) return nil end -local function getDocTypeUnitName(status, unit) +function m.getDocTypeUnitName(status, unit) local typeName if unit.type == 'doc.type.name' then typeName = unit[1] elseif unit.type == 'doc.type.function' then typeName = 'function' elseif unit.type == 'doc.type.array' then - typeName = getDocTypeUnitName(status, unit.node) .. '[]' + typeName = m.getDocTypeUnitName(status, unit.node) .. '[]' elseif unit.type == 'doc.type.generic' then typeName = ('%s<%s, %s>'):format( - getDocTypeUnitName(status, unit.node), + m.getDocTypeUnitName(status, unit.node), m.viewInferType(m.getDocTypeNames(status, unit.key)), m.viewInferType(m.getDocTypeNames(status, unit.value)) ) @@ -2975,7 +2975,7 @@ function m.getDocTypeNames(status, doc) results[#results+1] = res end else - local typeName = getDocTypeUnitName(status, unit) + local typeName = m.getDocTypeUnitName(status, unit) results[#results+1] = { type = typeName, source = unit, |