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.
move some code out of AutoToggleLocList and into UpdateErrors so that
AutoToggleLocList is only responsible for displaying/hiding the location
list window
If a syntax checker returns items with blank 'type' keys, then make them
errors. This simplifies things since we were previously making the
assumption that empty types are errors anyway. It also fixes a bug in
EchoCurrentError() function that was due to not checking for a blank ty
pe.
This reverts commit e90aa61ca6.
The idea here was to only close the location list window if it could be
verified that it contained only syntastic data. This was done by
comparing the current location list with b:syntastic_loclist to see if
they are the same.
The problem is that, after we recheck errors, b:syntastic_loclist is
empty (if the user has fixed everything) so it doesnt match
getloclist(0) so we cant close it automatically.
Revert this for now and worry about the issue later - if a user
complains or if a new plugin that uses location lists comes up.
Conflicts:
plugin/syntastic.vim
This allows us to lazy init b:syntastic_loclist so we dont have to worry
about doing `if exists("b:syntastic_loclist")` anywhere.
Im a bit worried about doing things like
s:LocList()[0]['lnum']
since im not sure that that syntax is supported for older versions of
vim.
- changed BufLeave to BufWinLeave otherwise it would close when
jumping to loc list.
- extracted method that auto close/open location list based on
errors/settings and make sure it reopens loclist when buffer is
displayed (BufWinEnter) if needed.
Previously if we have errors displayed and we just want syntastic to
shut up, then we would use :SyntasticToggleMode but existing errors
would not be removed (ever).
So empty them out when we toggle modes.
When coming into active mode this will cause a check to be done which
will pick up errors as normal.
The gentoo vim syntax files use names like gentoo-mirrors, gentoo-metadata, etc.
This simple, and very ugly, fix makes it possible to write syntax checkers for
them.
Only clear the cmd window when it is displaying a message that we
echoed. Previously we were echoing a blank line every time the cursor
moved - this was clearing messages generated from other sources than
syntastic.
In the javascript:jshint checker the error messages are being returned
with a newline prefixed to the front. I have tried to fix this in the
errorformat - but I cant see anything that would cause it.
Im not sure if this is a one-off thing, but strip out all new lines here
just in case.
Use SyntasticWarning and SyntasticError highlight groups when calling
matchadd(). This makes it trivial to clear all of our highlights without
having to store IDs.
Stole this code from kevinw's pull request (#46)
Many of the syntax checkers were setting the 'bufnr' key for each
error manually and one was setting 'text' if it didnt exist too.
Add the 'defaults' option to SyntasticMake to set default values in the
returned error list - it only sets values if they are empty.
Move 2 functions further up syntastic.vim so that all public functions
are at the bottom - purely to be tidy.
Stick some comments on functions - most functions now have at least a
one liner explaining them.
Also, rename a variable in SyntasticHighlightErrors (since I had to look
at the log to figure out what it was).
Store error highlight IDs on a per window basis rather than per buffer.
This is needed as matchadd() adds highlights to the current window - not
buffer. This meant an error would occur when you open a file, create an
error that caused a highlight, then open the same file in a different
window - because it would call matchdelete() with an id that wasnt
defined for the current window.