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()
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
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
if !s:SetUpPython()
return
endif
py from ycm.youcompleteme import YouCompleteMe
py ycm_state = YouCompleteMe( user_options_store.GetAll() )
call s:SetUpCpoptions()
call s:SetUpCompleteopt()
call s:SetUpKeyMappings()
@ -110,6 +92,33 @@ function! youcompleteme#Enable()
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()
" 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

View File

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

View File

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

View File

@ -41,7 +41,7 @@ FILE_TOO_SHORT_MESSAGE = (
NO_DIAGNOSTIC_MESSAGE = 'No diagnostic for current line!'
PATH_TO_OMNISHARP_BINARY = os.path.join(
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

View File

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

View File

@ -209,11 +209,11 @@ def PathToNearestThirdPartyFolder( path ):
return None
def AddThirdPartyFoldersToSysPath():
path_to_third_party = PathToNearestThirdPartyFolder( __file__ )
def AddNearestThirdPartyFoldersToSysPath( filepath ):
path_to_third_party = PathToNearestThirdPartyFolder( filepath )
if not path_to_third_party:
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 ):
sys.path.insert( 0, os.path.realpath( os.path.join( path_to_third_party,