Now checking ycm_core version for compatibility
This commit is contained in:
parent
d9c5eead30
commit
ad8345aa35
@ -37,6 +37,20 @@ function! youcompleteme#Enable()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
py import sys
|
||||||
|
py import vim
|
||||||
|
exe 'python sys.path.insert( 0, "' . s:script_folder_path . '/../python" )'
|
||||||
|
py import ycm
|
||||||
|
|
||||||
|
if !pyeval( 'ycm.CompatibleWithYcmCore()')
|
||||||
|
echohl WarningMsg |
|
||||||
|
\ echomsg "YouCompleteMe unavailable, ycm_core too old, PLEASE RECOMPILE" |
|
||||||
|
\ echohl None
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
py ycm_state = ycm.YouCompleteMe()
|
||||||
|
|
||||||
augroup youcompleteme
|
augroup youcompleteme
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd CursorMovedI * call s:OnCursorMovedInsertMode()
|
autocmd CursorMovedI * call s:OnCursorMovedInsertMode()
|
||||||
@ -60,12 +74,6 @@ function! youcompleteme#Enable()
|
|||||||
set ut=2000
|
set ut=2000
|
||||||
endif
|
endif
|
||||||
|
|
||||||
py import sys
|
|
||||||
py import vim
|
|
||||||
exe 'python sys.path.insert( 0, "' . s:script_folder_path . '/../python" )'
|
|
||||||
py import ycm
|
|
||||||
py ycm_state = ycm.YouCompleteMe()
|
|
||||||
|
|
||||||
" Calling this once solves the problem of BufRead/BufEnter not triggering for
|
" Calling this once solves the problem of BufRead/BufEnter not triggering for
|
||||||
" the first loaded file. This should be the last command executed in this
|
" the first loaded file. This should be the last command executed in this
|
||||||
" function!
|
" function!
|
||||||
@ -477,7 +485,7 @@ function! s:ForceCompile()
|
|||||||
if !pyeval( 'ycm_state.NativeFiletypeCompletionUsable()' )
|
if !pyeval( 'ycm_state.NativeFiletypeCompletionUsable()' )
|
||||||
echom "Native filetype completion not supported for current file, "
|
echom "Native filetype completion not supported for current file, "
|
||||||
\ . "cannot force recompilation."
|
\ . "cannot force recompilation."
|
||||||
return
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
echom "Forcing compilation, this will block Vim until done."
|
echom "Forcing compilation, this will block Vim until done."
|
||||||
|
@ -41,6 +41,13 @@ bool HasClangSupport()
|
|||||||
#endif // USE_CLANG_COMPLETER
|
#endif // USE_CLANG_COMPLETER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int YcmCoreVersion()
|
||||||
|
{
|
||||||
|
// We increment this every time when we want to force users to recompile
|
||||||
|
// ycm_core.
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOST_PYTHON_MODULE(ycm_core)
|
BOOST_PYTHON_MODULE(ycm_core)
|
||||||
{
|
{
|
||||||
@ -49,6 +56,7 @@ BOOST_PYTHON_MODULE(ycm_core)
|
|||||||
|
|
||||||
def( "HasClangSupport", HasClangSupport );
|
def( "HasClangSupport", HasClangSupport );
|
||||||
def( "FilterAndSortCandidates", FilterAndSortCandidates );
|
def( "FilterAndSortCandidates", FilterAndSortCandidates );
|
||||||
|
def( "YcmCoreVersion", YcmCoreVersion );
|
||||||
|
|
||||||
class_< IdentifierCompleter, boost::noncopyable >( "IdentifierCompleter" )
|
class_< IdentifierCompleter, boost::noncopyable >( "IdentifierCompleter" )
|
||||||
.def( "EnableThreading", &IdentifierCompleter::EnableThreading )
|
.def( "EnableThreading", &IdentifierCompleter::EnableThreading )
|
||||||
|
@ -33,6 +33,7 @@ except ImportError, e:
|
|||||||
'the docs. Full error: {1}'.format(
|
'the docs. Full error: {1}'.format(
|
||||||
os.path.dirname( os.path.abspath( __file__ ) ), str( e ) ) )
|
os.path.dirname( os.path.abspath( __file__ ) ), str( e ) ) )
|
||||||
|
|
||||||
|
|
||||||
from completers.all.identifier_completer import IdentifierCompleter
|
from completers.all.identifier_completer import IdentifierCompleter
|
||||||
from completers.all.omni_completer import OmniCompleter
|
from completers.all.omni_completer import OmniCompleter
|
||||||
|
|
||||||
@ -237,3 +238,13 @@ def CurrentIdentifierFinished():
|
|||||||
return line[ : current_column ].isspace()
|
return line[ : current_column ].isspace()
|
||||||
|
|
||||||
|
|
||||||
|
COMPATIBLE_WITH_CORE_VERSION = 1
|
||||||
|
|
||||||
|
def CompatibleWithYcmCore():
|
||||||
|
try:
|
||||||
|
current_core_version = ycm_core.YcmCoreVersion()
|
||||||
|
except AttributeError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return current_core_version == COMPATIBLE_WITH_CORE_VERSION
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user