diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-02-23 18:10:22 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-02-23 18:10:22 +0800 |
commit | e3a0eea7fc75807037a24b630241bf62a0fe1299 (patch) | |
tree | 546f7267134521f00aab030b8f395bd6c8d915b7 /script/vm/manager.lua | |
parent | 608aebdc13ebd64ae81d81049e7bbb3cc13cb891 (diff) | |
download | lua-language-server-e3a0eea7fc75807037a24b630241bf62a0fe1299.zip |
cleanup
Diffstat (limited to 'script/vm/manager.lua')
-rw-r--r-- | script/vm/manager.lua | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/script/vm/manager.lua b/script/vm/manager.lua new file mode 100644 index 00000000..b80cfb43 --- /dev/null +++ b/script/vm/manager.lua @@ -0,0 +1,29 @@ + +local files = require 'files' +local globalManager = require 'vm.global-manager' +local literalManager = require 'vm.literal-manager' + +---@class vm.state +local m = {} +for uri in files.eachFile() do + local state = files.getState(uri) + if state then + globalManager.compileAst(state.ast) + end +end + +files.watch(function (ev, uri) + if ev == 'update' then + local state = files.getState(uri) + if state then + globalManager.compileAst(state.ast) + end + end + if ev == 'remove' then + globalManager.dropUri(uri) + literalManager.dropUri(uri) + end +end) + + +return m |