summaryrefslogtreecommitdiff
path: root/script-beta/vm/getClass.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-25 19:56:25 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-25 19:56:25 +0800
commit8d88695d3897384cdee001f49b702a1a3586597b (patch)
treec42d0dee6f7762603c4d84bc65629835fdb6c8c8 /script-beta/vm/getClass.lua
parent7e6bb85af1ffccc01f7504cd427fc8123d3179d0 (diff)
downloadlua-language-server-8d88695d3897384cdee001f49b702a1a3586597b.zip
更新
Diffstat (limited to 'script-beta/vm/getClass.lua')
-rw-r--r--script-beta/vm/getClass.lua17
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