Skip to content

Commit

Permalink
fix(health): return 0 if file not exists (#18612)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1d000e8)

Co-authored-by: noval <noval.dev@protonmail.com>
  • Loading branch information
github-actions[bot] and nxvxl committed May 17, 2022
1 parent 4afadaf commit f3ffb73
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion runtime/lua/vim/lsp/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function M.check()
local log_path = vim.lsp.get_log_path()
report_info(string.format("Log path: %s", log_path))

local log_size = vim.loop.fs_stat(log_path).size
local log_file = vim.loop.fs_stat(log_path)
local log_size = log_file and log_file.size or 0

local report_fn = (log_size / 1000000 > 100 and report_warn or report_info)
report_fn(string.format("Log size: %d KB", log_size / 1000 ))
Expand Down

0 comments on commit f3ffb73

Please sign in to comment.