Updated plugins
This commit is contained in:
parent
fe77d23852
commit
a304deea56
94 changed files with 5065 additions and 393 deletions
|
@ -87,7 +87,9 @@ A. Stick this in your vimrc
|
|||
|
||||
__Q. How can I map a specific key or shortcut to open NERDTree?__
|
||||
|
||||
A. Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want): `map <C-n> :NERDTreeToggle<CR>`
|
||||
A. Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want):
|
||||
|
||||
`map <C-n> :NERDTreeToggle<CR>`
|
||||
|
||||
__Q. How can I close vim if the only window left open is a NERDTree?__
|
||||
|
||||
|
|
|
@ -652,25 +652,15 @@ endfunction
|
|||
"Return: the string for this path that is suitable to be used with the :edit
|
||||
"command
|
||||
function! s:Path._strForEdit()
|
||||
let p = escape(self.str({'format': 'UI'}), self._escChars())
|
||||
let cwd = getcwd() . s:Path.Slash()
|
||||
let p = escape(self.str(), self._escChars())
|
||||
|
||||
"return a relative path if we can
|
||||
let isRelative = 0
|
||||
if nerdtree#runningWindows()
|
||||
let isRelative = stridx(tolower(p), tolower(cwd)) == 0
|
||||
else
|
||||
let isRelative = stridx(p, cwd) == 0
|
||||
endif
|
||||
"make it relative
|
||||
let p = fnamemodify(p, ':.')
|
||||
|
||||
if isRelative
|
||||
let p = strpart(p, strlen(cwd))
|
||||
|
||||
"handle the edge case where the file begins with a + (vim interprets
|
||||
"the +foo in `:e +foo` as an option to :edit)
|
||||
if p[0] == "+"
|
||||
let p = '\' . p
|
||||
endif
|
||||
"handle the edge case where the file begins with a + (vim interprets
|
||||
"the +foo in `:e +foo` as an option to :edit)
|
||||
if p[0] == "+"
|
||||
let p = '\' . p
|
||||
endif
|
||||
|
||||
if p ==# ''
|
||||
|
|
|
@ -24,7 +24,7 @@ call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callbac
|
|||
call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
|
||||
call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
|
||||
|
||||
if has("gui_mac") || has("gui_macvim")
|
||||
if has("gui_mac") || has("gui_macvim")
|
||||
call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
|
||||
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
|
||||
call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
|
||||
|
@ -86,10 +86,11 @@ function! s:promptToRenameBuffer(bufnum, msg, newFileName)
|
|||
" 1. ensure that a new buffer is loaded
|
||||
exec "badd " . quotedFileName
|
||||
" 2. ensure that all windows which display the just deleted filename
|
||||
" display a buffer for a new filename.
|
||||
" display a buffer for a new filename.
|
||||
let s:originalTabNumber = tabpagenr()
|
||||
let s:originalWindowNumber = winnr()
|
||||
exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec \":e! " . quotedFileName . "\" | endif"
|
||||
let editStr = g:NERDTreePath.New(a:newFileName).str({'format': 'Edit'})
|
||||
exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':e! " . editStr . "' | endif"
|
||||
exec "tabnext " . s:originalTabNumber
|
||||
exec s:originalWindowNumber . "wincmd w"
|
||||
" 3. We don't need a previous buffer anymore
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
|
||||
## 1\. Introduction
|
||||
|
||||
Syntastic is a syntax checking plugin for Vim that runs files through external
|
||||
syntax checkers and displays any resulting errors to the user. This can be done
|
||||
on demand, or automatically as files are saved. If syntax errors are detected,
|
||||
the user is notified and is happy because they didn't have to compile their
|
||||
code or execute their script to find them.
|
||||
Syntastic is a syntax checking plugin for [Vim][13] that runs files through
|
||||
external syntax checkers and displays any resulting errors to the user. This
|
||||
can be done on demand, or automatically as files are saved. If syntax errors
|
||||
are detected, the user is notified and is happy because they didn't have to
|
||||
compile their code or execute their script to find them.
|
||||
|
||||
At the time of this writing, syntax checking plugins exist for ActionScript,
|
||||
Ada, AppleScript, Arduino, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C,
|
||||
|
@ -64,16 +64,40 @@ enabled.
|
|||
|
||||
## 2\. Installation
|
||||
|
||||
Installing syntastic is easy but first you need to have the [pathogen][1]
|
||||
plugin installed. If you already have [pathogen][1] working then skip
|
||||
[Step 1](#step1) and go to [Step 2](#step2).
|
||||
<a name="requirements"></a>
|
||||
|
||||
### 2.1\. Requirements
|
||||
|
||||
Syntastic itself has rather relaxed requirements: it doesn't have any external
|
||||
dependencies, and it needs a version of [Vim][13] compiled with a few common
|
||||
features: `autocmd`, `eval`, `file_in_path`, `modify_fname`, `quickfix`,
|
||||
`reltime`, and `user_commands`. Not all possible combinations of features that
|
||||
include the ones above make equal sense on all operating systems, but Vim
|
||||
version 7 or later with the "normal", "big", or "huge" feature sets should be
|
||||
fine.
|
||||
|
||||
Syntastic should work with any modern plugin managers for Vim, such as
|
||||
[NeoBundle][14], [Pathogen][1], [Vim-Addon-Manager][15], [Vim-Plug][16], or
|
||||
[Vundle][17]. Instructions for installing syntastic with [Pathogen][1] are
|
||||
included below for completeness.
|
||||
|
||||
Last but not least: syntastic doesn't know how to do any syntax checks by
|
||||
itself. In order to get meaningful results you need to install external
|
||||
checkers corresponding to the types of files you use. Please consult the
|
||||
[wiki][3] for a list of supported checkers.
|
||||
|
||||
<a name="installpathogen"></a>
|
||||
|
||||
### 2.2\. Installing syntastic with Pathogen
|
||||
|
||||
If you already have [Pathogen][1] working then skip [Step 1](#step1) and go to
|
||||
[Step 2](#step2).
|
||||
|
||||
<a name="step1"></a>
|
||||
|
||||
### 2.1\. Step 1: Install pathogen.vim
|
||||
#### 2.2.1\. Step 1: Install pathogen.vim
|
||||
|
||||
First I'll show you how to install Tim Pope's [pathogen][1] so that it's easy to
|
||||
First I'll show you how to install Tim Pope's [Pathogen][1] so that it's easy to
|
||||
install syntastic. Do this in your terminal so that you get the `pathogen.vim`
|
||||
file and the directories it needs:
|
||||
```sh
|
||||
|
@ -87,7 +111,7 @@ execute pathogen#infect()
|
|||
|
||||
<a name="step2"></a>
|
||||
|
||||
### 2.2\. Step 2: Install syntastic as a pathogen bundle
|
||||
#### 2.2.2\. Step 2: Install syntastic as a Pathogen bundle
|
||||
|
||||
You now have pathogen installed and can put syntastic into `~/.vim/bundle` like
|
||||
this:
|
||||
|
@ -100,7 +124,8 @@ Quit vim and start it back up to reload it, then type:
|
|||
:Helptags
|
||||
```
|
||||
If you get an error when you do this, then you probably didn't install
|
||||
[pathogen][1] right. Go back to [Step 1](#step1) and make sure you did the following:
|
||||
[Pathogen][1] right. Go back to [Step 1](#step1) and make sure you did the
|
||||
following:
|
||||
|
||||
1. Created both the `~/.vim/autoload` and `~/.vim/bundle` directories.
|
||||
2. Added the `call pathogen#infect()` line to your `~/.vimrc` file
|
||||
|
@ -328,6 +353,11 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
|
|||
[10]: http://perldoc.perl.org/perlrun.html#*-c*
|
||||
[11]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
|
||||
[12]: https://github.com/rust-lang/rust/
|
||||
[13]: http://www.vim.org/
|
||||
[14]: https://github.com/Shougo/neobundle.vim
|
||||
[15]: https://github.com/MarcWeber/vim-addon-manager
|
||||
[16]: https://github.com/junegunn/vim-plug/
|
||||
[17]: https://github.com/gmarik/Vundle.vim
|
||||
|
||||
<!--
|
||||
vim:tw=79:sw=4:
|
||||
|
|
|
@ -120,7 +120,7 @@ function! syntastic#log#debugDump(level) " {{{2
|
|||
return
|
||||
endif
|
||||
|
||||
call syntastic#log#debugShowVariables( a:level, sort(keys(g:syntastic_defaults)) )
|
||||
call syntastic#log#debugShowVariables( a:level, sort(keys(g:_SYNTASTIC_DEFAULTS)) )
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
@ -155,7 +155,7 @@ function! s:_logRedirect(on) " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! s:_logTimestamp() " {{{2
|
||||
return 'syntastic: ' . split(reltimestr(reltime(g:syntastic_start)))[0] . ': '
|
||||
return 'syntastic: ' . split(reltimestr(reltime(g:_SYNTASTIC_START)))[0] . ': '
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_formatVariable(name) " {{{2
|
||||
|
|
|
@ -76,6 +76,56 @@ function! syntastic#preprocess#perl(errors) " {{{2
|
|||
return syntastic#util#unique(out)
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#prospector(errors) " {{{2
|
||||
" JSON artifacts
|
||||
let true = 1
|
||||
let false = 0
|
||||
let null = ''
|
||||
|
||||
" A hat tip to Marc Weber for this trick
|
||||
" http://stackoverflow.com/questions/17751186/iterating-over-a-string-in-vimscript-or-parse-a-json-file/19105763#19105763
|
||||
try
|
||||
let errs = eval(join(a:errors, ''))
|
||||
catch
|
||||
let errs = {}
|
||||
endtry
|
||||
|
||||
let out = []
|
||||
if type(errs) == type({}) && has_key(errs, 'messages') && type(errs['messages']) == type([])
|
||||
for e in errs['messages']
|
||||
if type(e) == type({})
|
||||
try
|
||||
if e['source'] ==# 'pylint'
|
||||
let e['location']['character'] += 1
|
||||
endif
|
||||
|
||||
let msg =
|
||||
\ e['location']['path'] . ':' .
|
||||
\ e['location']['line'] . ':' .
|
||||
\ e['location']['character'] . ': ' .
|
||||
\ e['code'] . ' ' .
|
||||
\ e['message'] . ' ' .
|
||||
\ '[' . e['source'] . ']'
|
||||
|
||||
call add(out, msg)
|
||||
catch /\m^Vim\%((\a\+)\)\=:E716/
|
||||
call syntastic#log#warn('checker python/prospector: unknown error format')
|
||||
let out = []
|
||||
break
|
||||
endtry
|
||||
else
|
||||
call syntastic#log#warn('checker python/prospector: unknown error format')
|
||||
let out = []
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
call syntastic#log#warn('checker python/prospector: unknown error format')
|
||||
endif
|
||||
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#rparse(errors) " {{{2
|
||||
let errlist = copy(a:errors)
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ endfunction " }}}2
|
|||
|
||||
function! syntastic#util#dictFilter(errors, filter) " {{{2
|
||||
let rules = s:_translateFilter(a:filter)
|
||||
" call syntastic#log#debug(g:SyntasticDebugFilters, "applying filter:", rules)
|
||||
" call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, "applying filter:", rules)
|
||||
try
|
||||
call filter(a:errors, rules)
|
||||
catch /\m^Vim\%((\a\+)\)\=:E/
|
||||
|
@ -287,7 +287,7 @@ endfunction " }}}2
|
|||
" (hopefully high resolution) since program start
|
||||
" TODO: This assumes reltime() returns a list of integers.
|
||||
function! syntastic#util#stamp() " {{{2
|
||||
return reltime(g:syntastic_start)
|
||||
return reltime(g:_SYNTASTIC_START)
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
|
|
@ -34,6 +34,7 @@ CONTENTS *syntastic-contents*
|
|||
5.1.Choosing which checkers to use.........|syntastic-filetype-checkers|
|
||||
5.2.Choosing the executable................|syntastic-config-exec|
|
||||
5.3.Configuring specific checkers..........|syntastic-config-makeprg|
|
||||
5.4.Sorting errors.........................|syntastic-config-sort|
|
||||
6.Notes........................................|syntastic-notes|
|
||||
6.1.Handling of composite filetypes........|syntastic-composite|
|
||||
6.2.Editing files over network.............|syntastic-netrw|
|
||||
|
@ -44,6 +45,7 @@ CONTENTS *syntastic-contents*
|
|||
6.7.Using syntastic with the fizsh shell...|syntastic-fizsh|
|
||||
6.8.Interaction with Eclim.................|syntastic-eclim|
|
||||
6.9.Interaction with vim-virtualenv........|syntastic-vim-virtualenv|
|
||||
6.10.Interaction with vim-auto-save........|syntastic-vim-auto-save|
|
||||
7.About........................................|syntastic-about|
|
||||
8.License......................................|syntastic-license|
|
||||
|
||||
|
@ -207,7 +209,8 @@ disable generation of these labels by turning off '|syntastic_id_checkers|'.
|
|||
If |'syntastic_sort_aggregated_errors'| is set (which is the default), messages
|
||||
in the aggregated list are grouped by file, then sorted by line number, then
|
||||
type, then column number. Otherwise messages produced by the same checker are
|
||||
grouped together.
|
||||
grouped together, and sorting within each group is decided by the variables
|
||||
|'syntastic_<filetype>_<checker>_sort'|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.6 Filtering errors *syntastic-filtering-errors*
|
||||
|
@ -687,6 +690,25 @@ Example: >
|
|||
<
|
||||
See |syntastic_quiet_messages| for the syntax.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
5.4 Sorting errors *syntastic-config-sort*
|
||||
|
||||
*'syntastic_<filetype>_<checker>_sort'*
|
||||
Syntastic may decide to group the errors produced by some checkers by file,
|
||||
then sort them by line number, then by type, then by column number. If you'd
|
||||
prefer to see the errors in the order in which they are output by the external
|
||||
checker you can set the variable |'g:syntastic_<filetype>_<checker>_sort'| to 0.
|
||||
|
||||
Alternatively, if syntastic doesn't reorder the errors produced by a checker
|
||||
but you'd like it to sort them, you can set the same variable to 1.
|
||||
|
||||
There is also a local version |'b:syntastic_<filetype>_<checker>_sort'| of
|
||||
this variable, that takes precedence over it in the buffers where it is
|
||||
defined.
|
||||
|
||||
For aggregated lists (see |syntastic-aggregating-errors|) these variables are
|
||||
ignored if |syntastic_sort_aggregated_errors| is set (which is the default).
|
||||
|
||||
==============================================================================
|
||||
6. Notes *syntastic-notes*
|
||||
|
||||
|
@ -724,7 +746,7 @@ for python in syntastic (see |syntastic_mode_map|), or disable lint checks in
|
|||
|
||||
Syntastic can be used together with the 'YouCompleteMe' Vim plugin (see
|
||||
http://valloric.github.io/YouCompleteMe/). However, by default 'YouCompleteMe'
|
||||
disables syntastic"s checkers for the "c", "cpp", "objc", and "objcpp"
|
||||
disables syntastic's checkers for the "c", "cpp", "objc", and "objcpp"
|
||||
filetypes, in order to allow its own checkers to run. If you want to use YCM's
|
||||
identifier completer but still run syntastic's checkers for those filetypes you
|
||||
have to set |ycm_show_diagnostics_ui| to 0. E.g.: >
|
||||
|
@ -766,11 +788,15 @@ interactive features of 'fizsh'. Using a more traditional shell such as "zsh",
|
|||
------------------------------------------------------------------------------
|
||||
6.8. Interaction with Eclim *syntastic-eclim*
|
||||
|
||||
As far as syntastic is concerned there shouldn't be any compatibility problems
|
||||
with the 'Eclim' Vim plugin (see http://eclim.org/). However, at the time of
|
||||
this writing there are several reports that 'Eclim' triggers a bug in Vim that
|
||||
makes syntastic forget some of its configuration parameters. No solutions or
|
||||
workarounds are known for now.
|
||||
Syntastic can be used together with 'Eclim' (see http://eclim.org/). However,
|
||||
by default Eclim disables syntastic's checks for the filetypes it supports, in
|
||||
order to run its own validation. If you'd prefer to use Eclim but still run
|
||||
syntastic's checks, set |g:EclimFileTypeValidate| to 0: >
|
||||
let g:EclimFileTypeValidate = 0
|
||||
<
|
||||
It is also possible to re-enable syntastic checks only for some filetypes, and
|
||||
run Eclim's validation for others. Please consult Eclim's documentation for
|
||||
details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6.9. Interaction with vim-virtualenv *syntastic-vim-virtualenv*
|
||||
|
@ -780,6 +806,19 @@ in Python virtual environments activated by 'vim-virtualenv' (see
|
|||
https://github.com/jmcantrell/vim-virtualenv). This is a limitation of
|
||||
'vim-virtualenv'.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
6.10. Interaction with vim-auto-save *syntastic-vim-auto-save*
|
||||
|
||||
At the time of this writing, syntastic checks in active mode are not triggered
|
||||
by 'vim-auto-save' (see https://github.com/907th/vim-auto-save). The reason is
|
||||
a limitation in 'vim-auto-save', namely a missing flag to an 'autocmd' (see
|
||||
|autocmd-nested|). Fortunately it's pretty easy to achieve a similar effect
|
||||
without 'vim-auto-save'': >
|
||||
augroup syntastic
|
||||
autocmd CursorHold * nested update
|
||||
augroup END
|
||||
set updatetime=200
|
||||
<
|
||||
==============================================================================
|
||||
7. About *syntastic-about*
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@ endif
|
|||
let g:loaded_syntastic_plugin = 1
|
||||
|
||||
if has('reltime')
|
||||
let g:syntastic_start = reltime()
|
||||
lockvar! g:syntastic_start
|
||||
let g:_SYNTASTIC_START = reltime()
|
||||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:syntastic_version = '3.5.0-65'
|
||||
lockvar g:syntastic_version
|
||||
let g:_SYNTASTIC_VERSION = '3.5.0-72'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
|
||||
|
@ -39,24 +39,24 @@ for s:feature in [
|
|||
endif
|
||||
endfor
|
||||
|
||||
let s:running_windows = syntastic#util#isRunningWindows()
|
||||
lockvar s:running_windows
|
||||
let s:_running_windows = syntastic#util#isRunningWindows()
|
||||
lockvar s:_running_windows
|
||||
|
||||
if !s:running_windows && executable('uname')
|
||||
if !s:_running_windows && executable('uname')
|
||||
try
|
||||
let s:uname = system('uname')
|
||||
let s:_uname = system('uname')
|
||||
catch /\m^Vim\%((\a\+)\)\=:E484/
|
||||
call syntastic#log#error("your shell " . &shell . " can't handle traditional UNIX syntax for redirections")
|
||||
finish
|
||||
endtry
|
||||
lockvar s:uname
|
||||
lockvar s:_uname
|
||||
endif
|
||||
|
||||
" }}}1
|
||||
|
||||
" Defaults {{{1
|
||||
|
||||
let g:syntastic_defaults = {
|
||||
let g:_SYNTASTIC_DEFAULTS = {
|
||||
\ 'aggregate_errors': 0,
|
||||
\ 'always_populate_loc_list': 0,
|
||||
\ 'auto_jump': 0,
|
||||
|
@ -71,7 +71,7 @@ let g:syntastic_defaults = {
|
|||
\ 'enable_highlighting': 1,
|
||||
\ 'enable_signs': 1,
|
||||
\ 'error_symbol': '>>',
|
||||
\ 'exit_checks': !(s:running_windows && &shell =~? '\m\<cmd\.exe$'),
|
||||
\ 'exit_checks': !(s:_running_windows && &shell =~? '\m\<cmd\.exe$'),
|
||||
\ 'filetype_map': {},
|
||||
\ 'full_redraws': !(has('gui_running') || has('gui_macvim')),
|
||||
\ 'id_checkers': 1,
|
||||
|
@ -86,11 +86,11 @@ let g:syntastic_defaults = {
|
|||
\ 'style_warning_symbol': 'S>',
|
||||
\ 'warning_symbol': '>>'
|
||||
\ }
|
||||
lockvar! g:syntastic_defaults
|
||||
lockvar! g:_SYNTASTIC_DEFAULTS
|
||||
|
||||
for s:key in keys(g:syntastic_defaults)
|
||||
for s:key in keys(g:_SYNTASTIC_DEFAULTS)
|
||||
if !exists('g:syntastic_' . s:key)
|
||||
let g:syntastic_{s:key} = copy(g:syntastic_defaults[s:key])
|
||||
let g:syntastic_{s:key} = copy(g:_SYNTASTIC_DEFAULTS[s:key])
|
||||
endif
|
||||
endfor
|
||||
|
||||
|
@ -110,7 +110,7 @@ endif
|
|||
|
||||
" Debug {{{1
|
||||
|
||||
let s:debug_dump_options = [
|
||||
let s:_DEBUG_DUMP_OPTIONS = [
|
||||
\ 'shell',
|
||||
\ 'shellcmdflag',
|
||||
\ 'shellpipe',
|
||||
|
@ -121,23 +121,23 @@ let s:debug_dump_options = [
|
|||
\ 'shellxquote'
|
||||
\ ]
|
||||
if v:version > 703 || (v:version == 703 && has('patch446'))
|
||||
call add(s:debug_dump_options, 'shellxescape')
|
||||
call add(s:_DEBUG_DUMP_OPTIONS, 'shellxescape')
|
||||
endif
|
||||
lockvar! s:debug_dump_options
|
||||
lockvar! s:_DEBUG_DUMP_OPTIONS
|
||||
|
||||
" debug constants
|
||||
let g:SyntasticDebugTrace = 1
|
||||
lockvar g:SyntasticDebugTrace
|
||||
let g:SyntasticDebugLoclist = 2
|
||||
lockvar g:SyntasticDebugLoclist
|
||||
let g:SyntasticDebugNotifications = 4
|
||||
lockvar g:SyntasticDebugNotifications
|
||||
let g:SyntasticDebugAutocommands = 8
|
||||
lockvar g:SyntasticDebugAutocommands
|
||||
let g:SyntasticDebugVariables = 16
|
||||
lockvar g:SyntasticDebugVariables
|
||||
let g:SyntasticDebugCheckers = 32
|
||||
lockvar g:SyntasticDebugCheckers
|
||||
let g:_SYNTASTIC_DEBUG_TRACE = 1
|
||||
lockvar g:_SYNTASTIC_DEBUG_TRACE
|
||||
let g:_SYNTASTIC_DEBUG_LOCLIST = 2
|
||||
lockvar g:_SYNTASTIC_DEBUG_LOCLIST
|
||||
let g:_SYNTASTIC_DEBUG_NOTIFICATIONS = 4
|
||||
lockvar g:_SYNTASTIC_DEBUG_NOTIFICATIONS
|
||||
let g:_SYNTASTIC_DEBUG_AUTOCOMMANDS = 8
|
||||
lockvar g:_SYNTASTIC_DEBUG_AUTOCOMMANDS
|
||||
let g:_SYNTASTIC_DEBUG_VARIABLES = 16
|
||||
lockvar g:_SYNTASTIC_DEBUG_VARIABLES
|
||||
let g:_SYNTASTIC_DEBUG_CHECKERS = 32
|
||||
lockvar g:_SYNTASTIC_DEBUG_CHECKERS
|
||||
|
||||
" }}}1
|
||||
|
||||
|
@ -180,10 +180,11 @@ command! -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck
|
|||
\ call syntastic#util#redraw(g:syntastic_full_redraws)
|
||||
command! Errors call s:ShowLocList()
|
||||
command! -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo
|
||||
\ call s:modemap.modeInfo(<f-args>) |
|
||||
\ call s:registry.echoInfoFor(s:resolveFiletypes(<f-args>))
|
||||
\ call s:modemap.modeInfo(<f-args>) <bar>
|
||||
\ call s:registry.echoInfoFor(s:resolveFiletypes(<f-args>)) <bar>
|
||||
\ call s:explainSkip(<f-args>)
|
||||
command! SyntasticReset
|
||||
\ call s:ClearCache() |
|
||||
\ call s:ClearCache() <bar>
|
||||
\ call s:notifiers.refresh(g:SyntasticLoclist.New([]))
|
||||
command! SyntasticSetLoclist call g:SyntasticLoclist.current().setloclist()
|
||||
|
||||
|
@ -206,20 +207,20 @@ endif
|
|||
|
||||
function! s:BufReadPostHook() " {{{2
|
||||
if g:syntastic_check_on_open
|
||||
call syntastic#log#debug(g:SyntasticDebugAutocommands,
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufReadPost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
|
||||
call s:UpdateErrors(1)
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:BufWritePostHook() " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugAutocommands,
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufWritePost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
|
||||
call s:UpdateErrors(1)
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:BufEnterHook() " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugAutocommands,
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) .
|
||||
\ ', &buftype = ' . string(&buftype))
|
||||
if &buftype == ''
|
||||
|
@ -238,7 +239,7 @@ function! s:BufEnterHook() " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! s:QuitPreHook() " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugAutocommands,
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: QuitPre, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
|
||||
let b:syntastic_skip_checks = get(b:, 'syntastic_skip_checks', 0) || !syntastic#util#var('check_on_wq')
|
||||
call SyntasticLoclistHide()
|
||||
|
@ -250,10 +251,10 @@ endfunction " }}}2
|
|||
|
||||
"refresh and redraw all the error info for this buf when saving or reading
|
||||
function! s:UpdateErrors(auto_invoked, ...) " {{{2
|
||||
call syntastic#log#debugShowVariables(g:SyntasticDebugTrace, 'version')
|
||||
call syntastic#log#debugShowOptions(g:SyntasticDebugTrace, s:debug_dump_options)
|
||||
call syntastic#log#debugDump(g:SyntasticDebugVariables)
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'UpdateErrors' . (a:auto_invoked ? ' (auto)' : '') .
|
||||
call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'version')
|
||||
call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, s:_DEBUG_DUMP_OPTIONS)
|
||||
call syntastic#log#debugDump(g:_SYNTASTIC_DEBUG_VARIABLES)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'UpdateErrors' . (a:auto_invoked ? ' (auto)' : '') .
|
||||
\ ': ' . (a:0 ? join(a:000) : 'default checkers'))
|
||||
if s:skipFile()
|
||||
return
|
||||
|
@ -277,11 +278,11 @@ function! s:UpdateErrors(auto_invoked, ...) " {{{2
|
|||
|
||||
let w:syntastic_loclist_set = 0
|
||||
if syntastic#util#var('always_populate_loc_list') || do_jump
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist (new)')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: setloclist (new)')
|
||||
call setloclist(0, loclist.getRaw())
|
||||
let w:syntastic_loclist_set = 1
|
||||
if run_checks && do_jump && !loclist.isEmpty()
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: jump')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: jump')
|
||||
silent! lrewind
|
||||
|
||||
" XXX: Vim doesn't call autocmd commands in a predictible
|
||||
|
@ -306,15 +307,15 @@ endfunction " }}}2
|
|||
|
||||
"detect and cache all syntax errors in this buffer
|
||||
function! s:CacheErrors(checker_names) " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: ' .
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'CacheErrors: ' .
|
||||
\ (len(a:checker_names) ? join(a:checker_names) : 'default checkers'))
|
||||
call s:ClearCache()
|
||||
let newLoclist = g:SyntasticLoclist.New([])
|
||||
|
||||
if !s:skipFile()
|
||||
" debug logging {{{3
|
||||
call syntastic#log#debugShowVariables(g:SyntasticDebugTrace, 'aggregate_errors')
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'getcwd() = ' . getcwd())
|
||||
call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'aggregate_errors')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getcwd() = ' . getcwd())
|
||||
" }}}3
|
||||
|
||||
let filetypes = s:resolveFiletypes()
|
||||
|
@ -332,12 +333,12 @@ function! s:CacheErrors(checker_names) " {{{2
|
|||
for checker in clist
|
||||
let cname = checker.getFiletype() . '/' . checker.getName()
|
||||
if !checker.isAvailable()
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: Checker ' . cname . ' is not available')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'CacheErrors: Checker ' . cname . ' is not available')
|
||||
let unavailable_checkers += 1
|
||||
continue
|
||||
endif
|
||||
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: Invoking checker: ' . cname)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'CacheErrors: Invoking checker: ' . cname)
|
||||
|
||||
let loclist = checker.getLocList()
|
||||
|
||||
|
@ -346,9 +347,9 @@ function! s:CacheErrors(checker_names) " {{{2
|
|||
call loclist.decorate(cname)
|
||||
endif
|
||||
call add(names, cname)
|
||||
if checker.getWantSort() && !sort_aggregated_errors
|
||||
if checker.wantSort() && !sort_aggregated_errors
|
||||
call loclist.sort()
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'sorted:', loclist)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'sorted:', loclist)
|
||||
endif
|
||||
|
||||
let newLoclist = newLoclist.extend(loclist)
|
||||
|
@ -381,15 +382,15 @@ function! s:CacheErrors(checker_names) " {{{2
|
|||
call syntastic#log#warn('checkers ' . join(a:checker_names, ', ') . ' are not available')
|
||||
endif
|
||||
else
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: no checkers available for ' . &filetype)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'CacheErrors: no checkers available for ' . &filetype)
|
||||
endif
|
||||
endif
|
||||
" }}}3
|
||||
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'aggregated:', newLoclist)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'aggregated:', newLoclist)
|
||||
if sort_aggregated_errors
|
||||
call newLoclist.sort()
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'sorted:', newLoclist)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'sorted:', newLoclist)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -428,7 +429,7 @@ endfunction " }}}2
|
|||
" 'returns' - a list of valid exit codes for the checker
|
||||
" @vimlint(EVL102, 1, l:env_save)
|
||||
function! SyntasticMake(options) " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'SyntasticMake: called with options:', a:options)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'SyntasticMake: called with options:', a:options)
|
||||
|
||||
" save options and locale env variables {{{3
|
||||
let old_shellredir = &shellredir
|
||||
|
@ -475,32 +476,42 @@ function! SyntasticMake(options) " {{{2
|
|||
endif
|
||||
" }}}3
|
||||
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'checker output:', err_lines)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', err_lines)
|
||||
|
||||
if has_key(a:options, 'Preprocess')
|
||||
let err_lines = call(a:options['Preprocess'], [err_lines])
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'preprocess (external):', err_lines)
|
||||
elseif has_key(a:options, 'preprocess')
|
||||
let err_lines = call('syntastic#preprocess#' . a:options['preprocess'], [err_lines])
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'preprocess:', err_lines)
|
||||
" Does it still make sense to go on?
|
||||
let bailout =
|
||||
\ syntastic#util#var('exit_checks') &&
|
||||
\ has_key(a:options, 'returns') &&
|
||||
\ index(a:options['returns'], v:shell_error) == -1
|
||||
|
||||
if !bailout
|
||||
if has_key(a:options, 'Preprocess')
|
||||
let err_lines = call(a:options['Preprocess'], [err_lines])
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'preprocess (external):', err_lines)
|
||||
elseif has_key(a:options, 'preprocess')
|
||||
let err_lines = call('syntastic#preprocess#' . a:options['preprocess'], [err_lines])
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'preprocess:', err_lines)
|
||||
endif
|
||||
lgetexpr err_lines
|
||||
|
||||
let errors = deepcopy(getloclist(0))
|
||||
|
||||
if has_key(a:options, 'cwd')
|
||||
execute 'lcd ' . fnameescape(old_cwd)
|
||||
endif
|
||||
|
||||
try
|
||||
silent lolder
|
||||
catch /\m^Vim\%((\a\+)\)\=:E380/
|
||||
" E380: At bottom of quickfix stack
|
||||
call setloclist(0, [], 'r')
|
||||
catch /\m^Vim\%((\a\+)\)\=:E776/
|
||||
" E776: No location list
|
||||
" do nothing
|
||||
endtry
|
||||
else
|
||||
let errors = []
|
||||
endif
|
||||
lgetexpr err_lines
|
||||
|
||||
let errors = deepcopy(getloclist(0))
|
||||
|
||||
if has_key(a:options, 'cwd')
|
||||
execute 'lcd ' . fnameescape(old_cwd)
|
||||
endif
|
||||
|
||||
try
|
||||
silent lolder
|
||||
catch /\m^Vim\%((\a\+)\)\=:E380/
|
||||
" E380: At bottom of quickfix stack
|
||||
call setloclist(0, [], 'r')
|
||||
catch /\m^Vim\%((\a\+)\)\=:E776/
|
||||
" E776: No location list
|
||||
" do nothing
|
||||
endtry
|
||||
|
||||
" restore options {{{3
|
||||
let &errorformat = old_errorformat
|
||||
|
@ -508,16 +519,16 @@ function! SyntasticMake(options) " {{{2
|
|||
let &shellredir = old_shellredir
|
||||
" }}}3
|
||||
|
||||
if !s:running_windows && (s:uname() =~ "FreeBSD" || s:uname() =~ "OpenBSD")
|
||||
if !s:_running_windows && (s:uname() =~ "FreeBSD" || s:uname() =~ "OpenBSD")
|
||||
call syntastic#util#redraw(g:syntastic_full_redraws)
|
||||
endif
|
||||
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'raw loclist:', errors)
|
||||
|
||||
if syntastic#util#var('exit_checks') && has_key(a:options, 'returns') && index(a:options['returns'], v:shell_error) == -1
|
||||
if bailout
|
||||
throw 'Syntastic: checker error'
|
||||
endif
|
||||
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'raw loclist:', errors)
|
||||
|
||||
if has_key(a:options, 'defaults')
|
||||
call s:addToErrors(errors, a:options['defaults'])
|
||||
endif
|
||||
|
@ -531,12 +542,12 @@ function! SyntasticMake(options) " {{{2
|
|||
for rule in a:options['Postprocess']
|
||||
let errors = call(rule, [errors])
|
||||
endfor
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'postprocess (external):', errors)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'postprocess (external):', errors)
|
||||
elseif has_key(a:options, 'postprocess') && !empty(a:options['postprocess'])
|
||||
for rule in a:options['postprocess']
|
||||
let errors = call('syntastic#postprocess#' . rule, [errors])
|
||||
endfor
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'postprocess:', errors)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'postprocess:', errors)
|
||||
endif
|
||||
|
||||
return errors
|
||||
|
@ -577,11 +588,40 @@ function! s:skipFile() " {{{2
|
|||
\ !filereadable(fname) || getwinvar(0, '&diff') || s:ignoreFile(fname) ||
|
||||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
|
||||
if skip
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'skipFile: skipping')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'skipFile: skipping')
|
||||
endif
|
||||
return skip
|
||||
endfunction " }}}2
|
||||
|
||||
" Explain why checks will be skipped for the current file
|
||||
function! s:explainSkip(...) " {{{2
|
||||
if !a:0 && s:skipFile()
|
||||
let why = []
|
||||
let fname = expand('%')
|
||||
|
||||
if get(b:, 'syntastic_skip_checks', 0)
|
||||
call add(why, 'b:syntastic_skip_checks set')
|
||||
endif
|
||||
if &buftype != ''
|
||||
call add(why, 'buftype = ' . string(&buftype))
|
||||
endif
|
||||
if !filereadable(fname)
|
||||
call add(why, 'file not readable / not local')
|
||||
endif
|
||||
if getwinvar(0, '&diff')
|
||||
call add(why, 'diff mode')
|
||||
endif
|
||||
if s:ignoreFile(fname)
|
||||
call add(why, 'filename matching g:syntastic_ignore_files')
|
||||
endif
|
||||
if fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
|
||||
call add(why, 'extension matching g:syntastic_ignore_extensions')
|
||||
endif
|
||||
|
||||
echomsg 'The current file will not be checked (' . join(why, ', ') . ')'
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
" Take a list of errors and add default values to them from a:options
|
||||
function! s:addToErrors(errors, options) " {{{2
|
||||
for err in a:errors
|
||||
|
@ -602,7 +642,7 @@ function! s:bashHack() " {{{2
|
|||
if g:syntastic_bash_hack
|
||||
if !exists('s:shell_is_bash')
|
||||
let s:shell_is_bash =
|
||||
\ !s:running_windows &&
|
||||
\ !s:_running_windows &&
|
||||
\ (s:uname() !~# "FreeBSD") && (s:uname() !~# "OpenBSD") &&
|
||||
\ &shell =~# '\m\<bash$'
|
||||
endif
|
||||
|
@ -614,11 +654,11 @@ function! s:bashHack() " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! s:uname() " {{{2
|
||||
if !exists('s:uname')
|
||||
let s:uname = system('uname')
|
||||
lockvar s:uname
|
||||
if !exists('s:_uname')
|
||||
let s:_uname = system('uname')
|
||||
lockvar s:_uname
|
||||
endif
|
||||
return s:uname
|
||||
return s:_uname
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
|
|
@ -13,12 +13,12 @@ function! g:SyntasticAutoloclistNotifier.New() " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticAutoloclistNotifier.refresh(loclist) " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'autoloclist: refresh')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: refresh')
|
||||
call g:SyntasticAutoloclistNotifier.AutoToggle(a:loclist)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'autoloclist: toggle')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: toggle')
|
||||
if !a:loclist.isEmpty()
|
||||
if syntastic#util#var('auto_loc_list') == 1
|
||||
call a:loclist.show()
|
||||
|
|
|
@ -22,20 +22,11 @@ endfunction " }}}2
|
|||
|
||||
" Update the error balloons
|
||||
function! g:SyntasticBalloonsNotifier.refresh(loclist) " {{{2
|
||||
let b:syntastic_balloons = {}
|
||||
unlet! b:syntastic_balloons
|
||||
if self.enabled() && !a:loclist.isEmpty()
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: refresh')
|
||||
let buf = bufnr('')
|
||||
let issues = filter(a:loclist.copyRaw(), 'v:val["bufnr"] == buf')
|
||||
if !empty(issues)
|
||||
for i in issues
|
||||
if has_key(b:syntastic_balloons, i['lnum'])
|
||||
let b:syntastic_balloons[i['lnum']] .= "\n" . i['text']
|
||||
else
|
||||
let b:syntastic_balloons[i['lnum']] = i['text']
|
||||
endif
|
||||
endfor
|
||||
set beval bexpr=SyntasticBalloonsExprNotifier()
|
||||
let b:syntastic_balloons = a:loclist.balloons()
|
||||
if !empty(b:syntastic_balloons)
|
||||
set ballooneval balloonexpr=SyntasticBalloonsExprNotifier()
|
||||
endif
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
@ -45,8 +36,9 @@ endfunction " }}}2
|
|||
function! g:SyntasticBalloonsNotifier.reset(loclist) " {{{2
|
||||
let b:syntastic_balloons = {}
|
||||
if has('balloon_eval')
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: reset')
|
||||
set nobeval
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'balloons: reset')
|
||||
unlet! b:syntastic_balloons
|
||||
set noballooneval
|
||||
endif
|
||||
endfunction " }}}2
|
||||
" @vimlint(EVL103, 0, a:loclist)
|
||||
|
|
|
@ -13,11 +13,14 @@ function! g:SyntasticChecker.New(args) " {{{2
|
|||
let newObj._filetype = a:args['filetype']
|
||||
let newObj._name = a:args['name']
|
||||
let newObj._exec = get(a:args, 'exec', newObj._name)
|
||||
let newObj._sort = 0
|
||||
|
||||
if has_key(a:args, 'redirect')
|
||||
let [filetype, name] = split(a:args['redirect'], '/')
|
||||
let prefix = 'SyntaxCheckers_' . filetype . '_' . name . '_'
|
||||
|
||||
if exists('g:syntastic_' . filetype . '_' . name . '_sort') && !exists('g:syntastic_' . newObj._filetype . '_' . newObj._name . '_sort')
|
||||
let g:syntastic_{newObj._filetype}_{newObj._name}_sort = g:syntastic_{filetype}_{name}_sort
|
||||
endif
|
||||
else
|
||||
let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_'
|
||||
endif
|
||||
|
@ -59,13 +62,13 @@ function! g:SyntasticChecker.getLocListRaw() " {{{2
|
|||
let name = self._filetype . '/' . self._name
|
||||
try
|
||||
let list = self._locListFunc()
|
||||
call syntastic#log#debug(g:SyntasticDebugTrace, 'getLocList: checker ' . name . ' returned ' . v:shell_error)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' returned ' . v:shell_error)
|
||||
catch /\m\C^Syntastic: checker error$/
|
||||
let list = []
|
||||
call syntastic#log#error('checker ' . name . ' returned abnormal status ' . v:shell_error)
|
||||
endtry
|
||||
call self._populateHighlightRegexes(list)
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, name . ' raw:', list)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, name . ' raw:', list)
|
||||
call self._quietMessages(list)
|
||||
return list
|
||||
endfunction " }}}2
|
||||
|
@ -74,20 +77,12 @@ function! g:SyntasticChecker.getLocList() " {{{2
|
|||
return g:SyntasticLoclist.New(self.getLocListRaw())
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getWantSort() " {{{2
|
||||
return self._sort
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.setWantSort(val) " {{{2
|
||||
let self._sort = a:val
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.log(msg, ...) " {{{2
|
||||
let leader = self._filetype . '/' . self._name . ': '
|
||||
if a:0 > 0
|
||||
call syntastic#log#debug(g:SyntasticDebugCheckers, leader . a:msg, a:1)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, leader . a:msg, a:1)
|
||||
else
|
||||
call syntastic#log#debug(g:SyntasticDebugCheckers, leader . a:msg)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, leader . a:msg)
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
|
@ -111,6 +106,18 @@ function! g:SyntasticChecker.isAvailable() " {{{2
|
|||
return self._available
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.wantSort() " {{{2
|
||||
return syntastic#util#var(self._filetype . '_' . self._name . '_sort', 0)
|
||||
endfunction " }}}2
|
||||
|
||||
" This method is no longer used by syntastic. It's here only to maintain
|
||||
" backwards compatibility with external checkers which might depend on it.
|
||||
function! g:SyntasticChecker.setWantSort(val) " {{{2
|
||||
if !exists('g:syntastic_' . self._filetype . '_' . self._name . '_sort')
|
||||
let g:syntastic_{self._filetype}_{self._name}_sort = a:val
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
||||
" Private methods {{{1
|
||||
|
@ -132,11 +139,11 @@ function! g:SyntasticChecker._quietMessages(errors) " {{{2
|
|||
call syntastic#log#warn('ignoring invalid syntastic_' . name . '_quiet_messages')
|
||||
endtry
|
||||
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'quiet_messages filter:', quiet_filters)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'quiet_messages filter:', quiet_filters)
|
||||
|
||||
if !empty(quiet_filters)
|
||||
call syntastic#util#dictFilter(a:errors, quiet_filters)
|
||||
call syntastic#log#debug(g:SyntasticDebugLoclist, 'filtered by quiet_messages:', a:errors)
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'filtered by quiet_messages:', a:errors)
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ endfunction " }}}2
|
|||
|
||||
function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2
|
||||
if self.enabled() && !a:loclist.isEmpty()
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'cursor: refresh')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'cursor: refresh')
|
||||
let b:syntastic_messages = copy(a:loclist.messages(bufnr('')))
|
||||
let b:syntastic_line = -1
|
||||
let b:syntastic_cursor_columns = a:loclist.getCursorColumns()
|
||||
|
@ -29,7 +29,7 @@ endfunction " }}}2
|
|||
|
||||
" @vimlint(EVL103, 1, a:loclist)
|
||||
function! g:SyntasticCursorNotifier.reset(loclist) " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'cursor: reset')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'cursor: reset')
|
||||
autocmd! syntastic CursorMoved
|
||||
unlet! b:syntastic_messages
|
||||
let b:syntastic_line = -1
|
||||
|
|
|
@ -32,7 +32,7 @@ endfunction " }}}2
|
|||
" Sets error highlights in the cuirrent window
|
||||
function! g:SyntasticHighlightingNotifier.refresh(loclist) " {{{2
|
||||
if self.enabled()
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: refresh')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: refresh')
|
||||
call self._reset()
|
||||
let buf = bufnr('')
|
||||
let issues = filter(a:loclist.copyRaw(), 'v:val["bufnr"] == buf')
|
||||
|
@ -63,7 +63,7 @@ endfunction " }}}2
|
|||
" @vimlint(EVL103, 1, a:loclist)
|
||||
function! g:SyntasticHighlightingNotifier.reset(loclist) " {{{2
|
||||
if s:has_highlighting
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: reset')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: reset')
|
||||
call self._reset()
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
|
|
@ -173,6 +173,29 @@ function! g:SyntasticLoclist.decorate(tag) " {{{2
|
|||
endfor
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.balloons() " {{{2
|
||||
if !exists("self._cachedBalloons")
|
||||
let sep = has("balloon_multiline") ? "\n" : ' | '
|
||||
|
||||
let self._cachedBalloons = {}
|
||||
for e in self._rawLoclist
|
||||
let buf = e['bufnr']
|
||||
|
||||
if !has_key(self._cachedBalloons, buf)
|
||||
let self._cachedBalloons[buf] = {}
|
||||
endif
|
||||
|
||||
if has_key(self._cachedBalloons[buf], e['lnum'])
|
||||
let self._cachedBalloons[buf][e['lnum']] .= sep . e['text']
|
||||
else
|
||||
let self._cachedBalloons[buf][e['lnum']] = e['text']
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
return get(self._cachedBalloons, bufnr(''), {})
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.errors() " {{{2
|
||||
if !exists("self._cachedErrors")
|
||||
let self._cachedErrors = self.filter({'type': "E"})
|
||||
|
@ -258,14 +281,14 @@ function! g:SyntasticLoclist.setloclist() " {{{2
|
|||
let w:syntastic_loclist_set = 0
|
||||
endif
|
||||
let replace = g:syntastic_reuse_loc_lists && w:syntastic_loclist_set
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)'))
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)'))
|
||||
call setloclist(0, self.getRaw(), replace ? 'r' : ' ')
|
||||
let w:syntastic_loclist_set = 1
|
||||
endfunction " }}}2
|
||||
|
||||
"display the cached errors for this buf in the location list
|
||||
function! g:SyntasticLoclist.show() " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: show')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: show')
|
||||
call self.setloclist()
|
||||
|
||||
if !self.isEmpty()
|
||||
|
@ -300,7 +323,7 @@ endfunction " }}}2
|
|||
" Non-method functions {{{1
|
||||
|
||||
function! SyntasticLoclistHide() " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: hide')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: hide')
|
||||
silent! lclose
|
||||
endfunction " }}}2
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ function! g:SyntasticModeMap.echoMode() " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticModeMap.modeInfo(...) " {{{2
|
||||
echomsg 'Syntastic version: ' . g:syntastic_version
|
||||
echomsg 'Syntastic version: ' . g:_SYNTASTIC_VERSION
|
||||
let type = a:0 ? a:1 : &filetype
|
||||
echomsg 'Info for filetype: ' . type
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@ let g:loaded_syntastic_notifiers = 1
|
|||
|
||||
let g:SyntasticNotifiers = {}
|
||||
|
||||
let s:notifier_types = ['signs', 'balloons', 'highlighting', 'cursor', 'autoloclist']
|
||||
lockvar! s:notifier_types
|
||||
let s:_NOTIFIER_TYPES = ['signs', 'balloons', 'highlighting', 'cursor', 'autoloclist']
|
||||
lockvar! s:_NOTIFIER_TYPES
|
||||
|
||||
let s:persistent_notifiers = ['signs', 'balloons']
|
||||
lockvar! s:persistent_notifiers
|
||||
let s:_PERSISTENT_NOTIFIERS = ['signs', 'balloons']
|
||||
lockvar! s:_PERSISTENT_NOTIFIERS
|
||||
|
||||
" Public methods {{{1
|
||||
|
||||
|
@ -28,11 +28,11 @@ function! g:SyntasticNotifiers.refresh(loclist) " {{{2
|
|||
return
|
||||
endif
|
||||
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'notifiers: refresh')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'notifiers: refresh')
|
||||
for type in self._enabled_types
|
||||
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')
|
||||
if !has_key(g:{class}, 'enabled') || self._notifier[type].enabled()
|
||||
if index(s:persistent_notifiers, type) > -1
|
||||
if index(s:_PERSISTENT_NOTIFIERS, type) > -1
|
||||
" refresh only if loclist has changed since last call
|
||||
if !exists('b:syntastic_' . type . '_stamp')
|
||||
let b:syntastic_{type}_stamp = []
|
||||
|
@ -49,7 +49,7 @@ function! g:SyntasticNotifiers.refresh(loclist) " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticNotifiers.reset(loclist) " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'notifiers: reset')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'notifiers: reset')
|
||||
for type in self._enabled_types
|
||||
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')
|
||||
|
||||
|
@ -61,7 +61,7 @@ function! g:SyntasticNotifiers.reset(loclist) " {{{2
|
|||
endif
|
||||
|
||||
" also reset stamps
|
||||
if index(s:persistent_notifiers, type) > -1
|
||||
if index(s:_PERSISTENT_NOTIFIERS, type) > -1
|
||||
let b:syntastic_{type}_stamp = []
|
||||
endif
|
||||
endfor
|
||||
|
@ -73,12 +73,12 @@ endfunction " }}}2
|
|||
|
||||
function! g:SyntasticNotifiers._initNotifiers() " {{{2
|
||||
let self._notifier = {}
|
||||
for type in s:notifier_types
|
||||
for type in s:_NOTIFIER_TYPES
|
||||
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')
|
||||
let self._notifier[type] = g:{class}.New()
|
||||
endfor
|
||||
|
||||
let self._enabled_types = copy(s:notifier_types)
|
||||
let self._enabled_types = copy(s:_NOTIFIER_TYPES)
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
|
|
@ -5,7 +5,7 @@ let g:loaded_syntastic_registry = 1
|
|||
|
||||
" Initialisation {{{1
|
||||
|
||||
let s:defaultCheckers = {
|
||||
let s:_DEFAULT_CHECKERS = {
|
||||
\ 'actionscript':['mxmlc'],
|
||||
\ 'ada': ['gcc'],
|
||||
\ 'applescript': ['osacompile'],
|
||||
|
@ -94,9 +94,9 @@ let s:defaultCheckers = {
|
|||
\ 'zpt': ['zptlint'],
|
||||
\ 'zsh': ['zsh', 'shellcheck']
|
||||
\ }
|
||||
lockvar! s:defaultCheckers
|
||||
lockvar! s:_DEFAULT_CHECKERS
|
||||
|
||||
let s:defaultFiletypeMap = {
|
||||
let s:_DEFAULT_FILETYPE_MAP = {
|
||||
\ 'gentoo-metadata': 'xml',
|
||||
\ 'groff': 'nroff',
|
||||
\ 'lhaskell': 'haskell',
|
||||
|
@ -106,7 +106,7 @@ let s:defaultFiletypeMap = {
|
|||
\ 'sgml': 'docbk',
|
||||
\ 'sgmllnx': 'docbk',
|
||||
\ }
|
||||
lockvar! s:defaultFiletypeMap
|
||||
lockvar! s:_DEFAULT_FILETYPE_MAP
|
||||
|
||||
let g:SyntasticRegistry = {}
|
||||
|
||||
|
@ -152,7 +152,7 @@ function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) " {{{2
|
|||
\ !empty(a:hints_list) ? syntastic#util#unique(a:hints_list) :
|
||||
\ exists('b:syntastic_checkers') ? b:syntastic_checkers :
|
||||
\ exists('g:syntastic_' . ft . '_checkers') ? g:syntastic_{ft}_checkers :
|
||||
\ get(s:defaultCheckers, ft, 0)
|
||||
\ get(s:_DEFAULT_CHECKERS, ft, 0)
|
||||
|
||||
return type(names) == type([]) ?
|
||||
\ self._filterCheckersByName(checkers_map, names) : [checkers_map[keys(checkers_map)[0]]]
|
||||
|
@ -165,9 +165,9 @@ function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
|
||||
let types = keys(s:defaultCheckers)
|
||||
let types = keys(s:_DEFAULT_CHECKERS)
|
||||
|
||||
call extend(types, keys(s:defaultFiletypeMap))
|
||||
call extend(types, keys(s:_DEFAULT_FILETYPE_MAP))
|
||||
|
||||
if exists('g:syntastic_filetype_map')
|
||||
call extend(types, keys(g:syntastic_filetype_map))
|
||||
|
@ -262,7 +262,7 @@ endfunction " }}}2
|
|||
"resolve filetype aliases, and replace - with _ otherwise we cant name
|
||||
"syntax checker functions legally for filetypes like "gentoo-metadata"
|
||||
function! s:_normaliseFiletype(ftalias) " {{{2
|
||||
let ft = get(s:defaultFiletypeMap, a:ftalias, a:ftalias)
|
||||
let ft = get(s:_DEFAULT_FILETYPE_MAP, a:ftalias, a:ftalias)
|
||||
let ft = get(g:syntastic_filetype_map, ft, ft)
|
||||
let ft = substitute(ft, '\m-', '_', 'g')
|
||||
return ft
|
||||
|
|
|
@ -36,7 +36,7 @@ function! g:SyntasticSignsNotifier.enabled() " {{{2
|
|||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticSignsNotifier.refresh(loclist) " {{{2
|
||||
call syntastic#log#debug(g:SyntasticDebugNotifications, 'signs: refresh')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'signs: refresh')
|
||||
let old_signs = copy(self._bufSignIds())
|
||||
if self.enabled()
|
||||
call self._signErrors(a:loclist)
|
||||
|
|
|
@ -18,6 +18,10 @@ if !exists('g:syntastic_clang_check_config_file')
|
|||
let g:syntastic_clang_check_config_file = '.syntastic_clang_check_config'
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_c_clang_check_sort')
|
||||
let g:syntastic_c_clang_check_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
@ -39,15 +43,11 @@ function! SyntaxCheckers_c_clang_check_GetLocList() dict
|
|||
\ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' .
|
||||
\ '%E%m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': {'bufnr': bufnr('')},
|
||||
\ 'returns': [0, 1] })
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
|