diff options
-rw-r--r-- | script/files.lua | 1 | ||||
-rw-r--r-- | script/provider/diagnostic.lua | 12 | ||||
-rw-r--r-- | script/workspace/workspace.lua | 4 |
3 files changed, 15 insertions, 2 deletions
diff --git a/script/files.lua b/script/files.lua index 88ee466c..dc724b94 100644 --- a/script/files.lua +++ b/script/files.lua @@ -359,6 +359,7 @@ function m.getAst(uri) if not ast then ast = m.compileAst(uri, file.text) m.astMap[uri] = ast + await.delay() end file.cacheActiveTime = timer.clock() return ast diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index 75ee7711..53197d32 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -154,6 +154,10 @@ function m.diagnostics(uri, diags) return end + if not ws.isReady() then + return + end + core(uri, function (results) if #results == 0 then return @@ -372,9 +376,13 @@ files.watch(function (ev, uri) if ev == 'remove' then m.clear(uri) elseif ev == 'update' then - m.refresh(uri) + if ws.isReady() then + m.refresh(uri) + end elseif ev == 'open' then - m.doDiagnostic(uri) + if ws.isReady() then + m.doDiagnostic(uri) + end elseif ev == 'close' then if files.isLibrary(uri) or ws.isIgnored(uri) then diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 76dbd195..07a53370 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -425,6 +425,10 @@ function m.awaitReady() end end +function m.isReady() + return m.ready == true +end + files.watch(function (ev, uri) if ev == 'close' and m.isIgnored(uri) |