Commit Graph

168 Commits

Author SHA1 Message Date
Martin Grenfell
531a069c1a fix syntastic_auto_jump functionality
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
2013-03-08 15:04:22 +00:00
LCD 47
ff3c05a413 Fix syntax highlighting.
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.
2013-03-08 14:45:57 +00:00
LCD 47
17641c0a49 Minor omission in commit 8f4695c. 2013-02-03 20:36:55 +02:00
Martin Grenfell
59cbf1c69e dont call setloclist() until the user calls :Errors 2013-02-01 16:52:11 +00:00
Martin Grenfell
0b0dbc56e6 dont allow checkers with duplicate names for the same filetype 2013-02-01 15:01:31 +00:00
Martin Grenfell
c97951b601 make a few refactors
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
2013-02-01 14:38:53 +00:00
Martin Grenfell
0b3e074f8c Merge remote-tracking branch 'dbarnett/cmd_arg' 2013-02-01 14:18:31 +00:00
Martin Grenfell
8f4695c6de add a class to encapsulate loclists
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.
2013-02-01 14:17:55 +00:00
Martin Grenfell
f67d4881ca remove some old (now unused) code from the main plugin 2013-02-01 09:57:25 +00:00
David Barnett
40de98c2fc Add completion for checker name in :SyntasticCheck command 2013-01-31 23:36:41 -08:00
David Barnett
557321faae Support checker name as argument to :SyntasticCheck 2013-01-31 23:20:24 -08:00
Martin Grenfell
58ba8d3161 refactor how we represent and store checkers using python as a demo
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.
2013-01-24 00:19:13 +00:00
Martin Grenfell
d48f43c222 wrap screen redrawing in a function to try and avoid screen flicker
Some versions of gvim flicker when `redraw!` is used. Use `redraw` for
them and use `redraw!` for terminal vim.

Fixes #449
2013-01-16 09:42:22 +00:00
Martin Grenfell
fc4ec2533c Merge branch 'load_any_checker' 2012-12-04 09:33:34 +00:00
Martin Grenfell
42480a01a1 modify SyntasticLoadChecker to load any checkers present
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()`
2012-12-03 21:22:44 +00:00
Martin Grenfell
7fe3ac44c2 allow custom checkers by just defining a checking function
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
2012-12-03 10:59:11 +00:00
David Barnett
b209693a2a Only set g:loaded_FT_syntax_checker if unset 2012-11-27 07:43:42 -08:00
David Barnett
dcac33ecc0 Set g:loaded_FOO_syntax_checker in syntastic.vim, not every ft file. 2012-11-26 21:44:43 -08:00
Martin Grenfell
36db8f4b16 fix a bug with highlighting and getmatches
Highlighting requires vim >= 7.1 with patch 40. It should be disabled
otherwise.

Fix a bug with the version check.

Closes #250.
2012-11-17 20:15:45 +00:00
Charles Lehner
3199ca3235 Explain why tabs are converted to spaces in error messages. 2012-10-25 20:01:31 -04:00
Charles Lehner
57e962865f Prevent tabs in error messages from causing "press enter" prompt.
Convert the tabs to spaces so that they are counted towards the window width
and the status message does not wrap.
2012-10-25 17:20:07 -04:00
Martin Grenfell
33427121ec fix a bug introduced in 60a3588d30
Two different calculations were incorrectly combined in
s:OSSupportsShellpipeHack().

Introduce s:IsRedrawRequiredAfterMake() to hold the other calculation.

Closes #388
2012-10-23 23:05:00 +01:00
Richard Brown
6382dc2124 Put getmatches check in a more sensible place 2012-10-01 15:10:53 +01:00
Richard Brown
ca1d129b3f s/HightlightErrors/HighlightErrors/g 2012-09-27 13:45:14 +01:00
Richard Brown
4bb4ec6550 Highlighting requires vim-7.1.040
Fixes Issue #250
2012-09-27 13:44:45 +01:00
Martin Grenfell
9849a6b8ac move s:uname() in with the rest of the functions - close to its usage 2012-09-24 18:53:15 +01:00
Martin Grenfell
9ccef501e9 Merge remote-tracking branch 'cehoffman/master'
Conflicts:
	plugin/syntastic.vim
2012-09-24 18:52:18 +01:00
Richard Brown
87f10e54d4 Make IsVersionAtLeast global 2012-09-22 19:51:12 +01:00
Martin Grenfell
127422c11e move SyntasticCheckable() down with the other public functions 2012-09-18 00:41:36 +01:00
Martin Grenfell
171776140b Merge remote-tracking branch 'rbrown/sh2'
Conflicts:
	syntax_checkers/sh.vim
2012-09-18 00:20:15 +01:00
Martin Grenfell
70f8354420 Merge pull request #318 from dstanek/master
Fixes issue #311
2012-09-07 02:35:15 -07:00
Richard Brown
0140f4baca Add syntax checker for ft=zsh
The current sh.vim checks for ft=sh and #!/bin/zsh  This add a checker
specifically for ft=zsh and changes sh.vim to call the same code.
2012-09-06 09:53:34 +01:00
Jamie Wong
98437c8752 Always update the location list, even if empty 2012-08-25 01:41:05 -04:00
David Stanek
2bad8761fa Fixes #311: errors not showing up in statusline
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.
2012-08-10 03:23:46 -04:00
Martin Grenfell
1fb8366456 Merge pull request #244 from mootoh/master
Javascript syntax check with Google Closure Compiler
2012-07-28 09:43:42 -07:00
Martin Grenfell
cdd36c6479 populate the location list when :Errors is called
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
2012-07-24 12:25:16 +01:00
Arnout Kazemier
5ec845ea0d Added configuration option for the symbols that are used in the signs.
This allows users to configure their own indicators symbols
2012-07-17 16:05:51 +02:00
Martin Grenfell
60a3588d30 refactor the checks for the shell/shellpipe hack compatability
move the check into its own function to DRY up the code and add an
intention revealing name to the if statements
2012-07-01 22:48:54 +01:00
Aaron Bieber
e315263ba6 Add fix for OpenBSD 2012-05-25 12:53:21 -06:00
Chris Hoffman
98b7e0e01b Delay an expensive startup cost until needed 2012-05-08 09:58:06 -05:00
Hong Xu
30d7462249 Remove some unnecessary win64 checks.
has('win32') is always true on Win64.
2012-05-08 20:31:20 +08:00
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