Don't set omnifunc when not allowed

This commit is contained in:
Boris Staletic 2016-11-09 16:20:23 +01:00
parent 4f2494e87e
commit 30def5d246

View File

@ -108,9 +108,7 @@ function! youcompleteme#Enable()
if s:defer_omnifunc
augroup ycm_defer_omnifunc
autocmd!
autocmd InsertEnter * call s:SetOmnicompleteFunc()
\ | let s:defer_omnifunc = 0
\ | autocmd! ycm_defer_omnifunc
autocmd InsertEnter * call s:DeferredUntilInsertEnter()
augroup END
endif
@ -121,6 +119,14 @@ function! youcompleteme#Enable()
call s:OnBufferRead()
endfunction
function s:DeferredUntilInsertEnter()
let s:defer_omnifunc = 0
autocmd! ycm_defer_omnifunc
if s:AllowedToCompleteInCurrentFile()
call s:SetOmnicompleteFunc()
endif
endfunction
function! youcompleteme#EnableCursorMovedAutocommands()
augroup ycmcompletemecursormove