fix(health): simplify health check
This commit is contained in:
parent
02019dbdef
commit
dc4326524c
7 changed files with 14 additions and 53 deletions
|
|
@ -34,20 +34,6 @@ local function check_python_env()
|
|||
end
|
||||
end
|
||||
|
||||
local function check_scrapers()
|
||||
local plugin_path = utils.get_plugin_path()
|
||||
|
||||
local scrapers = { 'atcoder.py', 'codeforces.py', 'cses.py' }
|
||||
for _, scraper in ipairs(scrapers) do
|
||||
local scraper_path = plugin_path .. '/scrapers/' .. scraper
|
||||
if vim.fn.filereadable(scraper_path) == 1 then
|
||||
vim.health.ok('Scraper found: ' .. scraper)
|
||||
else
|
||||
vim.health.error('Missing scraper: ' .. scraper)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function check_luasnip()
|
||||
local has_luasnip, luasnip = pcall(require, 'luasnip')
|
||||
if has_luasnip then
|
||||
|
|
@ -59,25 +45,6 @@ local function check_luasnip()
|
|||
end
|
||||
end
|
||||
|
||||
local function check_config()
|
||||
vim.health.ok('Plugin ready')
|
||||
|
||||
local cp = require('cp')
|
||||
local context = cp.get_current_context()
|
||||
if context.platform then
|
||||
local info = context.platform
|
||||
if context.contest_id then
|
||||
info = info .. ' ' .. context.contest_id
|
||||
if context.problem_id then
|
||||
info = info .. ' ' .. context.problem_id
|
||||
end
|
||||
end
|
||||
vim.health.info('Current context: ' .. info)
|
||||
else
|
||||
vim.health.info('No contest context set')
|
||||
end
|
||||
end
|
||||
|
||||
function M.check()
|
||||
local version = require('cp.version')
|
||||
vim.health.start('cp.nvim health check')
|
||||
|
|
@ -87,9 +54,7 @@ function M.check()
|
|||
check_nvim_version()
|
||||
check_uv()
|
||||
check_python_env()
|
||||
check_scrapers()
|
||||
check_luasnip()
|
||||
check_config()
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue