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