Commit Graph

127 Commits

Author SHA1 Message Date
Motohiro Takayama
b94510fea3 Do not check if the syntax_checker exists and is executable.
Syntax checker name should be the filename of the syntax_checkers/*.vim.
It can be any filename, and can be the name which does not exist in the PATH.
2012-05-07 12:23:51 -07:00
Martin Grenfell
5c7f2b800d Merge pull request #227 from mschulkind/master
Stop clobbering global variables
2012-04-20 07:15:30 -07:00
Matthew Schulkind
4611645c18 Stop clobbering global options. 2012-04-20 10:11:07 -04:00
Florent Bruneau
999d3c1bb3 Only keep "valid" entries in the error count.
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>
2012-03-28 19:48:54 +02:00
Martin Grenfell
3c569d2b97 pass a filetype to SyntasticLoadChecker
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.
2012-03-21 09:42:11 +00:00
Bram Schoenmakers
a6be206b71 Safely fetch the 'col' key of an error, it may not exist.
Since commit 892cc2, errors appeared on screen for example when checking
shell scripts.
2012-03-20 22:41:33 +01:00
Martin Grenfell
892cc2c232 refactor the error highlighting system
* 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.
2012-03-02 10:05:15 +00:00
Martin Grenfell
b4a7d47294 performance improvements: cache errors and warnings explicitly
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).
2012-02-18 16:01:17 +00:00
Martin Grenfell
e44494558f minor performance improvements to the statusline function 2012-02-18 15:38:42 +00:00
Martin Grenfell
9594d34003 performance improvements for FilterLocList()
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.
2012-02-18 15:36:44 +00:00
Martin Grenfell
3e80184d5f bump to v2.3.0 and update changelog and credits 2012-02-16 17:20:03 +00:00
Martin Grenfell
9a6895d28d add syntastic_loc_list_height option
This allows the user to specify what height the loc list should be
opened at. Solves  issue #153.
2012-02-10 17:56:32 +00:00
Martin Grenfell
b30a9fad9a update some comments to reflect the new subtype functionality 2012-02-08 13:31:20 +00:00
Martin Grenfell
0de450de20 simplify how the 'subtype' option is added to errors
this is just a refactor to make things simpler and shorter
2012-02-08 13:31:20 +00:00
Martin Grenfell
2b514d84bd Merge pull request #158 from technosophos/master
Support for subtypes
2012-02-07 08:31:54 -08:00
Matt Butcher
516b2eec4f Per #158: Removed SubtypeMasksType.
Because the subtype checker is never run when an error is found,
this is not necessary anymore.
2012-02-07 10:02:21 -06:00
Martin Grenfell
fa1084cf8f DRY up the code that loads checkers when multiple exist
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.
2012-02-06 17:46:08 +00:00
Matt Butcher
8df5c3bcdc Added support for error/warning subtyping. 2012-01-27 13:43:48 -06:00
Martin Grenfell
54896becd3 bump to 2.2.0 and update changelog 2011-12-24 11:31:19 +00:00
Martin Grenfell
466f762841 add a ! to a function def 2011-12-24 11:05:51 +00:00
Martin Grenfell
d88db85b07 refactor g:syntastic_check_on_open
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.
2011-12-24 09:44:01 +00:00
kongo2002
9a9da94494 evaluate g:syntastic_check_on_open without having to restart vim 2011-12-24 01:33:07 +01:00
Martin Grenfell
9633837e16 dont do syntax checks when opening buffers
Only do syntax checks when saving files. Add the g:syntax_check_on_open
option to force the check when opening.

See #134
2011-12-23 23:46:39 +00:00
Martin Grenfell
7fe7900c8b refactor s:AutoToggleLocList()
move some code out of AutoToggleLocList and into UpdateErrors so that
AutoToggleLocList is only responsible for displaying/hiding the location
list window
2011-12-23 13:56:49 +00:00
Martin Grenfell
2c6b271321 simpify s:ModeMapAllowsAutoChecking() 2011-12-22 00:10:13 +00:00
Martin Grenfell
d13264513d Revert "remove the ability to check compound filetypes"
This reverts commit fb0259a4ef.

Turns out there is a use case for this after all, as reported by
@benjifisher in #133

Conflicts:

	plugin/syntastic.vim
2011-12-21 23:52:58 +00:00
Martin Grenfell
a24bf027cc fix a bug with EchoCurrentError
due to an error in the logic, the echo window was being cleared after
every cursor movement instead of when moving the cursor off an error
2011-12-19 23:04:49 +00:00
kongo2002
ef7deb1127 fix bug in s:Errors() introduced with commit 755eddaa 2011-12-18 17:57:03 +01:00
Martin Grenfell
755eddaa06 make all loclist items errors by default
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.
2011-12-18 00:47:46 +00:00
Martin Grenfell
fb0259a4ef remove the ability to check compound filetypes
remove this for now since it is not being used and will probably never
be used
2011-12-18 00:41:44 +00:00
Martin Grenfell
7c623b7278 Revert "add Lclose() and use it when closing the loc list"
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
2011-12-17 19:16:00 +00:00
Martin Grenfell
2385a0b581 make s:FilterLocList() work on s:LocList() by default 2011-12-16 16:57:06 +00:00
Martin Grenfell
ec3ac50f76 refactor b:syntastic_loclist to s:LocList() and s:ClearLocList()
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.
2011-12-16 16:48:26 +00:00
Martin Grenfell
1e8d54d964 dont do syntax checking for any file that is non standard 2011-12-16 16:28:06 +00:00
Martin Grenfell
e90aa61ca6 add Lclose() and use it when closing the loc list
Lclose() acts as :lclose except that it checks the content of the
location list and calls :lclose if it only contains syntastic data
2011-12-16 13:36:07 +00:00
millermedeiros
d04c9766c7 BufWinLeave is always called before BufUnload, redudant. 2011-12-16 11:00:55 -02:00
millermedeiros
233f7952f1 ops, forgot to check buftype before calling lclose, avoid calling it if not needed. 2011-12-16 10:42:05 -02:00
millermedeiros
d3b122dfba fix loc list auto close. see #123
- 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.
2011-12-16 10:30:56 -02:00
millermedeiros
0d1943e6f5 auto close location list when closing or moving to another buffer. also update errors on BufEnter. see #123 2011-12-16 02:23:00 -02:00
Martin Grenfell
d053c8da1d trivial refactor 2011-12-15 23:09:17 +00:00
Martin Grenfell
bfe3725e13 make EchoCurrentError() not mask errors with warnings 2011-12-15 23:08:39 +00:00
Martin Grenfell
17f9b764de dont clobber error signs with warning signs 2011-12-15 22:52:35 +00:00
Martin Grenfell
26b45eeccf add a couple of "!"s to function defs - for consistency 2011-12-15 22:31:19 +00:00
Martin Grenfell
d85130ddf5 update errors when :SyntasticToggleMode is called
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.
2011-12-15 13:45:48 +00:00
Martin Grenfell
a210721744 change to version 2.1.0 2011-12-14 09:06:16 +00:00
Martin Grenfell
8717ff7f46 make a small refactor and add a comment 2011-12-13 23:28:39 +00:00
James Rowe
0b6587dbb6 Handle filetype names containing hyphens.
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.
2011-12-13 17:30:19 +00:00
Martin Grenfell
cafb55b3c8 fix a minor issue when echoing the current error
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.
2011-12-11 09:32:36 +00:00
Martin Grenfell
e24bd80f44 fix a strange bug when echoing error messages
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.
2011-12-11 09:26:55 +00:00
Martin Grenfell
8491df95d6 move the main autocmd into the syntastic augroup 2011-12-10 01:18:20 +00:00