Previously we were only loading "official" checkers that had been added
to syntastic. Now we load any checker that is in the right directory.
This allows anyone to add custom checkers to any filetype that uses
`SyntasticLoadChecker()`
Problem: users want to define their own checking function and not use
the syntastic defaults
Solution: dont load the syntastic default if a checking function
already exists. This way users can just define their own function and
override syntastic.
e.g. the user wants to have their own ruby checker, so in their vimrc
they just add:
function! SyntaxCheckers_ruby_GetLocList()
return SyntasticMake({"some custom stuff"})
endfunction
Two different calculations were incorrectly combined in
s:OSSupportsShellpipeHack().
Introduce s:IsRedrawRequiredAfterMake() to hold the other calculation.
Closes#388
s:Errors() function loops through the location list lookin for errors
and caches the result. The function is called indirectly by
SynasticStatuslineFlag before the location list has content. This patch
ensures s:Errors only gets called if location list has content.
The location list must be set when calling :Errors since our cached
error list is associated with the buffer, but the vim loclist is
associated with the window.
So if the user closes a window, the vim loclist will get destroyed, but
our error list will still exist.
Closes#263
Since 7.3.449 trying to :lclose inside BufWinLeave result in E855:
$ vi -u /dev/null --noplugin -N
:autocmd BufWinLeave * if empty(&bt) | lclose | endif
:lexpr(':1:msg') | lopen | wincmd p | lclose
E855: Autocommands caused command to abort
$ vi -u /dev/null --noplugin -N
:autocmd BufWinLeave * if empty(&bt) | lclose | endif
:lexpr(':1:msg') | lopen | wincmd p | q
E855: Autocommands caused command to abort
Another issue with this autocmd is &bt in BufWinLeave may be different from
the buffer being unloaded (this is documented behaviour for BufWinLeave).
Replacing &bt with getbufvar(0+expand('<abuf>'), '&bt') solve this, but
doesn't fix issue with E855 completely (first of above examples with
:lclose is fixed, but second with :q is not fixed).
So, to work around E855 I've changed way to close location-list:
instead of closing it on BufWinLeave, it's closed on BufEnter into
location-list window if it's only buffer in current window.
The location list returned by getloclist() may contain entries that are
not errorformat matches. By "definition", (see :help getqflist), matched
lines have the attribute "valid": 1 set, so only keep those lines in
error/warning list to avoid erroneous counts and strange behaviors.
Signed-off-by: Florent Bruneau <florent.bruneau@intersec.com>
This is needed to handle compound filetypes since we cant imply the
location of the syntax checker file from the filetype.
e.g. we want to load `syntax_checkers/python/pylint.vim`, but the
filetype is `python.django`. Previously this was causing `runtime
syntax_checkers/python.django/pylint.vim` to be executed.
* 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.
There are many calls to s:Errors() and s:Warnings(), and previously the
location list was filtered once for each of these calls. This made vim
unusable when handling large location lists (with hundreds of entries).
Now we cache the errors and warnings explicitly when we cache the
location list.
Rework some of the minor methods so that they call s:Errors() or
s:Warnings() (which use the cached data) instead of calling
s:FilterLocList() directly (which is expensive).
Remove the call to deepcopy() and use some alternative logic instead.
This improves performance massively for large location lists. More
aggressive caching is needed really though since this function is called
multiple times to return the same data.
Javascript and json have multiple syntax checkers that can be loaded.
Previously the logic to determine which checker to load was basically
copied and pasted in both. The `go` checker will soon have more
than one option too so remove the duplication by sticking the
common code in the core.