More fixes for separate ycmd

This commit is contained in:
Strahinja Val Markovic 2014-05-14 10:35:49 -07:00
parent 6defe8ccd4
commit a09527b380
6 changed files with 35 additions and 30 deletions

View File

@ -46,28 +46,10 @@ function! youcompleteme#Enable()
call s:SetUpBackwardsCompatibility() call s:SetUpBackwardsCompatibility()
py import sys if !s:SetUpPython()
py import vim
exe 'python sys.path.insert( 0, "' . s:script_folder_path . '/../python" )'
exe 'python sys.path.insert( 0, "' . s:script_folder_path .
\ '/../third_party/ycmd" )'
py from ycmd import utils
py utils.AddThirdPartyFoldersToSysPath()
py from ycm import base
py base.LoadJsonDefaultsIntoVim()
py from ycmd import user_options_store
py user_options_store.SetAll( base.BuildServerConf() )
if !pyeval( 'base.CompatibleWithYcmCore()')
echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: YCM support libs too old, PLEASE RECOMPILE" |
\ echohl None
return return
endif endif
py from ycm.youcompleteme import YouCompleteMe
py ycm_state = YouCompleteMe( user_options_store.GetAll() )
call s:SetUpCpoptions() call s:SetUpCpoptions()
call s:SetUpCompleteopt() call s:SetUpCompleteopt()
call s:SetUpKeyMappings() call s:SetUpKeyMappings()
@ -110,6 +92,33 @@ function! youcompleteme#Enable()
endfunction endfunction
function! s:SetUpPython()
py import sys
py import vim
exe 'python sys.path.insert( 0, "' . s:script_folder_path . '/../python" )'
exe 'python sys.path.insert( 0, "' . s:script_folder_path .
\ '/../third_party/ycmd" )'
py from ycmd import utils
exe 'py utils.AddNearestThirdPartyFoldersToSysPath("'
\ . s:script_folder_path . '")'
py from ycm import base
py base.LoadJsonDefaultsIntoVim()
py from ycmd import user_options_store
py user_options_store.SetAll( base.BuildServerConf() )
if !pyeval( 'base.CompatibleWithYcmCore()')
echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: YCM support libs too old, PLEASE RECOMPILE" |
\ echohl None
return 0
endif
py from ycm.youcompleteme import YouCompleteMe
py ycm_state = YouCompleteMe( user_options_store.GetAll() )
return 1
endfunction
function! s:SetUpKeyMappings() function! s:SetUpKeyMappings()
" The g:ycm_key_select_completion and g:ycm_key_previous_completion used to " The g:ycm_key_select_completion and g:ycm_key_previous_completion used to
" exist and are now here purely for the sake of backwards compatibility; we " exist and are now here purely for the sake of backwards compatibility; we

View File

@ -175,9 +175,7 @@ if $omnisharp_completer; then
fi fi
fi fi
# TODO: change to the following when omnisharp in own third_party: build_dir=$SCRIPT_DIR"/third_party/OmniSharpServer"
# $SCRIPT_DIR"/third_party/OmniSharpServer"
build_dir=$SCRIPT_DIR"/../OmniSharpServer"
cd $build_dir cd $build_dir
$buildcommand $buildcommand

View File

@ -36,9 +36,7 @@ fi
EXTRA_CMAKE_ARGS=$extra_cmake_args YCM_TESTRUN=1 \ EXTRA_CMAKE_ARGS=$extra_cmake_args YCM_TESTRUN=1 \
$SCRIPT_DIR/build.sh --omnisharp-completer $SCRIPT_DIR/build.sh --omnisharp-completer
# TODO: change to the following when we have own third_party: for directory in $SCRIPT_DIR/third_party/*; do
# $SCRIPT_DIR/third_party/*
for directory in $SCRIPT_DIR/../*; do
if [ -d "${directory}" ]; then if [ -d "${directory}" ]; then
export PYTHONPATH=${directory}:$PYTHONPATH export PYTHONPATH=${directory}:$PYTHONPATH
fi fi

View File

@ -41,7 +41,7 @@ FILE_TOO_SHORT_MESSAGE = (
NO_DIAGNOSTIC_MESSAGE = 'No diagnostic for current line!' NO_DIAGNOSTIC_MESSAGE = 'No diagnostic for current line!'
PATH_TO_OMNISHARP_BINARY = os.path.join( PATH_TO_OMNISHARP_BINARY = os.path.join(
os.path.abspath( os.path.dirname( __file__ ) ), os.path.abspath( os.path.dirname( __file__ ) ),
'../../../../OmniSharpServer/OmniSharp/bin/Debug/OmniSharp.exe' ) '../../../third_party/OmniSharpServer/OmniSharp/bin/Debug/OmniSharp.exe' )
#TODO: Handle this better than dummy classes #TODO: Handle this better than dummy classes

View File

@ -26,4 +26,4 @@ def SetUpPythonPath():
'..' ) ) '..' ) )
from ycmd import utils from ycmd import utils
utils.AddThirdPartyFoldersToSysPath() utils.AddNearestThirdPartyFoldersToSysPath( __file__ )

View File

@ -209,11 +209,11 @@ def PathToNearestThirdPartyFolder( path ):
return None return None
def AddThirdPartyFoldersToSysPath(): def AddNearestThirdPartyFoldersToSysPath( filepath ):
path_to_third_party = PathToNearestThirdPartyFolder( __file__ ) path_to_third_party = PathToNearestThirdPartyFolder( filepath )
if not path_to_third_party: if not path_to_third_party:
raise RuntimeError( raise RuntimeError(
'No third_party folder found for: {0}'.format( __file__) ) 'No third_party folder found for: {0}'.format( filepath ) )
for folder in os.listdir( path_to_third_party ): for folder in os.listdir( path_to_third_party ):
sys.path.insert( 0, os.path.realpath( os.path.join( path_to_third_party, sys.path.insert( 0, os.path.realpath( os.path.join( path_to_third_party,