Merge branch 'C#MultipleOmniSharps' of https://github.com/mispencer/YouCompleteMe into multiple_sln

Conflicts:
	python/ycm/completers/cs/cs_completer.py
This commit is contained in:
Chiel92 2013-07-19 11:55:25 +02:00
commit a56041156e
2 changed files with 17 additions and 2 deletions

View File

@ -161,6 +161,8 @@ let g:ycm_csharp_server_stderr_logfile_format =
let g:ycm_csharp_server_stdout_logfile_format =
\ get( g:, 'ycm_csharp_server_stdout_logfile_format', '' )
let g:ycm_find_free_port_for_csharp_server =
\ get( g:, 'ycm_find_free_port_for_csharp_server', 1 )
" On-demand loading. Let's use the autoload folder and not slow down vim's
" startup procedure.

View File

@ -44,7 +44,11 @@ class CsharpCompleter( ThreadedCompleter ):
super( CsharpCompleter, self ).__init__()
self._omnisharp_port = int( vimsupport.GetVariableValue(
'g:ycm_csharp_server_port' ) )
self._omnisharp_host = 'http://localhost:' + str( self._omnisharp_port )
self._RefreshOmniSharpHost()
if vimsupport.GetBoolValue( 'g:ycm_find_free_port_for_csharp_server' ):
self._FindFreePort()
if vimsupport.GetBoolValue( 'g:ycm_auto_start_csharp_server' ):
self._StartServer()
@ -112,7 +116,6 @@ class CsharpCompleter( ThreadedCompleter ):
vimsupport.PostVimMessage( 'OmniSharp not started' )
return
else:
#>>>MERGED
solutionfile = solutionfiles[ choice ]
omnisharp = os.path.join(
@ -149,6 +152,7 @@ class CsharpCompleter( ThreadedCompleter ):
vimsupport.PostVimMessage( 'Starting OmniSharp server')
def _StopServer( self ):
""" Stop the OmniSharp server """
self._GetResponse( '/stopserver' )
@ -159,6 +163,15 @@ class CsharpCompleter( ThreadedCompleter ):
""" Check if the OmniSharp server is running """
return self._GetResponse( '/checkalivestatus', silent=True ) != None
def _FindFreePort( self ):
while self._ServerIsRunning():
self._omnisharp_port += 1
self._RefreshOmniSharpHost()
def _RefreshOmniSharpHost ( self ):
self._omnisharp_host = 'http://localhost:' + str( self._omnisharp_port )
def _GetCompletions( self ):
""" Ask server for completions """