summaryrefslogtreecommitdiff
path: root/script-beta/vm/getDocs.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-01 02:46:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-01 02:46:55 +0800
commita22c1b083cc0336c21a0ef5c153ecd6cd36b7d6e (patch)
treefd2c80f64cd0616571a1a8967b081b10104f4f10 /script-beta/vm/getDocs.lua
parentbb2e5b923aac06d8fa42b6df3c609f43b8b6886c (diff)
downloadlua-language-server-a22c1b083cc0336c21a0ef5c153ecd6cd36b7d6e.zip
自动完成支持 doc.type
Diffstat (limited to 'script-beta/vm/getDocs.lua')
-rw-r--r--script-beta/vm/getDocs.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/script-beta/vm/getDocs.lua b/script-beta/vm/getDocs.lua
index 2b1aead5..a89247b1 100644
--- a/script-beta/vm/getDocs.lua
+++ b/script-beta/vm/getDocs.lua
@@ -3,6 +3,30 @@ local util = require 'utility'
local guide = require 'parser.guide'
local vm = require 'vm.vm'
+local builtin = {}
+for _, name in ipairs {
+ 'any' ,
+ 'nil' ,
+ 'void' ,
+ 'boolean' ,
+ 'number' ,
+ 'integer' ,
+ 'thread' ,
+ 'table' ,
+ 'file' ,
+ 'string' ,
+ 'userdata' ,
+ 'lightuserdata',
+ 'function' ,
+} do
+ builtin[#builtin+1] = {
+ type = 'doc.class.name',
+ start = 0,
+ finish = 0,
+ [1] = name,
+ }
+end
+
local function getTypesOfFile(uri)
local types = {}
local ast = files.getAst(uri)
@@ -45,6 +69,11 @@ local function getDocTypes(name)
end
end
end
+ for _, source in ipairs(builtin) do
+ if name == '*' or name == source[1] then
+ results[#results+1] = source
+ end
+ end
return results
end