Optimisation: merge handling of global and per-checker filters.
Feature: allow [] and '' values for quiet_messages filter elements.
Feature: allow overrides for quiet_messages filters.
Feature: buffer-local auto_jump and quiet_messages.
Safety: add magic specifiers to catch regexps.
Cleanup: minor restructuring for the forthcoming foreign checkers
feature.
New options: g:syntastic_quiet_messages, and a per-checker version
of it named g:syntastic_<filetype>_<checker>_quiet_messages.
Option g:syntastic_quiet_warnings is now deprecated.
Option g:syntastic_ignore_files now refers only to files that shouldn't
be checked.
New variables: g:syntastic_debug_file, the name of a file where to write
debugging messages, in addition to adding them to the message history.
The old g:syntastic_debug is now a sum of flags:
* 1 - trace checker calls
* 2 - dump loclists
* 4 - trace notifiers
* 8 - trace autocommands
* 16 - dump syntastic variables (not implemented yet)
Older versions of Vim can crash if redraw is called while a popup is
visible. This commit adds a variable g:syntastic_delayed_redraws that
instructs syntastic to move redraws to a CursorHold / CursorHoldI
handler if redraw is called while pumvisible() is true.
Normally composite types are handled by splitting them into simple
components, and applying the corresponding (simple) checkers. This
behaviour can now be disabled, by mapping composite types to a simple
ones.
This is not completely safe: if a loclist is created by something
other than syntastic before the error window is displayed, syntastic
will obliterate it. There is currently no way to tell if a
loclist was created by syntastic or not. Undocumented variable
g:syntastic_reuse_loc_lists can be used to disable reuse of loclists.
It's now possible to deal with \0 characters in checkers' output.
Shell escaping is saner and safer.
SyntasticMake() has a new option 'preprocess'.
Checkers html/validator and eruby/ruby now use the new preprocess
option. Auxilliary script validator_decode.awk is no longer needed.
List of regexps specifying files that should neither be checked, nor
included in error lists. The full paths of files are matched against
these regexps, and the matches are case sensitive.
This patch adds an option 'postprocess' to SyntasticMake(). The value
of this option is a list of names. Each name is translated to a
function syntastic#postprocess#name(). These functions are applied in
order to the list of errors just before SyntasticMake() returns. They
take a single parameter, the list of errors, and are supposed to
returned the processed list.
This is a first step towards making :lolder and :lnewer work with
Syntastic. It still has a long way to go: a new loclist is now craeted
at each run of SyntasticMake(), but the notification machinery can only
use the last one. Ideally a single loclist would be created per window
and then reused.
If the first error in the location list refers to a file that isn't
loaded, entering the quickfix window would close it.
If `hidden` is set, `:quit`-ing the main file would not close the
quickfix window.
Move the autoloc list toggling out into its own notifier class.
Move the function that echos the error on the current line out into its
own notifier.
A few other changes were required in the process:
* move s:WideMsg() out into syntastic#util autoload lib so it is
available from the cursor notifier.
* move s:ShowLocList() into the LocList class so it is available for
the autoloclist notifier
* move s:HideLocList() into Loclist as a class method mainly to keep the
two show/hide methods together
* move the s:old_line var into the Cursor notifier where it is needed
Creates a notifier class.
Changes the existing signer class to fit the new notifier.
Moves balloons and highlighting to their own classes.
Caches and speeds up EchoCurrentError().
Adds all relevant messages to balloons rather than using the first one.
Fixes yet another (minor) bug related to g:syntastic_quiet_warnings.
Fixes#543.
Use `runtime!` to source all runtime files - not just the first one
found. I actually dont know how syntastic was working at all without
this...
We dont want to set the loc list by default since syntastic isnt the
only plugin using loclists - and we dont want to clobber other peoples
loclists.
This option allows the user to override this behaviour if it suits their
workflow.
Seems that `:sign define ... texthl=bar` causes `hlexists('bar')` to
return true.
So set up the highlight groups before the signs - otherwise they will
never be set up by default.
Previously we removed the code to automatically set the loclist and only
set it when required. This was needed because otherwise we could
interfere with other plugins that use the loclist.
Add the call to setloclist back in only if syntastic_auto_jump is set.
This will blow away the loclist every time the file is checked, but
setting syntastic_auto_jump is the users choice.
Fixes#533
The variable force_highlight_callback is gone.
Highlight functions are now consistently named
SyntaxCheckers_<filetype>_<checker>_GetHighlightRegex(), and they
take precedence over highlighting based on column.
This allows users to customize the coloring of Syntastic's signs, and
also provides them a way to highlight the entire line using :sign's
linehl feature. It preserves the current default behavior of using
the error and todo highlight groups if the customized ones aren't
present. If the linehl group doesn't exist, then it's the same as not
specifying one, so no special highlighting for the line will occur.
Add CurrentFiletypes function as this logic was getting used in a couple
of places and needed a home/name - mostly because of the bizarre
substitute call that needs explanation.
Move the code to get a syntax checker by name into SyntasticRegistry
Add SyntasticLoclist class to wrap up loclists, and move loclist query
methods from syntatic.vim to the new class.
Make SyntasticChecker#getLocList() return a SyntasticLoclist.
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.
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.
init g:syntastic_check_on_open with the rest of the options - this means
we only check exists("...") once rather than every time the autocmd is
run. Plus it reads better IMO.