summaryrefslogtreecommitdiff
path: root/server/src/service.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-20 18:02:11 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-20 18:02:11 +0800
commitd272b846c73c2f6a4709d7a51645eadccde27ea8 (patch)
tree1009117ef0125aa3ac76810101d2dd778e634c04 /server/src/service.lua
parenta86fd17a46399a118c206c9d9470c3317dd1f38d (diff)
downloadlua-language-server-d272b846c73c2f6a4709d7a51645eadccde27ea8.zip
分批require
Diffstat (limited to 'server/src/service.lua')
-rw-r--r--server/src/service.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/server/src/service.lua b/server/src/service.lua
index 445572b7..43b59d52 100644
--- a/server/src/service.lua
+++ b/server/src/service.lua
@@ -239,18 +239,32 @@ function mt:compileVM(uri)
self._needCompile[uri] = nil
local ast = parser:ast(obj.text)
- obj.vm = matcher.vm(ast, self)
+ obj.vm = matcher.vm(ast, self, uri)
obj.lines = parser:lines(obj.text, 'utf8')
if not obj.vm then
return obj
end
self._needDiagnostics[uri] = true
- self._needRequire[uri] = true
return obj
end
+function mt:getVM(uri)
+ local obj = self._file[uri]
+ if not obj then
+ return nil
+ end
+ if self._needCompile[uri] then
+ return nil
+ end
+ return obj.vm
+end
+
+function mt:needRequires(uri)
+ self._needRequire[uri] = true
+end
+
function mt:_loadRequires()
if not self.workspace then
return