Improve reparse requirement on buffer visit

This commit is contained in:
micbou 2017-05-14 14:26:01 +02:00
parent 5a806dcb30
commit 1621c77e1d
No known key found for this signature in database
GPG Key ID: C7E8FD1F3BDA1E05

View File

@ -345,7 +345,11 @@ function! s:AllowedToCompleteInBuffer( buffer )
\ has_key( g:ycm_filetype_whitelist, buffer_filetype ) \ has_key( g:ycm_filetype_whitelist, buffer_filetype )
let blacklist_allows = !has_key( g:ycm_filetype_blacklist, buffer_filetype ) let blacklist_allows = !has_key( g:ycm_filetype_blacklist, buffer_filetype )
return whitelist_allows && blacklist_allows let allowed = whitelist_allows && blacklist_allows
if allowed
let s:previous_allowed_buffer_number = bufnr( a:buffer )
endif
return allowed
endfunction endfunction
@ -355,15 +359,11 @@ endfunction
function! s:VisitedBufferRequiresReparse() function! s:VisitedBufferRequiresReparse()
if !s:AllowedToCompleteInCurrentBuffer() if bufnr( '%' ) ==# s:previous_allowed_buffer_number
return 0 return 0
endif endif
if bufnr( '' ) ==# s:previous_allowed_buffer_number return s:AllowedToCompleteInCurrentBuffer()
return 0
endif
let s:previous_allowed_buffer_number = bufnr( '' )
return 1
endfunction endfunction