From ddfa6a88350cd1fbf50e1b90f99d16f9ca982a39 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 13 Jul 2016 13:50:13 +0300 Subject: [PATCH] Manual: document the SyntasticCheckHook() callback. --- doc/syntastic.txt | 25 +++++++++++++++++++++++++ plugin/syntastic.vim | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 9b9674ee..431638bb 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -44,6 +44,7 @@ CONTENTS *syntastic-contents* 6.2.Editing files over network.............|syntastic-netrw| 6.3.The 'shellslash' option................|syntastic-shellslash| 6.4.Saving Vim sessions....................|syntastic-sessions| + 6.5.The location list callback.............|syntastic-loclist-callback| 7.Compatibility with other software............|syntastic-compatibility| 7.1.The csh and tcsh shells................|syntastic-csh| 7.2.Eclim..................................|syntastic-eclim| @@ -882,6 +883,7 @@ The syntax is of course identical to that of |syntastic_quiet_messages|. ------------------------------------------------------------------------------ 5.6 Debugging *syntastic-config-debug* + *syntastic-debug* Syntastic can log a trace of its working to Vim's |message-history|. To verify the command line constructed by syntastic to run a checker, set the variable @@ -958,6 +960,29 @@ remove option "blank" from 'sessionoptions': > This will prevent `:mksession` from saving |syntastic-error-window| as empty quickfix windows. +------------------------------------------------------------------------------ +6.5 The location list callback *syntastic-loclist-callback* + + *SyntasticCheckHook()* +Syntastic also gives you direct access to the list of errors. A function +named |SyntasticCheckHook()| is called by syntastic (if it exists) right +before populating the |location-list| and enabling the notifiers. The function +takes exactly one argument, the list of errors in |location-list| format (see +|getqflist()| for details). format. You can do essentially anything with this +list, as long as you don't change its format, and you don't add or remove +elements. + +For example the following function will make the error window smaller if fewer +than 10 errors are found: > + function! SyntasticCheckHook(errors) + if !empty(a:errors) + let g:syntastic_loc_list_height = min([len(a:errors), 10]) + endif + endfunction +< +(Please keep in mind however that Vim options |winheight| and |winminheight| +also affect window sizes.) + ============================================================================== 7. Compatibility with other software *syntastic-compatibility* diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b78d43e6..8076eebe 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.7.0-161' +let g:_SYNTASTIC_VERSION = '3.7.0-162' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1