summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorPaul Emmerich <tandanu@deadlybossmods.com>2024-04-20 17:44:21 +0200
committerPaul Emmerich <tandanu@deadlybossmods.com>2024-04-20 20:39:08 +0200
commit655ac540d6fba07b0c723fee9693bcbd2bf3b76a (patch)
treec2d43b6ab2e43af85188c5b82f21020435e13a79 /script
parentd2ea5ee3732eee30736778201a88176592a74912 (diff)
downloadlua-language-server-655ac540d6fba07b0c723fee9693bcbd2bf3b76a.zip
Output more details while running --check
Diffstat (limited to 'script')
-rw-r--r--script/cli/check.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/script/cli/check.lua b/script/cli/check.lua
index 5ac9ea13..da55b658 100644
--- a/script/cli/check.lua
+++ b/script/cli/check.lua
@@ -76,8 +76,10 @@ lclient():start(function (client)
for i, uri in ipairs(uris) do
files.open(uri)
diag.doDiagnostic(uri, true)
- if os.clock() - lastClock > 0.2 then
+ -- Print regularly but always print the last entry to ensure that logs written to files don't look incomplete.
+ if os.clock() - lastClock > 0.2 or i == #uris then
lastClock = os.clock()
+ client:update()
local output = '\x0D'
.. ('>'):rep(math.ceil(i / max * 20))
.. ('='):rep(20 - math.ceil(i / max * 20))
@@ -85,6 +87,16 @@ lclient():start(function (client)
.. ('0'):rep(#tostring(max) - #tostring(i))
.. tostring(i) .. '/' .. tostring(max)
io.write(output)
+ local filesWithErrors = 0
+ local errors = 0
+ for _, diags in pairs(results) do
+ filesWithErrors = filesWithErrors + 1
+ errors = errors + #diags
+ end
+ if errors > 0 then
+ local errorDetails = ' [' .. lang.script('CLI_CHECK_PROGRESS', errors, filesWithErrors) .. ']'
+ io.write(errorDetails)
+ end
io.flush()
end
end