summaryrefslogtreecommitdiff
path: root/script/vm/global.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-15 18:51:23 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-15 18:51:23 +0800
commita93effc7b08c95e1c9f3f852648e09a28e685d05 (patch)
tree9d27071e6d07b5f545aed6215afbee275fc3ef09 /script/vm/global.lua
parent4cdfc4db435a41ef82455d51931aa31927f7883d (diff)
downloadlua-language-server-a93effc7b08c95e1c9f3f852648e09a28e685d05.zip
fix #1208 get state after ready
Diffstat (limited to 'script/vm/global.lua')
-rw-r--r--script/vm/global.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/script/vm/global.lua b/script/vm/global.lua
index 81791d14..d9fba535 100644
--- a/script/vm/global.lua
+++ b/script/vm/global.lua
@@ -2,6 +2,7 @@ local util = require 'utility'
local scope = require 'workspace.scope'
local guide = require 'parser.guide'
local files = require 'files'
+local ws = require 'workspace'
---@class vm
local vm = require 'vm.vm'
@@ -530,9 +531,11 @@ for uri in files.eachFile() do
end
end
+---@async
files.watch(function (ev, uri)
if ev == 'update' then
dropUri(uri)
+ ws.awaitReady(uri)
local state = files.getState(uri)
if state then
compileAst(state.ast)