mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Update rust.vim from deprecated repo to rust-lang repo and add to update_plugins.py (#410)
This commit is contained in:
53
sources_non_forked/rust.vim/syntax_checkers/rust/cargo.vim
Normal file
53
sources_non_forked/rust.vim/syntax_checkers/rust/cargo.vim
Normal file
@ -0,0 +1,53 @@
|
||||
" Vim syntastic plugin
|
||||
" Language: Rust
|
||||
" Maintainer: Julien Levesy <jlevesy@gmail.com>
|
||||
"
|
||||
" See for details on how to add an external Syntastic checker:
|
||||
" https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide#external
|
||||
|
||||
if exists("g:loaded_syntastic_rust_cargo_checker")
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_syntastic_rust_cargo_checker = 1
|
||||
|
||||
" Force syntastic to call cargo without a specific file name
|
||||
let g:syntastic_rust_cargo_fname = ""
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_rust_cargo_IsAvailable() dict
|
||||
return executable(self.getExec()) &&
|
||||
\ syntastic#util#versionIsAtLeast(self.getVersion(), [0, 16, 0])
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_rust_cargo_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({ "args": "check" })
|
||||
|
||||
" Ignored patterns, and blank lines
|
||||
let errorformat =
|
||||
\ '%-G,' .
|
||||
\ '%-Gerror: aborting %.%#,' .
|
||||
\ '%-Gerror: Could not compile %.%#,'
|
||||
|
||||
" Meaningful lines (errors, notes, warnings, contextual information)
|
||||
let errorformat .=
|
||||
\ '%Eerror: %m,' .
|
||||
\ '%Eerror[E%n]: %m,' .
|
||||
\ '%Wwarning: %m,' .
|
||||
\ '%Inote: %m,' .
|
||||
\ '%C %#--> %f:%l:%c'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'cwd': expand('%:p:h'),
|
||||
\ 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'rust',
|
||||
\ 'name': 'cargo'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
@ -14,13 +14,26 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_rust_rustc_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({ 'args': '-Zparse-only' })
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
" 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,' .
|
||||
\ '%-Gwarning: the option `Z` is unstable %.%#,' .
|
||||
\ '%Wwarning: %m,' .
|
||||
\ '%Inote: %m,' .
|
||||
\ '%C %#--> %f:%l:%c'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
|
Reference in New Issue
Block a user