summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-01-05 16:51:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-01-05 16:51:43 +0800
commite6c9cf88693235171cf38581d8e1cf3334744a9c (patch)
treef06d6c137af43d3b29ca758dc749815d3c14ba54 /script/provider
parentc9b94234048a9608a732e85251757d02fcf19c8a (diff)
downloadlua-language-server-e6c9cf88693235171cf38581d8e1cf3334744a9c.zip
send syntax errors first
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/diagnostic.lua22
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