|
2 | 2 | --- Support for `:checkhealth` for lean.nvim.
|
3 | 3 | ---@brief ]]
|
4 | 4 |
|
5 |
| -local health = {} |
6 |
| - |
7 |
| -local Job = require('plenary.job') |
8 | 5 | local subprocess_check_output = require('lean._util').subprocess_check_output
|
9 | 6 |
|
10 | 7 | local function check_lean_runnable()
|
11 | 8 | local lean = subprocess_check_output{ command = "lean", args = { "--version" } }
|
12 |
| - vim.health.report_ok('`lean --version`') |
13 |
| - vim.health.report_info(table.concat(lean, '\n')) |
14 |
| -end |
15 |
| - |
16 |
| -local function check_lean3ls_runnable() |
17 |
| - local succeeded, lean3ls = pcall(Job.new, Job, { |
18 |
| - command = 'lean-language-server', |
19 |
| - args = { '--stdio' }, |
20 |
| - writer = '' |
21 |
| - }) |
22 |
| - if succeeded then |
23 |
| - lean3ls:sync() |
24 |
| - vim.health.report_ok('`lean-language-server`') |
25 |
| - else |
26 |
| - vim.health.report_warn('`lean-language-server` not found, lean 3 support will not work') |
27 |
| - end |
| 9 | + vim.health.ok('`lean --version`') |
| 10 | + vim.health.info(table.concat(lean, '\n')) |
28 | 11 | end
|
29 | 12 |
|
30 | 13 | local function check_for_timers()
|
31 | 14 | if not vim.tbl_isempty(vim.fn.timer_info()) then
|
32 |
| - vim.health.report_warn( |
| 15 | + vim.health.warn( |
33 | 16 | 'You have active timers, which can degrade infoview (CursorMoved) ' ..
|
34 | 17 | 'performance. See https://github.com/Julian/lean.nvim/issues/92.'
|
35 | 18 | )
|
36 | 19 | end
|
37 | 20 | end
|
38 | 21 |
|
39 |
| ---- Check whether lean.nvim is healthy. |
40 |
| ---- |
41 |
| ---- Call me via `:checkhealth lean`. |
42 |
| -function health.check() |
43 |
| - vim.health.report_start('lean.nvim') |
44 |
| - check_lean_runnable() |
45 |
| - check_lean3ls_runnable() |
46 |
| - check_for_timers() |
47 |
| -end |
48 |
| - |
49 |
| -return health |
| 22 | +return { |
| 23 | + --- Check whether lean.nvim is healthy. |
| 24 | + --- |
| 25 | + --- Call me via `:checkhealth lean`. |
| 26 | + check = function() |
| 27 | + vim.health.start('lean.nvim') |
| 28 | + check_lean_runnable() |
| 29 | + check_for_timers() |
| 30 | + end |
| 31 | +} |
0 commit comments