mirror of
https://github.com/amix/vimrc
synced 2025-06-23 23:15:01 +08:00
Updated plugins
This commit is contained in:
@ -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({
|
||||
|
@ -18,6 +18,10 @@ if !exists('g:syntastic_clang_tidy_config_file')
|
||||
let g:syntastic_clang_tidy_config_file = '.syntastic_clang_tidy_config'
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_c_clang_tidy_sort')
|
||||
let g:syntastic_c_clang_tidy_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -39,15 +43,11 @@ function! SyntaxCheckers_c_clang_tidy_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({
|
||||
|
@ -25,6 +25,10 @@ if !exists('g:syntastic_oclint_config_file')
|
||||
let g:syntastic_oclint_config_file = '.syntastic_oclint_config'
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_c_oclint_sort')
|
||||
let g:syntastic_c_oclint_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -55,8 +59,6 @@ function! SyntaxCheckers_c_oclint_GetLocList() dict
|
||||
let e['text'] = substitute(e['text'], '\m\C P[1-3] ', ': ', '')
|
||||
endfor
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
|
@ -20,6 +20,10 @@ if exists("g:loaded_syntastic_css_prettycss_checker")
|
||||
endif
|
||||
let g:loaded_syntastic_css_prettycss_checker = 1
|
||||
|
||||
if !exists('g:syntastic_css_prettycss_sort')
|
||||
let g:syntastic_css_prettycss_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -49,8 +53,6 @@ function! SyntaxCheckers_css_prettycss_GetLocList() dict
|
||||
let e["text"] .= ')'
|
||||
endfor
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
|
@ -20,7 +20,7 @@ set cpo&vim
|
||||
|
||||
" TODO: we should probably split this into separate checkers
|
||||
function! SyntaxCheckers_elixir_elixir_IsAvailable() dict
|
||||
call self.log(g:SyntasticDebugCheckers,
|
||||
call self.log(
|
||||
\ 'executable("elixir") = ' . executable('elixir') . ', ' .
|
||||
\ 'executable("mix") = ' . executable('mix'))
|
||||
return executable('elixir') && executable('mix')
|
||||
|
@ -15,6 +15,10 @@ if exists('g:loaded_syntastic_haskell_scan_checker')
|
||||
endif
|
||||
let g:loaded_syntastic_haskell_scan_checker = 1
|
||||
|
||||
if !exists('g:syntastic_haskell_scan_sort')
|
||||
let g:syntastic_haskell_scan_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -23,14 +27,10 @@ function! SyntaxCheckers_haskell_scan_GetLocList() dict
|
||||
|
||||
let errorformat = '%f:%l:%v: %m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style' })
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
@ -37,8 +37,6 @@ function! SyntaxCheckers_html_jshint_GetLocList() dict
|
||||
|
||||
let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)'
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
|
@ -55,7 +55,7 @@ set cpo&vim
|
||||
|
||||
" TODO: join this with xhtml.vim for DRY's sake?
|
||||
function! s:TidyEncOptByFenc()
|
||||
let tidy_opts = {
|
||||
let TIDY_OPTS = {
|
||||
\ 'utf-8': '-utf8',
|
||||
\ 'ascii': '-ascii',
|
||||
\ 'latin1': '-latin1',
|
||||
@ -69,10 +69,10 @@ function! s:TidyEncOptByFenc()
|
||||
\ 'sjis': '-shiftjis',
|
||||
\ 'cp850': '-ibm858',
|
||||
\ }
|
||||
return get(tidy_opts, &fileencoding, '-utf8')
|
||||
return get(TIDY_OPTS, &fileencoding, '-utf8')
|
||||
endfunction
|
||||
|
||||
let s:ignore_errors = [
|
||||
let s:IGNORE_ERRORS = [
|
||||
\ "<table> lacks \"summary\" attribute",
|
||||
\ "not approved by W3C",
|
||||
\ "<input> proprietary attribute \"placeholder\"",
|
||||
@ -123,9 +123,9 @@ let s:ignore_errors = [
|
||||
\ "proprietary attribute \"aria-valuenow\"",
|
||||
\ "proprietary attribute \"aria-valuetext\""
|
||||
\ ]
|
||||
lockvar! s:ignore_errors
|
||||
lockvar! s:IGNORE_ERRORS
|
||||
|
||||
let s:blocklevel_tags = [
|
||||
let s:BLOCKLEVEL_TAGS = [
|
||||
\ "main",
|
||||
\ "section",
|
||||
\ "article",
|
||||
@ -136,9 +136,9 @@ let s:blocklevel_tags = [
|
||||
\ "figure",
|
||||
\ "figcaption"
|
||||
\ ]
|
||||
lockvar! s:blocklevel_tags
|
||||
lockvar! s:BLOCKLEVEL_TAGS
|
||||
|
||||
let s:inline_tags = [
|
||||
let s:INLINE_TAGS = [
|
||||
\ "video",
|
||||
\ "audio",
|
||||
\ "source",
|
||||
@ -155,16 +155,16 @@ let s:inline_tags = [
|
||||
\ "details",
|
||||
\ "datalist"
|
||||
\ ]
|
||||
lockvar! s:inline_tags
|
||||
lockvar! s:INLINE_TAGS
|
||||
|
||||
let s:empty_tags = [
|
||||
let s:EMPTY_TAGS = [
|
||||
\ "wbr",
|
||||
\ "keygen"
|
||||
\ ]
|
||||
lockvar! s:empty_tags
|
||||
lockvar! s:EMPTY_TAGS
|
||||
|
||||
function! s:IgnoreError(text)
|
||||
for item in s:ignore_errors + g:syntastic_html_tidy_ignore_errors
|
||||
for item in s:IGNORE_ERRORS + g:syntastic_html_tidy_ignore_errors
|
||||
if stridx(a:text, item) != -1
|
||||
return 1
|
||||
endif
|
||||
@ -173,7 +173,7 @@ function! s:IgnoreError(text)
|
||||
endfunction
|
||||
|
||||
function! s:NewTags(name)
|
||||
return syntastic#util#shescape(join( s:{a:name} + g:syntastic_html_tidy_{a:name}, ',' ))
|
||||
return syntastic#util#shescape(join( s:{toupper(a:name)} + g:syntastic_html_tidy_{a:name}, ',' ))
|
||||
endfunction
|
||||
|
||||
function! s:Args()
|
||||
|
@ -24,6 +24,11 @@ function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() dict
|
||||
return 0
|
||||
endif
|
||||
|
||||
let s:has_script = exists('g:syntastic_javascript_closurecompiler_script')
|
||||
if s:has_script
|
||||
return 1
|
||||
endif
|
||||
|
||||
let cp = get(g:, 'syntastic_javascript_closurecompiler_path', '')
|
||||
call self.log('g:syntastic_javascript_closurecompiler_path =', cp)
|
||||
|
||||
@ -45,14 +50,13 @@ function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict
|
||||
endif
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe_after': ['-jar', expand(g:syntastic_javascript_closurecompiler_path)],
|
||||
\ 'exe_after': (s:has_script ? [] : ['-jar', expand(g:syntastic_javascript_closurecompiler_path)]),
|
||||
\ 'args_after': '--js',
|
||||
\ 'fname': file_list })
|
||||
|
||||
let errorformat =
|
||||
\ '%-GOK,'.
|
||||
\ '%E%f:%l: ERROR - %m,'.
|
||||
\ '%Z%p^,'.
|
||||
\ '%W%f:%l: WARNING - %m,'.
|
||||
\ '%Z%p^'
|
||||
|
||||
@ -64,7 +68,7 @@ endfunction
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'javascript',
|
||||
\ 'name': 'closurecompiler',
|
||||
\ 'exec': 'java'})
|
||||
\ 'exec': get(g:, 'syntastic_javascript_closurecompiler_script', 'java')})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
@ -14,6 +14,10 @@ if exists('g:loaded_syntastic_javascript_eslint_checker')
|
||||
endif
|
||||
let g:loaded_syntastic_javascript_eslint_checker = 1
|
||||
|
||||
if !exists('g:syntastic_javascript_eslint_sort')
|
||||
let g:syntastic_javascript_eslint_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -47,8 +51,6 @@ function! SyntaxCheckers_javascript_eslint_GetLocList() dict
|
||||
let e['col'] += 1
|
||||
endfor
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
|
@ -14,6 +14,10 @@ if exists("g:loaded_syntastic_javascript_jscs_checker")
|
||||
endif
|
||||
let g:loaded_syntastic_javascript_jscs_checker = 1
|
||||
|
||||
if !exists('g:syntastic_javascript_jscs_sort')
|
||||
let g:syntastic_javascript_jscs_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -22,16 +26,12 @@ function! SyntaxCheckers_javascript_jscs_GetLocList() dict
|
||||
|
||||
let errorformat = '%f:%t:%l:%c:%m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style',
|
||||
\ 'preprocess': 'checkstyle',
|
||||
\ 'returns': [0, 2] })
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
@ -14,6 +14,10 @@ if exists('g:loaded_syntastic_javascript_jshint_checker')
|
||||
endif
|
||||
let g:loaded_syntastic_javascript_jshint_checker = 1
|
||||
|
||||
if !exists('g:syntastic_javascript_jshint_sort')
|
||||
let g:syntastic_javascript_jshint_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -43,8 +47,6 @@ function! SyntaxCheckers_javascript_jshint_GetLocList() dict
|
||||
\ '%A%f: line %l\, col %v\, %m \(%t%*\d\)' :
|
||||
\ '%E%f: line %l\, col %v\, %m'
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
|
@ -15,6 +15,10 @@ if exists("g:loaded_syntastic_markdown_mdl_checker")
|
||||
endif
|
||||
let g:loaded_syntastic_markdown_mdl_checker = 1
|
||||
|
||||
if !exists('g:syntastic_markdown_mdl_sort')
|
||||
let g:syntastic_markdown_mdl_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -25,14 +29,10 @@ function! SyntaxCheckers_markdown_mdl_GetLocList() dict
|
||||
\ '%E%f:%l: %m,'.
|
||||
\ '%W%f: Kramdown Warning: %m found on line %l'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style' })
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
@ -0,0 +1,78 @@
|
||||
"============================================================================
|
||||
"File: prospector.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: LCD 47 <lcd047 at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists("g:loaded_syntastic_python_prospector_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_python_prospector_checker = 1
|
||||
|
||||
if !exists('g:syntastic_python_prospector_sort')
|
||||
let g:syntastic_python_prospector_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_python_prospector_IsAvailable() dict
|
||||
if !executable(self.getExec())
|
||||
return 0
|
||||
endif
|
||||
|
||||
let ver = syntastic#util#getVersion(self.getExecEscaped() . ' --version')
|
||||
call self.log(self.getExec() . ' version =', ver)
|
||||
|
||||
return syntastic#util#versionIsAtLeast(ver, [0, 7])
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_python_prospector_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': '--external-config merge',
|
||||
\ 'args_after': '--messages-only --absolute-paths --die-on-tool-error --zero-exit --output-format json' })
|
||||
|
||||
let errorformat = '%f:%l:%c: %m'
|
||||
|
||||
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env,
|
||||
\ 'preprocess': 'prospector',
|
||||
\ 'returns': [0] })
|
||||
|
||||
for e in loclist
|
||||
if e['text'] =~# '\v\[%(dodgy|mccabe|pep8|pep257|pyroma)\]$'
|
||||
let e['subtype'] = 'Style'
|
||||
endif
|
||||
|
||||
if e['text'] =~# '\v\[pylint\]$'
|
||||
let e['type'] = e['text'] =~? '\m^[CRW]' ? 'W' : 'E'
|
||||
elseif e['text'] =~# '\v\[%(frosted|pep8)\]$'
|
||||
let e['type'] = e['text'] =~? '\m^W' ? 'W' : 'E'
|
||||
elseif e['text'] =~# '\v\[%(dodgy|pyroma|vulture)\]$'
|
||||
let e['type'] = 'W'
|
||||
else
|
||||
let e['type'] = 'E'
|
||||
endif
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'python',
|
||||
\ 'name': 'prospector'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -15,6 +15,10 @@ if exists('g:loaded_syntastic_python_pylama_checker')
|
||||
endif
|
||||
let g:loaded_syntastic_python_pylama_checker = 1
|
||||
|
||||
if !exists('g:syntastic_python_pylama_sort')
|
||||
let g:syntastic_python_pylama_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -55,8 +59,6 @@ function! SyntaxCheckers_python_pylama_GetLocList() dict
|
||||
endif
|
||||
endfor
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
|
@ -10,11 +10,15 @@ if exists("g:loaded_syntastic_python_pylint_checker")
|
||||
endif
|
||||
let g:loaded_syntastic_python_pylint_checker = 1
|
||||
|
||||
let s:pylint_new = -1
|
||||
if !exists('g:syntastic_python_pylint_sort')
|
||||
let g:syntastic_python_pylint_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:pylint_new = -1
|
||||
|
||||
function! SyntaxCheckers_python_pylint_IsAvailable() dict
|
||||
if !executable(self.getExec())
|
||||
return 0
|
||||
@ -81,8 +85,6 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict
|
||||
let e['vcol'] = 0
|
||||
endfor
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
|
@ -19,6 +19,10 @@ if !exists('g:syntastic_r_lint_styles')
|
||||
let g:syntastic_r_lint_styles = 'lint.style'
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_r_lint_sort')
|
||||
let g:syntastic_r_lint_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -65,8 +69,6 @@ function! SyntaxCheckers_r_lint_GetLocList() dict
|
||||
endif
|
||||
endfor
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
|
@ -19,6 +19,10 @@ if !exists('g:syntastic_racket_code_ayatollah_script')
|
||||
let g:syntastic_racket_code_ayatollah_script = 'code-ayatollah.rkt'
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_racket_code_ayatollah_sort')
|
||||
let g:syntastic_racket_code_ayatollah_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -44,8 +48,6 @@ function! SyntaxCheckers_racket_code_ayatollah_GetLocList() dict
|
||||
let e['col'] += 1
|
||||
endfor
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
|
48
sources_non_forked/syntastic/syntax_checkers/sh/bashate.vim
Normal file
48
sources_non_forked/syntastic/syntax_checkers/sh/bashate.vim
Normal file
@ -0,0 +1,48 @@
|
||||
"============================================================================
|
||||
"File: bashate.vim
|
||||
"Description: Bash script style checking plugin for syntastic.vim
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists("g:loaded_syntastic_sh_bashate_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_sh_bashate_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_sh_bashate_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
let errorformat =
|
||||
\ '%EE%n: %m,' .
|
||||
\ '%Z - %f: L%l,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style',
|
||||
\ 'returns': [0, 1] })
|
||||
|
||||
for e in loclist
|
||||
let e['text'] = substitute(e['text'], "\\m: '.*", '', '')
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'sh',
|
||||
\ 'name': 'bashate' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sts=4 sw=4:
|
@ -15,13 +15,17 @@ if exists('g:loaded_syntastic_tex_chktex_checker')
|
||||
endif
|
||||
let g:loaded_syntastic_tex_chktex_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if !exists('g:syntastic_tex_chktex_showmsgs')
|
||||
let g:syntastic_tex_chktex_showmsgs = 1
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_tex_chktex_sort')
|
||||
let g:syntastic_tex_chktex_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_tex_chktex_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({ 'args_after': '-q -v1' })
|
||||
|
||||
@ -32,14 +36,10 @@ function! SyntaxCheckers_tex_chktex_GetLocList() dict
|
||||
\ '%Z%p^,' .
|
||||
\ '%-G%.%#'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style' })
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
@ -15,6 +15,10 @@ if exists("g:loaded_syntastic_text_atdtool_checker")
|
||||
endif
|
||||
let g:loaded_syntastic_text_atdtool_checker = 1
|
||||
|
||||
if !exists('g:syntastic_text_atdtool_sort')
|
||||
let g:syntastic_text_atdtool_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -44,8 +48,6 @@ function! SyntaxCheckers_text_atdtool_GetLocList() dict
|
||||
let e['text'] = substitute(e['text'], '\m\n\s\+', ' | ', 'g')
|
||||
endfor
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
|
@ -9,6 +9,10 @@ if exists("g:loaded_syntastic_typescript_tsc_checker")
|
||||
endif
|
||||
let g:loaded_syntastic_typescript_tsc_checker = 1
|
||||
|
||||
if !exists('g:syntastic_typescript_tsc_sort')
|
||||
let g:syntastic_typescript_tsc_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -23,14 +27,10 @@ function! SyntaxCheckers_typescript_tsc_GetLocList() dict
|
||||
\ '%Eerror %m,' .
|
||||
\ '%C%\s%\+%m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'defaults': {'bufnr': bufnr("")} })
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
@ -9,6 +9,10 @@ if exists("g:loaded_syntastic_typescript_tslint_checker")
|
||||
endif
|
||||
let g:loaded_syntastic_typescript_tslint_checker = 1
|
||||
|
||||
if !exists('g:syntastic_typescript_tslint_sort')
|
||||
let g:syntastic_typescript_tslint_sort = 1
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@ -25,15 +29,11 @@ function! SyntaxCheckers_typescript_tslint_GetLocList() dict
|
||||
" (comment-format) ts/app.ts[12, 36]: comment must start with lowercase letter
|
||||
let errorformat = '%f[%l\, %c]: %m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'preprocess': 'tslint',
|
||||
\ 'returns': [0, 2] })
|
||||
|
||||
call self.setWantSort(1)
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
@ -29,7 +29,7 @@ set cpo&vim
|
||||
|
||||
" TODO: join this with html.vim DRY's sake?
|
||||
function! s:TidyEncOptByFenc()
|
||||
let tidy_opts = {
|
||||
let TIDY_OPTS = {
|
||||
\ 'utf-8': '-utf8',
|
||||
\ 'ascii': '-ascii',
|
||||
\ 'latin1': '-latin1',
|
||||
@ -43,7 +43,7 @@ function! s:TidyEncOptByFenc()
|
||||
\ 'sjis': '-shiftjis',
|
||||
\ 'cp850': '-ibm858',
|
||||
\ }
|
||||
return get(tidy_opts, &fileencoding, '-utf8')
|
||||
return get(TIDY_OPTS, &fileencoding, '-utf8')
|
||||
endfunction
|
||||
|
||||
function! s:IgnoreError(text)
|
||||
|
Reference in New Issue
Block a user