Fix issue with slow cursor moving in Python
This happened when moving the cursor in normal mode. The problem was that we were calling SyntasticCheck on every cursor move because YCM would think that the FileReadyToParse event processing returned diagnostics... but YCM only integrates with Syntastic for C-family files. Fixed by only triggering SyntasticCheck in C-family files.
This commit is contained in:
parent
afa1afc49b
commit
534f6f57d4
@ -29,6 +29,14 @@ let s:cursor_moved = 0
|
||||
let s:moved_vertically_in_insert_mode = 0
|
||||
let s:previous_num_chars_on_current_line = -1
|
||||
|
||||
let s:forced_syntastic_checker_for = {
|
||||
\ 'cpp': 1,
|
||||
\ 'c': 1,
|
||||
\ 'objc': 1,
|
||||
\ 'objcpp': 1,
|
||||
\ }
|
||||
|
||||
|
||||
function! youcompleteme#Enable()
|
||||
" When vim is in diff mode, don't run
|
||||
if &diff
|
||||
@ -165,6 +173,12 @@ function! s:ForceSyntasticCFamilyChecker()
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:ForcedAsSyntasticCheckerForCurrentFiletype()
|
||||
return g:ycm_register_as_syntastic_checker &&
|
||||
\ get( s:forced_syntastic_checker_for, &filetype, 0 )
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:AllowedToCompleteInCurrentFile()
|
||||
if empty( &filetype ) || getbufvar(winbufnr(winnr()), "&buftype") ==# 'nofile'
|
||||
return 0
|
||||
@ -411,7 +425,7 @@ endfunction
|
||||
function! s:UpdateDiagnosticNotifications()
|
||||
let should_display_diagnostics =
|
||||
\ get( g:, 'loaded_syntastic_plugin', 0 ) &&
|
||||
\ g:ycm_register_as_syntastic_checker &&
|
||||
\ s:ForcedAsSyntasticCheckerForCurrentFiletype() &&
|
||||
\ pyeval( 'ycm_state.NativeFiletypeCompletionUsable()' )
|
||||
|
||||
if !should_display_diagnostics
|
||||
|
Loading…
Reference in New Issue
Block a user