diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-13 18:09:36 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-13 18:09:36 +0800 |
commit | 3b9bde4ea1eb4a71a84dad9f62595b4360d7aa4e (patch) | |
tree | 637647129718b93ab9b7c524567fdf0d2a85acac /script/vm/getDocs.lua | |
parent | 6592c2cee8ff1649d6e303d1fb79c221021fca88 (diff) | |
download | lua-language-server-3b9bde4ea1eb4a71a84dad9f62595b4360d7aa4e.zip |
completion: support delegate
Diffstat (limited to 'script/vm/getDocs.lua')
-rw-r--r-- | script/vm/getDocs.lua | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/script/vm/getDocs.lua b/script/vm/getDocs.lua index 62e12d18..a3f9c714 100644 --- a/script/vm/getDocs.lua +++ b/script/vm/getDocs.lua @@ -74,6 +74,35 @@ function vm.getDocEnums(doc, mark, results) return results end +function vm.getDocTypeUnits(doc, mark, results) + mark = mark or {} + if mark[doc] then + return nil + end + mark[doc] = true + results = results or {} + for _, enum in ipairs(doc.enums) do + results[#results+1] = enum + end + for _, resume in ipairs(doc.resumes) do + results[#results+1] = resume + end + for _, unit in ipairs(doc.types) do + if unit.type == 'doc.type.name' then + for _, other in ipairs(vm.getDocTypes(unit[1])) do + if other.type == 'doc.alias.name' then + vm.getDocTypeUnits(other.parent.extends, mark, results) + elseif other.type == 'doc.class.name' then + results[#results+1] = other + end + end + else + results[#results+1] = unit + end + end + return results +end + function vm.getDocTypes(name) local cache = vm.getCache('getDocTypes')[name] if cache ~= nil then |