From 2fd1b4a7c428326b55a62e932b7d8db9304bcbc0 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 15 Aug 2013 12:23:04 +0300 Subject: [PATCH 1/9] Update errorformat for typescript/tsc. --- syntax_checkers/typescript/tsc.vim | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index 78469822..a5587900 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 "============================================================================ @@ -21,11 +21,17 @@ function! SyntaxCheckers_typescript_tsc_GetLocList() \ 'filetype': 'typescript', \ 'subchecker': 'tsc' }) - let errorformat = '%f %#(%l\,%c): %m' + let errorformat = + \ '%f %#(%l\,%c): error %m,' . + \ '%f %#(%l\,%c): %m,' . + \ '%Eerror %m,' . + \ '%C %m' return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")}, + \ 'postprocess': ['sort'] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From fab79e3ff662457a962c385dc789e61422d58902 Mon Sep 17 00:00:00 2001 From: Sebastien Badia Date: Thu, 15 Aug 2013 17:27:17 +0200 Subject: [PATCH 2/9] [issue-767] Remove backslash in puppet-lint log format (refs: #767) --- syntax_checkers/puppet/puppetlint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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' }) From 205dc0b16896a8fcc43d330640914253af5c992e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 15 Aug 2013 20:30:06 +0300 Subject: [PATCH 3/9] Minor bug fix: setting checker names in CacheErrors(). --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index fb788a3b..3af2204b 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 From 40229b12552021e0f1b9d0c5d68ac742d60ea517 Mon Sep 17 00:00:00 2001 From: Marc Bryan Date: Thu, 15 Aug 2013 11:41:49 -0600 Subject: [PATCH 4/9] Add pep257 Python syntax_checker --- syntax_checkers/python/pep257.vim | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 syntax_checkers/python/pep257.vim diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim new file mode 100644 index 00000000..52fbc1ea --- /dev/null +++ b/syntax_checkers/python/pep257.vim @@ -0,0 +1,39 @@ +"============================================================================ +"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 + +function! SyntaxCheckers_python_pep257_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'pep257', + \ 'filetype': 'python', + \ 'subchecker': 'pep257' }) + + let errorformat = '%f:%l:%c: %m' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style' }) + + for n in range(len(loclist)) + let loclist[n]['type'] = loclist[n]['text'] =~? '^W' ? 'W' : 'E' + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'python', + \ 'name': 'pep257'}) From e6482164f89c9cf7916646fead237a3841ff2461 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 15 Aug 2013 21:24:57 +0300 Subject: [PATCH 5/9] Fix setting title of the error window. Sadly this is slow. --- plugin/syntastic/loclist.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 From 9e5319c9a161a6987ba789bfc6750f346e46d5c4 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 15 Aug 2013 21:41:50 +0300 Subject: [PATCH 6/9] More fiddling with typescript/tsc errorformat and args. --- syntax_checkers/typescript/tsc.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index a5587900..c91833be 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -17,13 +17,14 @@ 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): error %m,' . - \ '%f %#(%l\,%c): %m,' . + \ '%E%f %#(%l\,%c): error %m,' . + \ '%E%f %#(%l\,%c): %m,' . \ '%Eerror %m,' . \ '%C %m' From 39dabc88afe675e4e0c7b3c8dab8cdaacaa934f8 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 15 Aug 2013 23:00:48 +0300 Subject: [PATCH 7/9] Yet more typescript/tsc errorformat contortions. --- syntax_checkers/typescript/tsc.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index c91833be..768dc4e0 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -26,7 +26,7 @@ function! SyntaxCheckers_typescript_tsc_GetLocList() \ '%E%f %#(%l\,%c): error %m,' . \ '%E%f %#(%l\,%c): %m,' . \ '%Eerror %m,' . - \ '%C %m' + \ '%C%\s%\+%m' return SyntasticMake({ \ 'makeprg': makeprg, From 81e2e20892704189c3b3ce3f1f9359b0bb3193fc Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 16 Aug 2013 01:31:22 +0300 Subject: [PATCH 8/9] Bug fix: split checker output into lines before preprocessing. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 3af2204b..20bf7ac3 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -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 From 7dba68cffb21b20a19a03fe59ee9b05114359a2c Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 16 Aug 2013 01:36:40 +0300 Subject: [PATCH 9/9] Cleanup the python/pep257 checker. --- syntax_checkers/python/pep257.vim | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim index 52fbc1ea..9d2b64d9 100644 --- a/syntax_checkers/python/pep257.vim +++ b/syntax_checkers/python/pep257.vim @@ -8,27 +8,38 @@ if exists("g:loaded_syntastic_python_pep257_checker") finish endif -let g:loaded_syntastic_python_pep257_checker=1 +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 = '%f:%l:%c: %m' + 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' }) + \ '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]['type'] = loclist[n]['text'] =~? '^W' ? 'W' : 'E' + let loclist[n]['col'] = get(loclist[n], 'col', 0) + 1 endfor return loclist