diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-01-05 16:51:43 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-01-05 16:51:43 +0800 |
commit | e6c9cf88693235171cf38581d8e1cf3334744a9c (patch) | |
tree | f06d6c137af43d3b29ca758dc749815d3c14ba54 /script/provider | |
parent | c9b94234048a9608a732e85251757d02fcf19c8a (diff) | |
download | lua-language-server-e6c9cf88693235171cf38581d8e1cf3334744a9c.zip |
send syntax errors first
Diffstat (limited to 'script/provider')
-rw-r--r-- | script/provider/diagnostic.lua | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index 30b9cd2f..031295db 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -167,16 +167,6 @@ function m.syntaxErrors(uri, ast) return results end -function m.diagnostics(uri, diags) - if not ws.isReady(uri) then - return - end - - xpcall(core, log.error, uri, function (result) - diags[#diags+1] = buildDiagnostic(uri, result) - end) -end - ---@async function m.doDiagnostic(uri, isScopeDiag) if not config.get(uri, 'Lua.diagnostics.enable') then @@ -243,7 +233,17 @@ function m.doDiagnostic(uri, isScopeDiag) end end - m.diagnostics(uri, diags) + pushResult() + + local lastPushClock = os.clock() + xpcall(core, log.error, uri, function (result) + diags[#diags+1] = buildDiagnostic(uri, result) + if not isScopeDiag and os.clock() - lastPushClock >= 0.2 then + lastPushClock = os.clock() + pushResult() + end + end) + pushResult() end |