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.
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.
This system has been superseded by the new mode map code. If requested
in future, some code may be added to manipulate the active/passive types
in the mode map at runtime to provide the same functionality.
This option will allow users to fine tune when automatic syntax checking
is done.
The option should be set to something like:
let g:syntastic_mode_map = { 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': ['puppet'] }
g:syntastic_mode_map['mode'] can take one of 2 values - "active" or
"passive". When set to active, syntastic does automatic checking as
usual. When set to "passive" syntastic only checks when the user calls
:SyntasticCheck.
The exceptions to these rules are defined in "active_filetypes"
"passive_filetypes". In passive mode, automatic checks are still done
for all filetypes in the "active_filetypes" array. In active mode,
automatic checks are not done for any filetypes in the
"passive_filetypes" array.
I'd attempted to find something useful in the sh/csh/tcsh man pages to
get similar shell redirection that &>/>& does, but it appears that all
fds are redirected, not just stderr and stdout.
This allows a particular file type to be disabled but still be checked
when desired. Useful for syntax checks that take a few seconds like the
puppet one.
Add the syntastic_stl_format flag and doc it under
:help syntastic_stl_format. This allows the user to control what
information is displayed in the syntastic statusline flag.
g:syntastic_auto_loc now has the following possible options:
1 or "full_auto" or "fully_auto" behaves as normal, closing the loclist
when there are no errors and opening when there are errors.
2 or "semi_auto" will automatically close the loclist but _not_
automatically open it.
Previously, the location list didn't get populated unless the Errors
window was displayed. As a consequence there is no way to use :lnext
and :lprev to navigate the errors. This makes it so that the list is
populated if there are new errors/warnings.
Add these:
:SyntasticDisable [filetype]
:SyntasticEnable [filetype]
[filetype] defaults to the current filetype.
Add functions to bind the commands to.
Add g:syntastic_disabled_filetypes option to specify which filetypes
are disable by default.
this is to stop the multiple syntax checking invocations that were
occurring when &ft was being detected as compound eg ruby.sinatra. i.e.
the ft was getting set as ruby, then another autocommand was resetting
it to ruby.sinatra, causing the syntax checking to be run twice.