diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-10-25 19:56:25 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-10-25 19:56:25 +0800 |
commit | 8d88695d3897384cdee001f49b702a1a3586597b (patch) | |
tree | c42d0dee6f7762603c4d84bc65629835fdb6c8c8 /script-beta/vm/getClass.lua | |
parent | 7e6bb85af1ffccc01f7504cd427fc8123d3179d0 (diff) | |
download | lua-language-server-8d88695d3897384cdee001f49b702a1a3586597b.zip |
更新
Diffstat (limited to 'script-beta/vm/getClass.lua')
-rw-r--r-- | script-beta/vm/getClass.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/script-beta/vm/getClass.lua b/script-beta/vm/getClass.lua index 522ca026..0d6980a2 100644 --- a/script-beta/vm/getClass.lua +++ b/script-beta/vm/getClass.lua @@ -1,6 +1,18 @@ local vm = require 'vm.vm' local guide = require 'parser.guide' +local function lookUpDocClass(source) + local docs = source.bindDocs + if not docs then + return + end + for _, doc in ipairs(docs) do + if doc.type == 'doc.class' then + return guide.getName(doc) + end + end +end + local function getClass(source, classes, deep, simple) local lib = vm.getLibrary(source, simple) if lib then @@ -11,6 +23,11 @@ local function getClass(source, classes, deep, simple) end return end + local docClass = lookUpDocClass(source) + if docClass then + classes[#classes+1] = docClass + return + end if deep > 3 then return end |