summaryrefslogtreecommitdiff
path: root/script-beta/provider/diagnostic.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-02 13:41:25 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-02 13:41:25 +0800
commit614196b67198e3e0765a25b6b9c1b0a45624855e (patch)
treefe4fcc74f01a0d95451e7fd8d0dc68e0b953dfe9 /script-beta/provider/diagnostic.lua
parent877aebdc2675986fce873272455d3530ce282907 (diff)
downloadlua-language-server-614196b67198e3e0765a25b6b9c1b0a45624855e.zip
diagnostics.workspaceDelay
Diffstat (limited to 'script-beta/provider/diagnostic.lua')
-rw-r--r--script-beta/provider/diagnostic.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/script-beta/provider/diagnostic.lua b/script-beta/provider/diagnostic.lua
index 2bca538b..0e80daf5 100644
--- a/script-beta/provider/diagnostic.lua
+++ b/script-beta/provider/diagnostic.lua
@@ -185,8 +185,6 @@ function m.refresh(uri)
return
end
await.call(function ()
- -- 一旦文件的版本发生变化,就放弃这次诊断
- await.delay()
if uri then
m.doDiagnostic(uri)
end
@@ -198,8 +196,13 @@ function m.diagnosticsAll()
if not m._start then
return
end
+ local delay = config.config.diagnostics.workspaceDelay / 1000
+ if delay < 0 then
+ return
+ end
await.close 'diagnosticsAll'
await.call(function ()
+ await.sleep(delay)
local clock = os.clock()
for uri in files.eachFile() do
await.delay()
@@ -219,6 +222,8 @@ files.watch(function (ev, uri)
m.clear(uri)
elseif ev == 'update' then
m.refresh(uri)
+ elseif ev == 'open' then
+ m.doDiagnostic(uri)
end
end)