neovim/runtime/autoload/health/nvim.vim

63 lines
1.8 KiB
VimL
Raw Normal View History

" Load the remote plugin manifest file and check for unregistered plugins
function! s:check_manifest() abort
call health#report_start('Remote Plugins')
let existing_rplugins = {}
for item in remote#host#PluginsForHost('python')
let existing_rplugins[item.path] = 'python'
endfor
for item in remote#host#PluginsForHost('python3')
let existing_rplugins[item.path] = 'python3'
endfor
let require_update = 0
for path in map(split(&runtimepath, ','), 'resolve(v:val)')
let python_glob = glob(path.'/rplugin/python*', 1, 1)
if empty(python_glob)
continue
endif
let python_dir = python_glob[0]
let python_version = fnamemodify(python_dir, ':t')
for script in glob(python_dir.'/*.py', 1, 1)
\ + glob(python_dir.'/*/__init__.py', 1, 1)
let contents = join(readfile(script))
if contents =~# '\<\%(from\|import\)\s\+neovim\>'
if script =~# '/__init__\.py$'
let script = fnamemodify(script, ':h')
endif
if !has_key(existing_rplugins, script)
let msg = printf('"%s" is not registered.', fnamemodify(path, ':t'))
if python_version ==# 'pythonx'
if !has('python2') && !has('python3')
let msg .= ' (python2 and python3 not available)'
endif
elseif !has(python_version)
let msg .= printf(' (%s not available)', python_version)
else
let require_update = 1
endif
call health#report_warn(msg)
endif
break
endif
endfor
endfor
if require_update
call health#report_warn('Out of date', ['Run `:UpdateRemotePlugins`'])
else
call health#report_ok('Up to date')
endif
endfunction
function! health#nvim#check() abort
call s:check_manifest()
endfunction