diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index fb788a3b..20bf7ac3 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -214,8 +214,8 @@ function! s:CacheErrors(...) if !empty(names) if len(syntastic#util#unique(map(copy(names), 'v:val[1]'))) == 1 - let name = join(map(names, 'v:val[0]'), ', ') let type = names[0][1] + let name = join(map(names, 'v:val[0]'), ', ') call newLoclist.setName( name . ' ('. type . ')' ) else " checkers from mixed types @@ -388,7 +388,7 @@ function! SyntasticMake(options) let $LC_MESSAGES = 'C' let $LC_ALL = '' - let err_lines = system(a:options['makeprg']) + let err_lines = split(system(a:options['makeprg']), "\n", 1) let $LC_ALL = old_lc_all let $LC_MESSAGES = old_lc_messages diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 104470dc..f1f34eb6 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -157,11 +157,17 @@ function! g:SyntasticLoclist.show() endif " try to find the loclist window and set w:quickfix_title + let errors = getloclist(0) for buf in tabpagebuflist() if buflisted(buf) && bufloaded(buf) && getbufvar(buf, '&buftype') ==# 'quickfix' let win = bufwinnr(buf) let title = getwinvar(win, 'quickfix_title') - if title ==# ':setloclist()' || strpart(title, 0, 16) ==# ':SyntasticCheck ' + + " TODO: try to make sure we actually own this window; sadly, + " errors == getloclist(0) is the only somewhat safe way to + " achieve that + if strpart(title, 0, 16) ==# ':SyntasticCheck ' || + \ ( (title == '' || title ==# ':setloclist()') && errors == getloclist(0) ) call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name) endif endif diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index c65e601b..14afd8c6 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -31,7 +31,7 @@ endfunction function! SyntaxCheckers_puppet_puppetlint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'puppet-lint', - \ 'post_args': '--log-format "\%{KIND} [\%{check}] \%{message} at \%{fullpath}:\%{linenumber}"', + \ 'post_args': '--log-format "%{KIND} [%{check}] %{message} at %{fullpath}:%{linenumber}"', \ 'filetype': 'puppet', \ 'subchecker': 'puppetlint' }) diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim new file mode 100644 index 00000000..9d2b64d9 --- /dev/null +++ b/syntax_checkers/python/pep257.vim @@ -0,0 +1,50 @@ +"============================================================================ +"File: pep257.vim +"Description: Docstring style checking plugin for syntastic.vim +"============================================================================ +" +" For details about pep257 see: https://github.com/GreenSteam/pep257 + +if exists("g:loaded_syntastic_python_pep257_checker") + finish +endif +let g:loaded_syntastic_python_pep257_checker = 1 + +function! SyntaxCheckers_python_pep257_IsAvailable() + return executable('pep257') +endfunction + +" sanity: kill empty lines here rather than munging errorformat +function! SyntaxCheckers_python_pep257_Preprocess(errors) + return filter(copy(a:errors), 'v:val != ""') +endfunction + +function! SyntaxCheckers_python_pep257_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'pep257', + \ 'filetype': 'python', + \ 'subchecker': 'pep257' }) + + let errorformat = + \ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' . + \ '%E%f:%l:%c: %m,' . + \ '%+C %m' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style', + \ 'preprocess': 'SyntaxCheckers_python_pep257_Preprocess', + \ 'postprocess': ['compressWhitespace'] }) + + " pep257 outputs byte offsets rather than column numbers + for n in range(len(loclist)) + let loclist[n]['col'] = get(loclist[n], 'col', 0) + 1 + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'python', + \ 'name': 'pep257'}) diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index 78469822..768dc4e0 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -1,6 +1,6 @@ "============================================================================ "File: typescript.vim -"Description: TypeScript syntax checker. For TypeScript v0.8.0 +"Description: TypeScript syntax checker "Maintainer: Bill Casarin "============================================================================ @@ -17,15 +17,22 @@ endfunction function! SyntaxCheckers_typescript_tsc_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'tsc', + \ 'args': '--module commonjs', \ 'post_args': '--out ' . syntastic#util#DevNull(), \ 'filetype': 'typescript', \ 'subchecker': 'tsc' }) - let errorformat = '%f %#(%l\,%c): %m' + let errorformat = + \ '%E%f %#(%l\,%c): error %m,' . + \ '%E%f %#(%l\,%c): %m,' . + \ '%Eerror %m,' . + \ '%C%\s%\+%m' return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")}, + \ 'postprocess': ['sort'] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({