Update docs to describe the new checker infrastructure.

This commit is contained in:
LCD 47 2013-11-11 10:54:35 +02:00
parent a5b5fb784e
commit c245568e57

View File

@ -54,9 +54,9 @@ syntax checker plugins are defined on a per-filetype basis where each one wraps
up an external syntax checking program. The core script delegates off to these up an external syntax checking program. The core script delegates off to these
plugins and uses their output to provide the syntastic functionality. plugins and uses their output to provide the syntastic functionality.
Take a look in the syntax_checkers directory for a list of supported filetypes Take a look at the wiki for a list of supported filetypes and checkers:
and checkers.
https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
============================================================================== ==============================================================================
2. Functionality provided *syntastic-functionality* 2. Functionality provided *syntastic-functionality*
@ -85,9 +85,9 @@ To use the statusline flag, this must appear in your |'statusline'| setting >
%{SyntasticStatuslineFlag()} %{SyntasticStatuslineFlag()}
< <
Something like this could be more useful: > Something like this could be more useful: >
set statusline+=%#warningmsg# set statusline += %#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()} set statusline += %{SyntasticStatuslineFlag()}
set statusline+=%* set statusline += %*
< <
When syntax errors are detected a flag will be shown. The content of the flag When syntax errors are detected a flag will be shown. The content of the flag
is derived from the |syntastic_stl_format| option is derived from the |syntastic_stl_format| option
@ -170,7 +170,7 @@ Resets the list of errors and turns off all error notifiers.
Default: 0 Default: 0
If enabled, syntastic will do syntax checks when buffers are first loaded as If enabled, syntastic will do syntax checks when buffers are first loaded as
well as on saving > well as on saving >
let g:syntastic_check_on_open=1 let g:syntastic_check_on_open = 1
< <
*'syntastic_check_on_wq'* *'syntastic_check_on_wq'*
@ -178,7 +178,7 @@ Default: 1
Normally syntastic runs syntax checks whenever buffers are written to disk. Normally syntastic runs syntax checks whenever buffers are written to disk.
If you want to skip these checks when you issue |:wq|, |:x|, and |:ZZ|, set this If you want to skip these checks when you issue |:wq|, |:x|, and |:ZZ|, set this
variable to 0. > variable to 0. >
let g:syntastic_check_on_wq=0 let g:syntastic_check_on_wq = 0
< <
*'syntastic_aggregate_errors'* *'syntastic_aggregate_errors'*
@ -187,7 +187,7 @@ When enabled, |:SyntasticCheck| runs all checkers that apply, then aggregates
errors found by all checkers and displays them. When disabled, errors found by all checkers and displays them. When disabled,
|:SyntasticCheck| runs each checker in turn, and stops to display the results |:SyntasticCheck| runs each checker in turn, and stops to display the results
the first time a checker finds any errors. > the first time a checker finds any errors. >
let g:syntastic_aggregate_errors=1 let g:syntastic_aggregate_errors = 1
< <
*'syntastic_id_checkers'* *'syntastic_id_checkers'*
@ -197,21 +197,21 @@ When results from multiple checkers are aggregated in a single error list
a file with a composite filetype), it might not be immediately obvious which a file with a composite filetype), it might not be immediately obvious which
checker has produced a given error message. This variable instructs syntastic checker has produced a given error message. This variable instructs syntastic
to label error messages with the names of the checkers that created them. > to label error messages with the names of the checkers that created them. >
let g:syntastic_id_checkers=0 let g:syntastic_id_checkers = 0
< <
*'syntastic_echo_current_error'* *'syntastic_echo_current_error'*
Default: 1 Default: 1
If enabled, syntastic will echo the error associated with the current line to If enabled, syntastic will echo the error associated with the current line to
the command window. If multiple errors are found, the first will be used. > the command window. If multiple errors are found, the first will be used. >
let g:syntastic_echo_current_error=1 let g:syntastic_echo_current_error = 1
< <
*'syntastic_enable_signs'* *'syntastic_enable_signs'*
Default: 1 Default: 1
Use this option to tell syntastic whether to use the |:sign| interface to mark Use this option to tell syntastic whether to use the |:sign| interface to mark
syntax errors: > syntax errors: >
let g:syntastic_enable_signs=1 let g:syntastic_enable_signs = 1
< <
*'syntastic_error_symbol'* *'syntastic_style_error_symbol'* *'syntastic_error_symbol'* *'syntastic_style_error_symbol'*
@ -224,8 +224,8 @@ error symobls can be customized:
syntastic_style_warning_symbol - For style warnings, defaults to 'S>' syntastic_style_warning_symbol - For style warnings, defaults to 'S>'
Example: > Example: >
let g:syntastic_error_symbol='✗' let g:syntastic_error_symbol = '✗'
let g:syntastic_warning_symbol='⚠' let g:syntastic_warning_symbol = '⚠'
< <
*'syntastic_enable_balloons'* *'syntastic_enable_balloons'*
@ -247,13 +247,13 @@ errors (where possible). Highlighting can be turned off with the following >
Default: 0 Default: 0
Enable this option to tell syntastic to always stick any detected errors into Enable this option to tell syntastic to always stick any detected errors into
the loclist: > the loclist: >
let g:syntastic_always_populate_loc_list=1 let g:syntastic_always_populate_loc_list = 1
< <
*'syntastic_auto_jump'* *'syntastic_auto_jump'*
Default: 0 Default: 0
Enable this option if you want the cursor to jump to the first detected error Enable this option if you want the cursor to jump to the first detected error
when saving or opening a file: > when saving or opening a file: >
let g:syntastic_auto_jump=1 let g:syntastic_auto_jump = 1
< <
*'syntastic_auto_loc_list'* *'syntastic_auto_loc_list'*
@ -262,23 +262,23 @@ Use this option to tell syntastic to automatically open and/or close the
|location-list| (see |syntastic-error-window|). |location-list| (see |syntastic-error-window|).
When set to 0 the error window will not be opened or closed automatically. > When set to 0 the error window will not be opened or closed automatically. >
let g:syntastic_auto_loc_list=0 let g:syntastic_auto_loc_list = 0
< <
When set to 1 the error window will be automatically opened when errors are When set to 1 the error window will be automatically opened when errors are
detected, and closed when none are detected. > detected, and closed when none are detected. >
let g:syntastic_auto_loc_list=1 let g:syntastic_auto_loc_list = 1
< <
When set to 2 the error window will be automatically closed when no errors are When set to 2 the error window will be automatically closed when no errors are
detected, but not opened automatically. > detected, but not opened automatically. >
let g:syntastic_auto_loc_list=2 let g:syntastic_auto_loc_list = 2
< <
*'syntastic_loc_list_height'* *'syntastic_loc_list_height'*
Default: 10 Default: 10
Use this option to specify the height of the location lists that syntastic Use this option to specify the height of the location lists that syntastic
opens. > opens. >
let g:syntastic_loc_list_height=5 let g:syntastic_loc_list_height = 5
< <
*'syntastic_ignore_files'* *'syntastic_ignore_files'*
@ -288,7 +288,7 @@ include in error lists. It has to be a list of |regular-expression| patterns.
The full paths of files (see |::p|) are matched against these patterns, and The full paths of files (see |::p|) are matched against these patterns, and
the matches are case sensitive. Use |\c| if you need case insensitive the matches are case sensitive. Use |\c| if you need case insensitive
patterns. > patterns. >
let g:syntastic_ignore_files=['^/usr/include/', '\c\.h$'] let g:syntastic_ignore_files = ['^/usr/include/', '\c\.h$']
< <
*'syntastic_filetype_map'* *'syntastic_filetype_map'*
@ -347,7 +347,7 @@ this option has the following effects:
there's at least one error, whereupon both errors and warnings are there's at least one error, whereupon both errors and warnings are
displayed displayed
> >
let g:syntastic_quiet_warnings=1 let g:syntastic_quiet_warnings = 1
< <
*'syntastic_stl_format'* *'syntastic_stl_format'*
@ -433,7 +433,7 @@ native python checker.
Some filetypes, like PHP, have style checkers as well as syntax checkers. These Some filetypes, like PHP, have style checkers as well as syntax checkers. These
can be chained together like this: > can be chained together like this: >
let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd']` let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd']
< <
This is telling syntastic to run the 'php' checker first, and if no errors are This is telling syntastic to run the 'php' checker first, and if no errors are
found, run 'phpcs', and then 'phpmd'. found, run 'phpcs', and then 'phpmd'.
@ -441,41 +441,42 @@ found, run 'phpcs', and then 'phpmd'.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
5.2 Configuring specific checkers *syntastic-config-makeprg* 5.2 Configuring specific checkers *syntastic-config-makeprg*
Most checkers use the 'syntastic#makeprg#build()' function and provide many Most checkers use the 'makeprgBuild()' function and provide many options by
options by default - in fact you can customise every part of the command default - in fact you can customise every part of the command that gets called.
that gets called.
Checkers that use 'syntastic#makeprg#build()' look like this: > Checkers that use 'makeprgBuild()' construct a 'makeprg' like this: >
let makeprg = syntastic#makeprg#build({ let makeprg = self.makeprgBuild({
\ 'exe': 'ruby', \ 'exe': self.getExec(),
\ 'args': '-a -b -c', \ 'args': '-a -b -c',
\ 'post_args': '--more --args', \ 'post_args': '--more --args',
\ 'tail': '> /tmp/output', \ 'tail': '> /tmp/output' })
\ 'checker': self })
< <
The 'checker' argument is mandatory. All other arguments above are optional, The result is a 'makeprg' of the form: >
and can be overriden by setting global variables - even parameters not <exe> <args> <filename> <post_args> <tail>
specified in the call to syntastic#makeprg#build(). If 'exe' is the same as <
the name of the checker, it may be omitted.
All arguments above are optional, and can be overriden by setting global
variables - even parameters not specified in the call to makeprgBuild(). If
'exe' is the same as the checker 'exec' attribute, it may be omitted.
E.g. To override the checker exe above, you could do this: > E.g. To override the checker exe above, you could do this: >
let g:syntastic_ruby_mri_exe="another_ruby_checker_exe.rb" let g:syntastic_ruby_mri_exe = "another_ruby_checker_exe.rb"
< <
To override the args and the tail: > To override the args and the tail: >
let g:syntastic_ruby_mri_args="--my --args --here" let g:syntastic_ruby_mri_args = "--my --args --here"
let g:syntastic_ruby_mri_tail="> /tmp/my-output-file-biatch" let g:syntastic_ruby_mri_tail = "> /tmp/my-output-file-biatch"
< <
The general form of the override options is: > The general form of the override options is: >
syntastic_[filetype]_[subchecker]_[option-name] syntastic_<filetype>_<subchecker>_<option-name>
< <
For checkers that do not use the 'syntastic#makeprg#build()' function you For checkers that do not use the 'makeprgBuild()' function you will have to
will have to look at the source code of the checker in question. If there are look at the source code of the checker in question. If there are specific
specific options that can be set, these are usually documented in the wiki: options that can be set, these are usually documented in the wiki:
https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
============================================================================== ==============================================================================
6. Notes *syntastic-notes* 6. Notes *syntastic-notes*
@ -523,7 +524,7 @@ The core maintainers of syntastic are:
Gregor Uhlenheuer (github: kongo2002) Gregor Uhlenheuer (github: kongo2002)
LCD 047 (github: lcd047) LCD 047 (github: lcd047)
Find the latest version of syntastic here: Find the latest version of syntastic at:
http://github.com/scrooloose/syntastic http://github.com/scrooloose/syntastic