From 1621c77e1d47bd919b065c662a8a271fdb4009fe Mon Sep 17 00:00:00 2001 From: micbou Date: Sun, 14 May 2017 14:26:01 +0200 Subject: [PATCH] Improve reparse requirement on buffer visit --- autoload/youcompleteme.vim | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 332928e3..4ed7fe45 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -345,7 +345,11 @@ function! s:AllowedToCompleteInBuffer( buffer ) \ has_key( g:ycm_filetype_whitelist, 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 @@ -355,15 +359,11 @@ endfunction function! s:VisitedBufferRequiresReparse() - if !s:AllowedToCompleteInCurrentBuffer() + if bufnr( '%' ) ==# s:previous_allowed_buffer_number return 0 endif - if bufnr( '' ) ==# s:previous_allowed_buffer_number - return 0 - endif - let s:previous_allowed_buffer_number = bufnr( '' ) - return 1 + return s:AllowedToCompleteInCurrentBuffer() endfunction