C-family filetypes now Syntastic passive mode
This is needed so that Syntastic doesn't call :SyntasticCheck (and thus YCM code) on file save unnecessarily. We call :SyntasticCheck ourselves often enough.
This commit is contained in:
parent
9734c473e2
commit
38f571db1f
@ -71,10 +71,7 @@ function! youcompleteme#Enable()
|
|||||||
call s:SetUpKeyMappings()
|
call s:SetUpKeyMappings()
|
||||||
|
|
||||||
if g:ycm_register_as_syntastic_checker
|
if g:ycm_register_as_syntastic_checker
|
||||||
call s:ForceSyntasticCFamilyChecker()
|
call s:TweakSyntasticOptions()
|
||||||
" We set this to work around segfaults in old versions of Vim
|
|
||||||
" See here for details: https://github.com/scrooloose/syntastic/issues/834
|
|
||||||
let g:syntastic_delayed_redraws = 1
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:ycm_allow_changing_updatetime
|
if g:ycm_allow_changing_updatetime
|
||||||
@ -176,8 +173,18 @@ function! s:SetUpBackwardsCompatibility()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:TweakSyntasticOptions()
|
||||||
|
call s:ForceCFamilyFiletypesSyntasticPassiveMode()
|
||||||
|
call s:ForceSyntasticCFamilyChecker()
|
||||||
|
|
||||||
|
" We set this to work around segfaults in old versions of Vim
|
||||||
|
" See here for details: https://github.com/scrooloose/syntastic/issues/834
|
||||||
|
let g:syntastic_delayed_redraws = 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Needed so that YCM is used as the syntastic checker
|
||||||
function! s:ForceSyntasticCFamilyChecker()
|
function! s:ForceSyntasticCFamilyChecker()
|
||||||
" Needed so that YCM is used as the syntastic checker
|
|
||||||
let g:syntastic_cpp_checkers = ['ycm']
|
let g:syntastic_cpp_checkers = ['ycm']
|
||||||
let g:syntastic_c_checkers = ['ycm']
|
let g:syntastic_c_checkers = ['ycm']
|
||||||
let g:syntastic_objc_checkers = ['ycm']
|
let g:syntastic_objc_checkers = ['ycm']
|
||||||
@ -185,6 +192,16 @@ function! s:ForceSyntasticCFamilyChecker()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Needed so that Syntastic doesn't call :SyntasticCheck (and thus YCM code) on
|
||||||
|
" file save unnecessarily. We call :SyntasticCheck ourselves often enough.
|
||||||
|
function! s:ForceCFamilyFiletypesSyntasticPassiveMode()
|
||||||
|
let mode_map = get( g:, 'syntastic_mode_map', {} )
|
||||||
|
let mode_map.passive_filetypes = get( mode_map, 'passive_filetypes', [] ) +
|
||||||
|
\ ['cpp', 'c', 'objc', 'objcpp']
|
||||||
|
let g:syntastic_mode_map = mode_map
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:ForcedAsSyntasticCheckerForCurrentFiletype()
|
function! s:ForcedAsSyntasticCheckerForCurrentFiletype()
|
||||||
return g:ycm_register_as_syntastic_checker &&
|
return g:ycm_register_as_syntastic_checker &&
|
||||||
\ get( s:forced_syntastic_checker_for, &filetype, 0 )
|
\ get( s:forced_syntastic_checker_for, &filetype, 0 )
|
||||||
|
Loading…
Reference in New Issue
Block a user