ServerIsRunning fixed and variable defaults set

This commit is contained in:
Chiel92 2013-07-08 11:22:17 +02:00
parent 34c24129d2
commit 6ec038870b
3 changed files with 10 additions and 7 deletions

2
.gitmodules vendored
View File

@ -3,4 +3,4 @@
url = https://github.com/davidhalter/jedi.git url = https://github.com/davidhalter/jedi.git
[submodule "python/ycm/completers/cs/OmniSharpServer"] [submodule "python/ycm/completers/cs/OmniSharpServer"]
path = python/ycm/completers/cs/OmniSharpServer path = python/ycm/completers/cs/OmniSharpServer
url = https://github.com/nosami/OmniSharpServer.git url = https://github.com/Chiel92/OmniSharpServer.git

View File

@ -151,6 +151,9 @@ let g:ycm_semantic_triggers =
let g:ycm_cache_omnifunc = let g:ycm_cache_omnifunc =
\ get( g:, 'ycm_cache_omnifunc', 1 ) \ get( g:, 'ycm_cache_omnifunc', 1 )
let g:ycm_auto_start_csharp_server =
\ get( g:, 'ycm_auto_start_csharp_server', 0 )
" On-demand loading. Let's use the autoload folder and not slow down vim's " On-demand loading. Let's use the autoload folder and not slow down vim's
" startup procedure. " startup procedure.
augroup youcompletemeStart augroup youcompletemeStart

View File

@ -42,8 +42,8 @@ class CsharpCompleter( ThreadedCompleter ):
if vimsupport.GetBoolValue( "g:ycm_auto_start_csharp_server" ): if vimsupport.GetBoolValue( "g:ycm_auto_start_csharp_server" ):
self._StartServer() self._StartServer()
def OnVimLeave( self ): #def OnVimLeave( self ):
self._StopServer() #self._StopServer()
def SupportedFiletypes( self ): def SupportedFiletypes( self ):
""" Just csharp """ """ Just csharp """
@ -115,8 +115,7 @@ class CsharpCompleter( ThreadedCompleter ):
def _ServerIsRunning( self ): def _ServerIsRunning( self ):
""" Check if the OmniSharp server is running """ """ Check if the OmniSharp server is running """
self._StopServer() # temporal fix return self._GetResponse( '/poke', silent=True ) != None
return False
def _GetCompletions( self ): def _GetCompletions( self ):
""" Ask server for completions """ """ Ask server for completions """
@ -130,7 +129,7 @@ class CsharpCompleter( ThreadedCompleter ):
completions = self._GetResponse( '/autocomplete', parameters ) completions = self._GetResponse( '/autocomplete', parameters )
return completions if completions != None else [] return completions if completions != None else []
def _GetResponse( self, endPoint, parameters={} ): def _GetResponse( self, endPoint, parameters={}, silent = False ):
""" Handle communication with server """ """ Handle communication with server """
target = urlparse.urljoin( self.OmniSharpHost, endPoint ) target = urlparse.urljoin( self.OmniSharpHost, endPoint )
parameters = urllib.urlencode( parameters ) parameters = urllib.urlencode( parameters )
@ -138,5 +137,6 @@ class CsharpCompleter( ThreadedCompleter ):
response = urllib2.urlopen( target, parameters ) response = urllib2.urlopen( target, parameters )
return json.loads( response.read() ) return json.loads( response.read() )
except Exception as e: except Exception as e:
vimsupport.PostVimMessage('OmniSharp : Could not connect to ' + target + ': ' + str(e)) if not silent:
vimsupport.PostVimMessage('OmniSharp : Could not connect to ' + target + ': ' + str(e))
return None return None