From 6b354194c3062afe8e5805f4352291afb4d44779 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Tue, 12 Apr 2022 14:27:41 +0800 Subject: [PATCH] feat(health): check layer health --- autoload/SpaceVim/health.vim | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/health.vim b/autoload/SpaceVim/health.vim index def739462..144e8e154 100644 --- a/autoload/SpaceVim/health.vim +++ b/autoload/SpaceVim/health.vim @@ -22,7 +22,26 @@ function! SpaceVim#health#report() abort \ ]) endtry endfor - return join(report, "\n") + return join(report + s:check_layers(), "\n") +endfunction + + +function! s:check_layers() abort + let report = [] + for layer in SpaceVim#layers#get() + try + call extend(report, [layer . ' layer health:', '']) + let result = SpaceVim#layers#{layer}#health() ? ['ok', ''] : ['failed', ''] + call extend(report,result) + catch /^Vim\%((\a\+)\)\=:E117/ + call extend(report,[ + \ '', + \ ' There is no function: SpaceVim#layers#' . layer . '#health()', + \ '', + \ ]) + endtry + endfor + return report endfunction " vim:set et sw=2: