aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/autoload/health/provider.vim56
-rwxr-xr-xscripts/vim-patch.sh2
-rw-r--r--src/nvim/api/private/helpers.c5
3 files changed, 38 insertions, 25 deletions
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index bc6b2c074c..57dd508f96 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -221,20 +221,26 @@ endfunction
function! s:check_python(version) abort
call health#report_start('Python ' . a:version . ' provider')
- let python_bin_name = 'python'.(a:version == 2 ? '' : '3')
+ let pyname = 'python'.(a:version == 2 ? '' : '3')
let pyenv = resolve(exepath('pyenv'))
let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : 'n'
let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : ''
- let host_prog_var = python_bin_name.'_host_prog'
+ let host_prog_var = pyname.'_host_prog'
+ let loaded_var = 'g:loaded_'.pyname.'_provider'
let python_bin = ''
let python_multiple = []
+ if exists(loaded_var) && !exists('*provider#'.pyname.'#Call')
+ call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
+ return
+ endif
+
if exists('g:'.host_prog_var)
call health#report_info(printf('Using: g:%s = "%s"', host_prog_var, get(g:, host_prog_var)))
endif
- let [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version)
- if empty(python_bin_name)
+ let [pyname, pythonx_errs] = provider#pythonx#Detect(a:version)
+ if empty(pyname)
call health#report_warn('No Python interpreter was found with the neovim '
\ . 'module. Using the first available for diagnostics.')
if !empty(pythonx_errs)
@@ -242,21 +248,21 @@ function! s:check_python(version) abort
endif
endif
- if !empty(python_bin_name)
+ if !empty(pyname)
if exists('g:'.host_prog_var)
- let python_bin = exepath(python_bin_name)
+ let python_bin = exepath(pyname)
endif
- let python_bin_name = fnamemodify(python_bin_name, ':t')
+ let pyname = fnamemodify(pyname, ':t')
endif
if !empty(pythonx_errs)
call health#report_error('Python provider error', pythonx_errs)
endif
- if !empty(python_bin_name) && empty(python_bin) && empty(pythonx_errs)
+ if !empty(pyname) && empty(python_bin) && empty(pythonx_errs)
if !exists('g:'.host_prog_var)
call health#report_info(printf('`g:%s` is not set. Searching for '
- \ . '%s in the environment.', host_prog_var, python_bin_name))
+ \ . '%s in the environment.', host_prog_var, pyname))
endif
if !empty(pyenv)
@@ -269,19 +275,19 @@ function! s:check_python(version) abort
call health#report_ok(printf('pyenv found: "%s"', pyenv))
endif
- let python_bin = s:trim(s:system([pyenv, 'which', python_bin_name], '', 1))
+ let python_bin = s:trim(s:system([pyenv, 'which', pyname], '', 1))
if empty(python_bin)
- call health#report_warn(printf('pyenv could not find %s.', python_bin_name))
+ call health#report_warn(printf('pyenv could not find %s.', pyname))
endif
endif
if empty(python_bin)
- let python_bin = exepath(python_bin_name)
+ let python_bin = exepath(pyname)
if exists('$PATH')
for path in split($PATH, has('win32') ? ';' : ':')
- let path_bin = path.'/'.python_bin_name
+ let path_bin = path.'/'.pyname
if path_bin != python_bin && index(python_multiple, path_bin) == -1
\ && executable(path_bin)
call add(python_multiple, path_bin)
@@ -292,7 +298,7 @@ function! s:check_python(version) abort
" This is worth noting since the user may install something
" that changes $PATH, like homebrew.
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.', pyname, host_prog_var))
endif
if python_bin =~# '\<shims\>'
@@ -333,9 +339,9 @@ function! s:check_python(version) abort
endif
endif
- if empty(python_bin) && !empty(python_bin_name)
+ if empty(python_bin) && !empty(pyname)
" 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.', pyname))
elseif !empty(python_bin) && !s:check_bin(python_bin)
let python_bin = ''
endif
@@ -349,7 +355,7 @@ function! s:check_python(version) abort
if $VIRTUAL_ENV != pyenv_prefix
let virtualenv_inactive = 1
endif
- elseif !empty(python_bin_name) && exepath(python_bin_name) !~# '^'.$VIRTUAL_ENV.'/'
+ elseif !empty(pyname) && exepath(pyname) !~# '^'.$VIRTUAL_ENV.'/'
let virtualenv_inactive = 1
endif
endif
@@ -381,9 +387,9 @@ function! s:check_python(version) abort
call health#report_info('Python'.a:version.' version: ' . pyversion)
if s:is_bad_response(status)
- call health#report_info(printf('%s-neovim version: %s (%s)', python_bin_name, current, status))
+ call health#report_info(printf('%s-neovim version: %s (%s)', pyname, current, status))
else
- call health#report_info(printf('%s-neovim version: %s', python_bin_name, current))
+ call health#report_info(printf('%s-neovim version: %s', pyname, current))
endif
if s:is_bad_response(current)
@@ -397,10 +403,10 @@ function! s:check_python(version) abort
call health#report_error('HTTP request failed: '.latest)
elseif s:is_bad_response(status)
call health#report_warn(printf('Latest %s-neovim is NOT installed: %s',
- \ python_bin_name, latest))
+ \ pyname, latest))
elseif !s:is_bad_response(current)
call health#report_ok(printf('Latest %s-neovim is installed: %s',
- \ python_bin_name, latest))
+ \ pyname, latest))
endif
endif
@@ -409,6 +415,12 @@ endfunction
function! s:check_ruby() abort
call health#report_start('Ruby provider')
+ let loaded_var = 'g:loaded_ruby_provider'
+ if exists(loaded_var) && !exists('*provider#ruby#Call')
+ call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
+ return
+ endif
+
if !executable('ruby') || !executable('gem')
call health#report_warn(
\ "`ruby` and `gem` must be in $PATH.",
@@ -451,7 +463,7 @@ function! s:check_ruby() abort
\ current_gem, latest_gem),
\ ['Run in shell: gem update neovim'])
else
- call health#report_ok('Gem "neovim" is up-to-date: '. current_gem)
+ call health#report_ok('Latest "neovim" gem is installed: '. current_gem)
endif
endfunction
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh
index ad0317aa4b..75915372a3 100755
--- a/scripts/vim-patch.sh
+++ b/scripts/vim-patch.sh
@@ -136,7 +136,7 @@ preprocess_patch() {
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%('${na_src}'\)@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Remove channel.txt, netbeans.txt, os_*.txt, todo.txt, version*.txt, tags
- local na_doc='channel\.txt\|netbeans\.txt\|os_\w\+\.txt\|todo\.txt\|version\d\.txt\|tags'
+ local na_doc='channel\.txt\|netbeans\.txt\|os_\w\+\.txt\|todo\.txt\|version\d\.txt\|tags$'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/\%('${na_doc}'\)@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Remove some testdir/Make_*.mak files
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 6f3f654bdc..ba4d005e9a 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -380,7 +380,7 @@ static inline void typval_encode_list_start(EncodedData *const edata,
kv_push(edata->stack, ARRAY_OBJ(((Array) {
.capacity = len,
.size = 0,
- .items = xmalloc(len * sizeof(*((Object *)NULL)->data.array.items)),
+ .items = xmalloc(len * sizeof(*((Object)OBJECT_INIT).data.array.items)),
})));
}
@@ -422,7 +422,8 @@ static inline void typval_encode_dict_start(EncodedData *const edata,
kv_push(edata->stack, DICTIONARY_OBJ(((Dictionary) {
.capacity = len,
.size = 0,
- .items = xmalloc(len * sizeof(*((Object *)NULL)->data.dictionary.items)),
+ .items = xmalloc(len * sizeof(
+ *((Object)OBJECT_INIT).data.dictionary.items)),
})));
}