mirror of
https://github.com/neovim/neovim.git
synced 2025-11-04 17:54:30 +00:00
health: Windows: Handle backslash path separators. (#5914)
* health: Handle backslash path separators. * health: brevity, consistency * health: Do not set bufhidden=wipe. In the context of CheckHealth, bufhidden=wipe loses data for no reason.
This commit is contained in:
@@ -39,7 +39,7 @@ function! health#check(plugin_names) abort
|
|||||||
|
|
||||||
tabnew
|
tabnew
|
||||||
setlocal wrap breakindent
|
setlocal wrap breakindent
|
||||||
setlocal filetype=markdown bufhidden=wipe
|
setlocal filetype=markdown
|
||||||
setlocal conceallevel=2 concealcursor=nc
|
setlocal conceallevel=2 concealcursor=nc
|
||||||
setlocal keywordprg=:help
|
setlocal keywordprg=:help
|
||||||
call s:enhance_syntax()
|
call s:enhance_syntax()
|
||||||
@@ -152,8 +152,8 @@ function! health#report_error(msg, ...) abort " {{{
|
|||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
function! s:filepath_to_function(name) abort
|
function! s:filepath_to_function(name) abort
|
||||||
return substitute(substitute(substitute(a:name, ".*autoload/", "", ""),
|
return substitute(substitute(substitute(a:name, '.*autoload[\/]', '', ''),
|
||||||
\ "\\.vim", "#check", ""), "/", "#", "g")
|
\ '\.vim', '#check', ''), '[\/]', '#', 'g')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:discover_health_checks() abort
|
function! s:discover_health_checks() abort
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function! s:check_rplugin_manifest() abort
|
|||||||
\ + glob(python_dir.'/*/__init__.py', 1, 1)
|
\ + glob(python_dir.'/*/__init__.py', 1, 1)
|
||||||
let contents = join(readfile(script))
|
let contents = join(readfile(script))
|
||||||
if contents =~# '\<\%(from\|import\)\s\+neovim\>'
|
if contents =~# '\<\%(from\|import\)\s\+neovim\>'
|
||||||
if script =~# '/__init__\.py$'
|
if script =~# '[\/]__init__\.py$'
|
||||||
let script = fnamemodify(script, ':h')
|
let script = fnamemodify(script, ':h')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ function! s:check_clipboard() abort
|
|||||||
let clipboard_tool = provider#clipboard#Executable()
|
let clipboard_tool = provider#clipboard#Executable()
|
||||||
if empty(clipboard_tool)
|
if empty(clipboard_tool)
|
||||||
call health#report_warn(
|
call health#report_warn(
|
||||||
\ "No clipboard tool found. Using the system clipboard won't work.",
|
\ "No clipboard tool found. Clipboard registers will not work.",
|
||||||
\ ['See ":help clipboard".'])
|
\ ['See ":help clipboard".'])
|
||||||
else
|
else
|
||||||
call health#report_ok('Clipboard tool found: '. clipboard_tool)
|
call health#report_ok('Clipboard tool found: '. clipboard_tool)
|
||||||
@@ -264,7 +264,7 @@ function! s:check_python(version) abort
|
|||||||
let python_bin = s:trim(s:system([pyenv, 'which', python_bin_name], '', 1))
|
let python_bin = s:trim(s:system([pyenv, 'which', python_bin_name], '', 1))
|
||||||
|
|
||||||
if empty(python_bin)
|
if empty(python_bin)
|
||||||
call health#report_warn(printf('pyenv couldn''t find %s.', python_bin_name))
|
call health#report_warn(printf('pyenv could not find %s.', python_bin_name))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -283,15 +283,15 @@ function! s:check_python(version) abort
|
|||||||
if len(python_multiple)
|
if len(python_multiple)
|
||||||
" This is worth noting since the user may install something
|
" This is worth noting since the user may install something
|
||||||
" that changes $PATH, like homebrew.
|
" that changes $PATH, like homebrew.
|
||||||
call health#report_info(printf('There are multiple %s executables found. '
|
call health#report_info(printf('Multiple %s executables found. '
|
||||||
\ . 'Set "g:%s" to avoid surprises.', python_bin_name, host_prog_var))
|
\ . 'Set `g:%s` to avoid surprises.', python_bin_name, host_prog_var))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if python_bin =~# '\<shims\>'
|
if python_bin =~# '\<shims\>'
|
||||||
call health#report_warn(printf('"%s" appears to be a pyenv shim.', python_bin), [
|
call health#report_warn(printf('`%s` appears to be a pyenv shim.', python_bin), [
|
||||||
\ 'The "pyenv" executable is not in $PATH,',
|
\ 'The `pyenv` executable is not in $PATH,',
|
||||||
\ 'Your pyenv installation is broken. You should set '
|
\ 'Your pyenv installation is broken. You should set '
|
||||||
\ . '"g:'.host_prog_var.'" to avoid surprises.',
|
\ . '`g:'.host_prog_var.'` to avoid surprises.',
|
||||||
\ ])
|
\ ])
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -302,9 +302,9 @@ function! s:check_python(version) abort
|
|||||||
if empty(venv) && !empty(pyenv) && !exists('g:'.host_prog_var)
|
if empty(venv) && !empty(pyenv) && !exists('g:'.host_prog_var)
|
||||||
\ && !empty(pyenv_root) && resolve(python_bin) !~# '^'.pyenv_root.'/'
|
\ && !empty(pyenv_root) && resolve(python_bin) !~# '^'.pyenv_root.'/'
|
||||||
call health#report_warn('pyenv is not set up optimally.', [
|
call health#report_warn('pyenv is not set up optimally.', [
|
||||||
\ printf('Suggestion: Create a virtualenv specifically '
|
\ printf('Create a virtualenv specifically '
|
||||||
\ . 'for Neovim using pyenv and use "g:%s". This will avoid '
|
\ . 'for Neovim using pyenv, and set `g:%s`. This will avoid '
|
||||||
\ . 'the need to install Neovim''s Python client in each '
|
\ . 'the need to install Neovim''s Python module in each '
|
||||||
\ . 'version/virtualenv.', host_prog_var)
|
\ . 'version/virtualenv.', host_prog_var)
|
||||||
\ ])
|
\ ])
|
||||||
elseif !empty(venv) && exists('g:'.host_prog_var)
|
elseif !empty(venv) && exists('g:'.host_prog_var)
|
||||||
@@ -316,9 +316,9 @@ function! s:check_python(version) abort
|
|||||||
|
|
||||||
if resolve(python_bin) !~# '^'.venv_root.'/'
|
if resolve(python_bin) !~# '^'.venv_root.'/'
|
||||||
call health#report_warn('Your virtualenv is not set up optimally.', [
|
call health#report_warn('Your virtualenv is not set up optimally.', [
|
||||||
\ printf('Suggestion: Create a virtualenv specifically '
|
\ printf('Create a virtualenv specifically '
|
||||||
\ . 'for Neovim and use "g:%s". This will avoid '
|
\ . 'for Neovim and use `g:%s`. This will avoid '
|
||||||
\ . 'the need to install Neovim''s Python client in each '
|
\ . 'the need to install Neovim''s Python module in each '
|
||||||
\ . 'virtualenv.', host_prog_var)
|
\ . 'virtualenv.', host_prog_var)
|
||||||
\ ])
|
\ ])
|
||||||
endif
|
endif
|
||||||
@@ -327,7 +327,7 @@ function! s:check_python(version) abort
|
|||||||
|
|
||||||
if empty(python_bin) && !empty(python_bin_name)
|
if empty(python_bin) && !empty(python_bin_name)
|
||||||
" An error message should have already printed.
|
" An error message should have already printed.
|
||||||
call health#report_error(printf('"%s" was not found.', python_bin_name))
|
call health#report_error(printf('`%s` was not found.', python_bin_name))
|
||||||
elseif !empty(python_bin) && !s:check_bin(python_bin)
|
elseif !empty(python_bin) && !s:check_bin(python_bin)
|
||||||
let python_bin = ''
|
let python_bin = ''
|
||||||
endif
|
endif
|
||||||
@@ -347,13 +347,10 @@ function! s:check_python(version) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if virtualenv_inactive
|
if virtualenv_inactive
|
||||||
let suggestions = [
|
|
||||||
\ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654/5229',
|
|
||||||
\ ]
|
|
||||||
call health#report_warn(
|
call health#report_warn(
|
||||||
\ '$VIRTUAL_ENV exists but appears to be inactive. '
|
\ '$VIRTUAL_ENV exists but appears to be inactive. '
|
||||||
\ . 'This could lead to unexpected results.',
|
\ . 'This could lead to unexpected results.',
|
||||||
\ suggestions)
|
\ [ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654/5229' ])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Diagnostic output
|
" Diagnostic output
|
||||||
@@ -367,7 +364,7 @@ function! s:check_python(version) abort
|
|||||||
if !empty(python_bin)
|
if !empty(python_bin)
|
||||||
let [pyversion, current, latest, status] = s:version_info(python_bin)
|
let [pyversion, current, latest, status] = s:version_info(python_bin)
|
||||||
if a:version != str2nr(pyversion)
|
if a:version != str2nr(pyversion)
|
||||||
call health#report_warn('Got an unexpected version of Python.' .
|
call health#report_warn('Unexpected Python version.' .
|
||||||
\ ' This could lead to confusing error messages.')
|
\ ' This could lead to confusing error messages.')
|
||||||
endif
|
endif
|
||||||
if a:version == 3 && str2float(pyversion) < 3.3
|
if a:version == 3 && str2float(pyversion) < 3.3
|
||||||
@@ -378,13 +375,9 @@ function! s:check_python(version) abort
|
|||||||
call health#report_info(printf('%s-neovim version: %s', python_bin_name, current))
|
call health#report_info(printf('%s-neovim version: %s', python_bin_name, current))
|
||||||
|
|
||||||
if s:is_bad_response(current)
|
if s:is_bad_response(current)
|
||||||
let suggestions = [
|
|
||||||
\ 'Error found was: ' . current,
|
|
||||||
\ 'Use the command `$ pip' . a:version . ' install neovim`',
|
|
||||||
\ ]
|
|
||||||
call health#report_error(
|
call health#report_error(
|
||||||
\ 'Neovim Python client is not installed.',
|
\ "Neovim Python client is not installed.\nError: ".current,
|
||||||
\ suggestions)
|
\ ['Run in shell: pip' . a:version . ' install neovim'])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if s:is_bad_response(latest)
|
if s:is_bad_response(latest)
|
||||||
@@ -408,15 +401,15 @@ function! s:check_ruby() abort
|
|||||||
|
|
||||||
if !executable('ruby') || !executable('gem')
|
if !executable('ruby') || !executable('gem')
|
||||||
call health#report_warn(
|
call health#report_warn(
|
||||||
\ "Both `ruby` and `gem` have to be in $PATH. Ruby code won't work.",
|
\ "`ruby` and `gem` must be in $PATH.",
|
||||||
\ ["Install Ruby and make sure that `ruby` and `gem` are in $PATH."])
|
\ ["Install Ruby and verify that `ruby` and `gem` commands work."])
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call health#report_info('Ruby: '. s:system('ruby -v'))
|
call health#report_info('Ruby: '. s:system('ruby -v'))
|
||||||
|
|
||||||
let host = provider#ruby#Detect()
|
let host = provider#ruby#Detect()
|
||||||
if empty(host)
|
if empty(host)
|
||||||
call health#report_warn("Missing \"neovim\" gem. Ruby code won't work.",
|
call health#report_warn('Missing "neovim" gem.',
|
||||||
\ ['Run in shell: gem install neovim'])
|
\ ['Run in shell: gem install neovim'])
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user