diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-02-11 05:50:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-11 05:50:49 +0800 |
commit | 851252f79ddaaca5456b287342cd36130c76ff38 (patch) | |
tree | 37773bdbc48c3f43ae950e6447f455cd08a74d71 /runtime | |
parent | 38bf52821a2f647f310641bcb82b2d09ba27c2b1 (diff) | |
parent | 300b009f47bc617faa1c445966e2085c455e0c45 (diff) | |
download | rneovim-851252f79ddaaca5456b287342cd36130c76ff38.tar.gz rneovim-851252f79ddaaca5456b287342cd36130c76ff38.tar.bz2 rneovim-851252f79ddaaca5456b287342cd36130c76ff38.zip |
Merge pull request #17012 from EdmundsEcho/fix-checkhealth
prevent checkhealth failure when plugin's check returns void
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/autoload/health.vim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim index 1d462ad02c..ec030adf04 100644 --- a/runtime/autoload/health.vim +++ b/runtime/autoload/health.vim @@ -21,10 +21,17 @@ function! health#check(plugin_names) abort throw 'healthcheck_not_found' endif eval type == 'v' ? call(func, []) : luaeval(func) + " in the event the healthcheck doesn't return anything + " (the plugin author should avoid this possibility) + if len(s:output) == 0 + throw 'healthcheck_no_return_value' + endif catch let s:output = [] " Clear the output if v:exception =~# 'healthcheck_not_found' call health#report_error('No healthcheck found for "'.name.'" plugin.') + elseif v:exception =~# 'healthcheck_no_return_value' + call health#report_error('The healthcheck report for "'.name.'" plugin is empty.') else call health#report_error(printf( \ "Failed to run healthcheck for \"%s\" plugin. Exception:\n%s\n%s", @@ -127,7 +134,7 @@ endfunction " }}} " From a path return a list [{name}, {func}, {type}] representing a healthcheck function! s:filepath_to_healthcheck(path) abort - if a:path =~# 'vim$' + if a:path =~# 'vim$' let name = matchstr(a:path, '\zs[^\/]*\ze\.vim$') let func = 'health#'.name.'#check' let type = 'v' |