diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-09-04 22:57:19 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-09-05 19:22:01 -0400 |
commit | 3c24704ac85e8f8e337d9a4a887ffccf744501b9 (patch) | |
tree | 0ca5411bbb12c3438c466e698702b6aa5dca62ea /runtime/autoload | |
parent | 31257b450b6d9cb434a69f158c8c3cdb5924307c (diff) | |
download | rneovim-3c24704ac85e8f8e337d9a4a887ffccf744501b9.tar.gz rneovim-3c24704ac85e8f8e337d9a4a887ffccf744501b9.tar.bz2 rneovim-3c24704ac85e8f8e337d9a4a887ffccf744501b9.zip |
health.vim: Show results incrementally.
Also:
- improve precision of "No healthcheck found"
- fix SUGGESTIONS syntax group definition
- fix indentation of SUGGESTIONS
Diffstat (limited to 'runtime/autoload')
-rw-r--r-- | runtime/autoload/health.vim | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim index 6ba9405e0a..4ef09c2f2f 100644 --- a/runtime/autoload/health.vim +++ b/runtime/autoload/health.vim @@ -11,47 +11,50 @@ function! s:enhance_syntax() abort syntax keyword healthSuccess SUCCESS highlight link healthSuccess Function - syntax keyword healthSuggestion SUGGESTION + syntax keyword healthSuggestion SUGGESTIONS highlight link healthSuggestion String endfunction " Runs the specified healthchecks. " Runs all discovered healthchecks if a:plugin_names is empty. function! health#check(plugin_names) abort - let report = '' - let healthchecks = empty(a:plugin_names) \ ? s:discover_health_checks() \ : s:to_fn_names(a:plugin_names) if empty(healthchecks) - let report = "ERROR: No healthchecks found." + call setline(1, 'ERROR: No healthchecks found.') else + tabnew + setlocal filetype=markdown bufhidden=wipe + call s:enhance_syntax() + + redraw|echo 'Running healthchecks...' for c in healthchecks - let report .= printf("\n%s\n%s", c, repeat('=',80)) + let output = '' + call append('$', split(printf("\n%s\n%s", c, repeat('=',80)), "\n")) try - let report .= execute('call '.c.'()') - catch /^Vim\%((\a\+)\)\=:E117/ - let report .= execute( - \ 'call health#report_error(''No healthcheck found for "' - \ .s:to_plugin_name(c) - \ .'" plugin.'')') + let output = "\n\n".execute('call '.c.'()') catch - let report .= execute( - \ 'call health#report_error(''Failed to run healthcheck for "' - \ .s:to_plugin_name(c) - \ .'" plugin. Exception:''."\n".v:exception)') + if v:exception =~# '^Vim\%((\a\+)\)\=:E117.*\V'.c + let output = execute( + \ 'call health#report_error(''No healthcheck found for "' + \ .s:to_plugin_name(c) + \ .'" plugin.'')') + else + let output = execute( + \ 'call health#report_error(''Failed to run healthcheck for "' + \ .s:to_plugin_name(c) + \ .'" plugin. Exception:''."\n".v:exception)') + endif endtry - let report .= "\n" + call append('$', split(output, "\n") + ['']) + redraw endfor endif - tabnew - setlocal bufhidden=wipe - set filetype=markdown - call s:enhance_syntax() - call setline(1, split(report, "\n")) setlocal nomodified + redraw|echo '' endfunction " Starts a new report. @@ -86,10 +89,10 @@ function! s:format_report_message(status, msg, ...) abort " {{{ " Report each suggestion if len(suggestions) > 0 - let output .= "\n - SUGGESTIONS:" + let output .= "\n - SUGGESTIONS:" endif for suggestion in suggestions - let output .= "\n - " . s:indent_after_line1(suggestion, 10) + let output .= "\n - " . s:indent_after_line1(suggestion, 10) endfor return output |