diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-09-16 11:10:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-09-16 11:10:01 +0800 |
commit | e552d7734026c34a899c7cf4aeca72e55cb3ce90 (patch) | |
tree | 8d5e80ee1a23e1df4725a8a0d0cf5a83f5e6695a /script-beta/provider/diagnostic.lua | |
parent | adec54fbd951417f8448b51c2efb2393bfd476f5 (diff) | |
download | lua-language-server-e552d7734026c34a899c7cf4aeca72e55cb3ce90.zip |
晚点再查动态修改设置的问题
Diffstat (limited to 'script-beta/provider/diagnostic.lua')
-rw-r--r-- | script-beta/provider/diagnostic.lua | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/script-beta/provider/diagnostic.lua b/script-beta/provider/diagnostic.lua index 89f97cda..7bc8022a 100644 --- a/script-beta/provider/diagnostic.lua +++ b/script-beta/provider/diagnostic.lua @@ -9,6 +9,7 @@ local util = require 'utility' local m = {} m._start = false +m._diagID = 0 m.cache = {} local function concat(t, sep) @@ -183,27 +184,26 @@ function m.refresh(uri) return files.getVersion(uri) end) await.delay() - local clock = os.clock() if uri then m.doDiagnostic(uri) end - for destUri in files.eachFile() do - if destUri ~= uri then - await.delay() - m.doDiagnostic(destUri) - end - end - local passed = os.clock() - clock - log.info(('Finish diagnostics, takes [%.3f] sec.'):format(passed)) + m.diagnosticsAll() end) end function m.diagnosticsAll() - local clock = os.clock() - for uri in files.eachFile() do - m.doDiagnostic(uri) - end - log.debug('全文诊断耗时:', os.clock() - clock) + await.create(function () + m._diagID = m._diagID + 1 + await.setDelayer(function () + return m._diagID + end) + local clock = os.clock() + for uri in files.eachFile() do + await.delay() + m.doDiagnostic(uri) + end + log.debug('全文诊断耗时:', os.clock() - clock) + end) end function m.start() |