Skip to content

Commit 655ac54

Browse files
committed
Output more details while running --check
1 parent d2ea5ee commit 655ac54

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

locale/en-us/script.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,8 @@ CLI_CHECK_INITING =
646646
'Initializing ...'
647647
CLI_CHECK_SUCCESS =
648648
'Diagnosis completed, no problems found'
649+
CLI_CHECK_PROGRESS =
650+
'Found {} problems in {} files'
649651
CLI_CHECK_RESULTS =
650652
'Diagnosis complete, {} problems found, see {}'
651653
CLI_DOC_INITING =

locale/pt-br/script.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,8 @@ CLI_CHECK_INITING =
646646
'Inicializando ...'
647647
CLI_CHECK_SUCCESS =
648648
'Diagnóstico completo, nenhum problema encontrado'
649+
CLI_CHECK_PROGRESS = -- TODO: need translate!
650+
'Found {} problems in {} files'
649651
CLI_CHECK_RESULTS =
650652
'Diagnóstico completo, {} problemas encontrados, veja {}'
651653
CLI_DOC_INITING = -- TODO: need translate!

locale/zh-cn/script.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,8 @@ CLI_CHECK_INITING =
646646
'正在初始化...'
647647
CLI_CHECK_SUCCESS =
648648
'诊断完成,没有发现问题'
649+
CLI_CHECK_PROGRESS = -- TODO: need translate!
650+
'Found {} problems in {} files'
649651
CLI_CHECK_RESULTS =
650652
'诊断完成,共有 {} 个问题,请查看 {}'
651653
CLI_DOC_INITING =

locale/zh-tw/script.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,8 @@ CLI_CHECK_INITING =
646646
'正在初始化...'
647647
CLI_CHECK_SUCCESS =
648648
'診斷完成,沒有發現問題'
649+
CLI_CHECK_PROGRESS = -- TODO: need translate!
650+
'Found {} problems in {} files'
649651
CLI_CHECK_RESULTS =
650652
'診斷完成,共有 {} 個問題,請查看 {}'
651653
CLI_DOC_INITING = -- TODO: need translate!

script/cli/check.lua

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,27 @@ lclient():start(function (client)
7676
for i, uri in ipairs(uris) do
7777
files.open(uri)
7878
diag.doDiagnostic(uri, true)
79-
if os.clock() - lastClock > 0.2 then
79+
-- Print regularly but always print the last entry to ensure that logs written to files don't look incomplete.
80+
if os.clock() - lastClock > 0.2 or i == #uris then
8081
lastClock = os.clock()
82+
client:update()
8183
local output = '\x0D'
8284
.. ('>'):rep(math.ceil(i / max * 20))
8385
.. ('='):rep(20 - math.ceil(i / max * 20))
8486
.. ' '
8587
.. ('0'):rep(#tostring(max) - #tostring(i))
8688
.. tostring(i) .. '/' .. tostring(max)
8789
io.write(output)
90+
local filesWithErrors = 0
91+
local errors = 0
92+
for _, diags in pairs(results) do
93+
filesWithErrors = filesWithErrors + 1
94+
errors = errors + #diags
95+
end
96+
if errors > 0 then
97+
local errorDetails = ' [' .. lang.script('CLI_CHECK_PROGRESS', errors, filesWithErrors) .. ']'
98+
io.write(errorDetails)
99+
end
88100
io.flush()
89101
end
90102
end

0 commit comments

Comments
 (0)