(1) Checkers now have an _exec attribute, and an accessor getExec().
(2) CreateAndRegisterChecker() initializes _exec from an optional argument
'exec'. If this argument is missing, 'name' is used instead.
(3) Functions SyntaxCheckers_*_IsAvailable() are now dictionary functions.
(4) Functions SyntaxCheckers_*_IsAvailable() are now optional. When
they are missing, they are assumed to return executable(expand(self.getExec())).
(5) Argument 'exe' of function syntastic#makeprg#build() is now optional.
If this argument is missing, expand(self.getExec()) is used to set checker
executables.
Make SyntaxCheckers_*_GetLocList() dictionary functions.
Pass a reference to the current checker to syntastic#makeprg#build().
Add an optional 'redirect' argument to CreateAndRegisterChecker().
Change the sh checker to use the new dictionary functions.
Add a new registry method getLocListRaw() (needed for the sh checker).
Add 2 classes: SyntasticChecker and SyntasticRegistry.
SyntasticChecker represents a checker. It holds funcrefs to the checker
func, the highlight regex func and a new `isAvailable()` func (that
essentially just checks if the checker exe is installed)
SyntasticRegistry is responsible for:
* loading checkers
* storing checkers
* fetching the checkers to use according to availability and the users
settings
Motivation/benefits:
* in the current system only one checker can be loaded per filetype
* syntax checkers cant be "chained" together
* the system is hard to add features to since fundamental concepts like
syntax checkers and location lists arent represented explicitly
Things left to do:
* add a call to g:SyntasticRegistry.CreateAndRegisterChecker() to all
checkers
* add an `isAvailable` function to all checkers
* move all checkers into `syntax_checkers/filetype/checkername.vim` -
g:SyntasticRegistry assumes this layout, and its a good idea anyway
for consistency and it makes it easier for users to add their own
checkers
Things to do after all of the above:
* add a LocationList class and move all the filtering functions onto it
* possibly add an Error class that wraps up each item in a loc list
Random notes:
* with the new system you can select the checkers to use with e.g.
`let g:syntastic_python_checkers=['flake8', 'pylint']`
This will try flake8 first, and if no errors are detected it will move
onto pylint.
Make all the easy updates. There are still quite a few to do, but in
doing these ones I can see that syntastic#makeprg#build() needs to
accept a few more options. Namely:
* "postargs" that appear after the filename
* "tail" that appears after everything - used for things like
redirecting output and piping to grep/sed/etc
* the filename itself - only the java checkers needed this since they
specify the directory of the file to check as well
There are still a few other things to do as well:
* remove the options from the checkers that are now provided by
syntastic#makeprg#build implicitly - i.e. the checker exe and args.
* also, we need to doc the above implicit checker options
* remove the public SyntasticHighlightErrors() function
* shift the above code into s:HighlightErrors(). This is called
automatically if g:syntastic_enable_highlighting is set
* to get the highlight regex we just look for a function called
Syntastic_<filetype>_GetHighlightRegex
* to force this function to be called, each error item must have the
'force_highlight_callback' key set
This code has one important functional change: now errors are *always*
highlighted if possible whereas previously they were only highlighted if
a call to SyntasticHighlightErrors was made.
The error messages that pyflakes outputs dont contain enough information
to classify them as errors or warnings. Apart from checking for all
known warning outputs and classifying the rest as errors (or vice versa)
there is no way classify.
Make the syntax checker class all results as errors. Individual warning
formats can be checked for later if they become a problem.
This addresses #189.
dont refer to g:syntastic_python_checker since - due to a previous
commit - this is not guaranteed to exist any more.
This change should have been done in the aforementioned commit - but I
failed.