mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge #5530 from justinmk/checkhealth
CheckHealth: more checks. Also hack around an infinite loop.
This commit is contained in:
commit
e828a5a76b
@ -26,6 +26,7 @@ function! health#check(plugin_names) abort
|
|||||||
\ : s:to_fn_names(a:plugin_names)
|
\ : s:to_fn_names(a:plugin_names)
|
||||||
|
|
||||||
tabnew
|
tabnew
|
||||||
|
setlocal wrap breakindent
|
||||||
setlocal filetype=markdown bufhidden=wipe
|
setlocal filetype=markdown bufhidden=wipe
|
||||||
call s:enhance_syntax()
|
call s:enhance_syntax()
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ function! health#check(plugin_names) abort
|
|||||||
redraw|echo 'Running healthchecks...'
|
redraw|echo 'Running healthchecks...'
|
||||||
for c in healthchecks
|
for c in healthchecks
|
||||||
let output = ''
|
let output = ''
|
||||||
call append('$', split(printf("\n%s\n%s", c, repeat('=',80)), "\n"))
|
call append('$', split(printf("\n%s\n%s", c, repeat('=',72)), "\n"))
|
||||||
try
|
try
|
||||||
let output = "\n\n".execute('call '.c.'()')
|
let output = "\n\n".execute('call '.c.'()')
|
||||||
catch
|
catch
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
let s:suggest_faq = 'See https://github.com/neovim/neovim/wiki/FAQ'
|
||||||
|
|
||||||
" Load the remote plugin manifest file and check for unregistered plugins
|
" Load the remote plugin manifest file and check for unregistered plugins
|
||||||
function! s:check_manifest() abort
|
function! s:check_rplugin_manifest() abort
|
||||||
call health#report_start('Remote Plugins')
|
call health#report_start('Remote Plugins')
|
||||||
let existing_rplugins = {}
|
let existing_rplugins = {}
|
||||||
|
|
||||||
@ -57,17 +59,36 @@ function! s:check_manifest() abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:check_performance() abort
|
||||||
|
call health#report_start('Performance')
|
||||||
|
|
||||||
|
" check buildtype
|
||||||
|
let buildtype = matchstr(execute('version'), '\v\cbuild type:?\s*[^\n\r\t ]+')
|
||||||
|
if empty(buildtype)
|
||||||
|
call health#report_error('failed to get build type from :version')
|
||||||
|
elseif buildtype =~# '\v(MinSizeRel|Release|RelWithDebInfo)'
|
||||||
|
call health#report_ok(buildtype)
|
||||||
|
else
|
||||||
|
call health#report_info(buildtype)
|
||||||
|
call health#report_warn(
|
||||||
|
\ "Non-optimized build-type. Nvim will be slower.",
|
||||||
|
\ ["Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.",
|
||||||
|
\ s:suggest_faq])
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:check_tmux() abort
|
function! s:check_tmux() abort
|
||||||
if empty($TMUX) || !executable('tmux')
|
if empty($TMUX) || !executable('tmux')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call health#report_start('tmux configuration')
|
call health#report_start('tmux')
|
||||||
let suggestions = ["Set escape-time in ~/.tmux.conf: set-option -sg escape-time 10",
|
|
||||||
\ 'See https://github.com/neovim/neovim/wiki/FAQ']
|
" check escape-time
|
||||||
|
let suggestions = ["Set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10",
|
||||||
|
\ s:suggest_faq]
|
||||||
let cmd = 'tmux show-option -qvgs escape-time'
|
let cmd = 'tmux show-option -qvgs escape-time'
|
||||||
let out = system(cmd)
|
let out = system(cmd)
|
||||||
let tmux_esc_time = substitute(out, '\v(\s|\r|\n)', '', 'g')
|
let tmux_esc_time = substitute(out, '\v(\s|\r|\n)', '', 'g')
|
||||||
|
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
call health#report_error('command failed: '.cmd."\n".out)
|
call health#report_error('command failed: '.cmd."\n".out)
|
||||||
elseif empty(tmux_esc_time)
|
elseif empty(tmux_esc_time)
|
||||||
@ -76,7 +97,16 @@ function! s:check_tmux() abort
|
|||||||
call health#report_error(
|
call health#report_error(
|
||||||
\ 'escape-time ('.tmux_esc_time.') is higher than 300ms', suggestions)
|
\ 'escape-time ('.tmux_esc_time.') is higher than 300ms', suggestions)
|
||||||
else
|
else
|
||||||
call health#report_ok('escape-time = '.tmux_esc_time.'ms')
|
call health#report_ok('escape-time: '.tmux_esc_time.'ms')
|
||||||
|
endif
|
||||||
|
|
||||||
|
" check $TERM
|
||||||
|
call health#report_info('$TERM: '.$TERM)
|
||||||
|
if $TERM !~# '\v(tmux-256color|screen-256color)'
|
||||||
|
call health#report_error(
|
||||||
|
\ '$TERM should be "screen-256color" or "tmux-256color" when running tmux.',
|
||||||
|
\ ["Set default-terminal in ~/.tmux.conf:\nset-option -g default-terminal \"screen-256color\"",
|
||||||
|
\ s:suggest_faq])
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -90,7 +120,7 @@ function! s:check_terminfo() abort
|
|||||||
\ .'infocmp $TERM | sed ''s/kbs=^[hH]/kbs=\\177/'' > $TERM.ti'
|
\ .'infocmp $TERM | sed ''s/kbs=^[hH]/kbs=\\177/'' > $TERM.ti'
|
||||||
\ ."\n"
|
\ ."\n"
|
||||||
\ .'tic $TERM.ti',
|
\ .'tic $TERM.ti',
|
||||||
\ 'See https://github.com/neovim/neovim/wiki/FAQ']
|
\ s:suggest_faq]
|
||||||
let cmd = 'infocmp -L'
|
let cmd = 'infocmp -L'
|
||||||
let out = system(cmd)
|
let out = system(cmd)
|
||||||
let kbs_entry = matchstr(out, 'key_backspace=\S*')
|
let kbs_entry = matchstr(out, 'key_backspace=\S*')
|
||||||
@ -107,7 +137,8 @@ function! s:check_terminfo() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! health#nvim#check() abort
|
function! health#nvim#check() abort
|
||||||
call s:check_manifest()
|
call s:check_rplugin_manifest()
|
||||||
|
call s:check_performance()
|
||||||
call s:check_tmux()
|
call s:check_tmux()
|
||||||
call s:check_terminfo()
|
call s:check_terminfo()
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -10669,7 +10669,7 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
} else {
|
} else {
|
||||||
n = has_vim_patch(atoi(name + 5));
|
n = has_vim_patch(atoi(name + 5));
|
||||||
}
|
}
|
||||||
} else if (STRNICMP(name, "nvim", 4) == 0 && name[4] == '-') {
|
} else if (STRNICMP(name, "nvim-", 5) == 0) {
|
||||||
// Expect "nvim-x.y.z"
|
// Expect "nvim-x.y.z"
|
||||||
n = has_nvim_version(name + 5);
|
n = has_nvim_version(name + 5);
|
||||||
} else if (STRICMP(name, "vim_starting") == 0) {
|
} else if (STRICMP(name, "vim_starting") == 0) {
|
||||||
|
@ -2570,7 +2570,11 @@ static void list_features(void)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (msg_col % width) {
|
while (msg_col % width) {
|
||||||
|
int old_msg_col = msg_col;
|
||||||
msg_putchar(' ');
|
msg_putchar(' ');
|
||||||
|
if (old_msg_col == msg_col) {
|
||||||
|
break; // XXX: Avoid infinite loop.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -47,7 +47,7 @@ describe('health.vim', function()
|
|||||||
helpers.expect([[
|
helpers.expect([[
|
||||||
|
|
||||||
health#success1#check
|
health#success1#check
|
||||||
================================================================================
|
========================================================================
|
||||||
## report 1
|
## report 1
|
||||||
- SUCCESS: everything is fine
|
- SUCCESS: everything is fine
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ describe('health.vim', function()
|
|||||||
- SUCCESS: nothing to see here
|
- SUCCESS: nothing to see here
|
||||||
|
|
||||||
health#success2#check
|
health#success2#check
|
||||||
================================================================================
|
========================================================================
|
||||||
## another 1
|
## another 1
|
||||||
- SUCCESS: ok
|
- SUCCESS: ok
|
||||||
]])
|
]])
|
||||||
@ -66,7 +66,7 @@ describe('health.vim', function()
|
|||||||
helpers.expect([[
|
helpers.expect([[
|
||||||
|
|
||||||
health#broken#check
|
health#broken#check
|
||||||
================================================================================
|
========================================================================
|
||||||
- ERROR: Failed to run healthcheck for "broken" plugin. Exception:
|
- ERROR: Failed to run healthcheck for "broken" plugin. Exception:
|
||||||
caused an error
|
caused an error
|
||||||
]])
|
]])
|
||||||
@ -77,7 +77,7 @@ describe('health.vim', function()
|
|||||||
helpers.expect([[
|
helpers.expect([[
|
||||||
|
|
||||||
health#non_existent_healthcheck#check
|
health#non_existent_healthcheck#check
|
||||||
================================================================================
|
========================================================================
|
||||||
- ERROR: No healthcheck found for "non_existent_healthcheck" plugin.
|
- ERROR: No healthcheck found for "non_existent_healthcheck" plugin.
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user