From 5cd560c021438660e62f286e31c2eec91f9364f6 Mon Sep 17 00:00:00 2001 From: micbou Date: Thu, 20 Jul 2017 13:38:13 +0200 Subject: [PATCH] Check completefunc when forcing semantic completion Vim returns an error when forcing semantic completion and the completefunc is not set. --- autoload/youcompleteme.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 566a0c8a..d872a62c 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -706,10 +706,13 @@ endfunction function! s:InvokeSemanticCompletion() - let s:force_semantic = 1 - exec s:python_command "ycm_state.SendCompletionRequest( True )" + if &completefunc == "youcompleteme#CompleteFunc" + let s:force_semantic = 1 + exec s:python_command "ycm_state.SendCompletionRequest( True )" + + call s:PollCompletion() + endif - call s:PollCompletion() " Since this function is called in a mapping through the expression register " =, its return value is inserted (see :h c_CTRL-R_=). We don't want to " insert anything so we return an empty string.