Skip to content

Commit

Permalink
Merge pull request #99 from jpernst/master
Browse files Browse the repository at this point in the history
Add support for new error format
  • Loading branch information
steveklabnik committed Sep 30, 2016
2 parents fc11d02 + 4dd6704 commit 2030019
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
8 changes: 7 additions & 1 deletion compiler/cargo.vim
Expand Up @@ -27,7 +27,13 @@ function! s:is_absolute(path)
return a:path[0] == '/' || a:path =~ '[A-Z]\+:'
endfunction

CompilerSet errorformat+=%-G%\\s%#Compiling%.%#
" Ignore general cargo progress messages
CompilerSet errorformat+=
\%-G%\\s%#Downloading%.%#,
\%-G%\\s%#Compiling%.%#,
\%-G%\\s%#Finished%.%#,
\%-G%\\s%#error:\ Could\ not\ compile\ %.%#,
\%-G%\\s%#To\ learn\ more\\,%.%#

let s:local_manifest = findfile(s:cargo_manifest_name, '.;')
if s:local_manifest != ''
Expand Down
12 changes: 12 additions & 0 deletions compiler/rustc.vim
Expand Up @@ -21,6 +21,7 @@ else
CompilerSet makeprg=rustc\ \%
endif

" Old errorformat (before nightly 2016/08/10)
CompilerSet errorformat=
\%f:%l:%c:\ %t%*[^:]:\ %m,
\%f:%l:%c:\ %*\\d:%*\\d\ %t%*[^:]:\ %m,
Expand All @@ -29,5 +30,16 @@ CompilerSet errorformat=
\%-G%*[\ ]^%*[~],
\%-G%*[\ ]...

" New errorformat (after nightly 2016/08/10)
CompilerSet errorformat+=
\%-G,
\%-Gerror:\ aborting\ %.%#,
\%-Gerror:\ Could\ not\ compile\ %.%#,
\%Eerror:\ %m,
\%Eerror[E%n]:\ %m,
\%Wwarning:\ %m,
\%Inote:\ %m,
\%C\ %#-->\ %f:%l:%c

let &cpo = s:cpo_save
unlet s:cpo_save
16 changes: 14 additions & 2 deletions syntax_checkers/rust/rustc.vim
Expand Up @@ -16,11 +16,23 @@ set cpo&vim
function! SyntaxCheckers_rust_rustc_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args': '-Zparse-only' })

" Old errorformat (before nightly 2016/08/10)
let errorformat =
\ '%E%f:%l:%c: %\d%#:%\d%# %.%\{-}error:%.%\{-} %m,' .
\ '%W%f:%l:%c: %\d%#:%\d%# %.%\{-}warning:%.%\{-} %m,' .
\ '%C%f:%l %m,' .
\ '%-Z%.%#'
\ '%C%f:%l %m'

" New errorformat (after nightly 2016/08/10)
let errorformat .=
\ ',' .
\ '%-G,' .
\ '%-Gerror: aborting %.%#,' .
\ '%-Gerror: Could not compile %.%#,' .
\ '%Eerror: %m,' .
\ '%Eerror[E%n]: %m,' .
\ '%Wwarning: %m,' .
\ '%Inote: %m,' .
\ '%C %#--> %f:%l:%c'

return SyntasticMake({
\ 'makeprg': makeprg,
Expand Down

0 comments on commit 2030019

Please sign in to comment.