diff --git a/autoload/health/denops.vim b/autoload/health/denops.vim index 32751947..a193eadf 100644 --- a/autoload/health/denops.vim +++ b/autoload/health/denops.vim @@ -21,107 +21,141 @@ function! s:get_deno_version(deno) abort endfunction function! s:check_deno_executable() abort - call health#report_info(printf( + call s:report_info(printf( \ 'Deno executable: `%s` (g:denops#deno)', \ g:denops#deno, \)) if !executable(g:denops#deno) - call health#report_error(printf( + call s:report_error(printf( \ 'It seems `%s` is not executable. Please install deno and add to `$PATH`.', \ g:denops#deno, \)) if g:denops#deno !=# 'deno' && executable('deno') - call health#report_info(printf( + call s:report_info(printf( \ 'It seems `deno` is executable but `%s` is specified to g:denops#deno by user.', \ g:denops#deno, \)) endif return endif - call health#report_ok('Deno executable check: passed') + call s:report_ok('Deno executable check: passed') endfunction function! s:check_deno_version() abort let l:deno_version = s:get_deno_version(g:denops#deno) - call health#report_info(printf( + call s:report_info(printf( \ 'Supported Deno version: `%s`', \ s:deno_version, \)) - call health#report_info(printf( + call s:report_info(printf( \ 'Detected Deno version: `%s`', \ l:deno_version, \)) if empty(l:deno_version) - call health#report_error('Unable to detect version of deno, make sure your deno runtime is correct.') + call s:report_error('Unable to detect version of deno, make sure your deno runtime is correct.') return elseif s:compare_version(l:deno_version, s:deno_version) < 0 - call health#report_error(printf( + call s:report_error(printf( \ 'Unsupported Deno version is detected. You need to upgrade it to `%s` or later.', \ s:deno_version, \)) return endif - call health#report_ok('Deno version check: passed') + call s:report_ok('Deno version check: passed') endfunction function! s:check_vim_version() abort - call health#report_info(printf( + call s:report_info(printf( \ 'Supported Vim version: `%s`', \ s:vim_version, \)) - call health#report_info(printf( + call s:report_info(printf( \ 'Detected Vim version: `%s`', \ denops#_internal#meta#get().version, \)) if !has(printf('patch-%s', s:vim_version)) - call health#report_error(printf( + call s:report_error(printf( \ 'Unsupported Vim version is detected. You need to upgrade it to `%s` or later.', \ s:vim_version, \)) return endif - call health#report_ok('Vim version check: passed') + call s:report_ok('Vim version check: passed') endfunction function! s:check_neovim_version() abort - call health#report_info(printf( + call s:report_info(printf( \ 'Supported Neovim version: `%s`', \ s:neovim_version, \)) - call health#report_info(printf( + call s:report_info(printf( \ 'Detected Neovim version: `%s`', \ denops#_internal#meta#get().version, \)) if !has(printf('nvim-%s', s:neovim_version)) - call health#report_error(printf( + call s:report_error(printf( \ 'Unsupported Neovim version is detected. You need to upgrade it to `%s` or later.', \ s:neovim_version, \)) return endif - call health#report_ok('Neovim version check: passed') + call s:report_ok('Neovim version check: passed') endfunction function! s:check_denops() abort if get(g:, 'denops#debug', 0) - call health#report_warn('Denops is running with debug mode (g:denops#debug)') + call s:report_warn('Denops is running with debug mode (g:denops#debug)') endif endfunction function! s:check_denops_status() abort let l:server_status = denops#server#status() - call health#report_info(printf( + call s:report_info(printf( \ 'Denops status: `%s`', \ l:server_status, \)) if l:server_status ==# 'stopped' - call health#report_error('Denops is stopped. Execute `:message` command to find reasons.') + call s:report_error('Denops is stopped. Execute `:message` command to find reasons.') return endif - call health#report_ok('Denops status check: passed') + call s:report_ok('Denops status check: passed') endfunction +if has('nvim-0.10') + function! s:report_ok(report) abort + call v:lua.vim.health.ok(a:report) + endfunction + + function! s:report_info(report) abort + call v:lua.vim.health.info(a:report) + endfunction + + function! s:report_warn(report) abort + call v:lua.vim.health.warn(a:report) + endfunction + + function! s:report_error(report) abort + call v:lua.vim.health.error(a:report) + endfunction +else + function! s:report_ok(report) abort + call health#report_ok(a:report) + endfunction + + function! s:report_info(report) abort + call health#report_info(a:report) + endfunction + + function! s:report_warn(report) abort + call health#report_warn(a:report) + endfunction + + function! s:report_error(report) abort + call health#report_error(a:report) + endfunction +endif + function! health#denops#check() abort call s:check_deno_version() if !has('nvim')