ServerIsRunning fixed and variable defaults set
This commit is contained in:
parent
34c24129d2
commit
6ec038870b
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -3,4 +3,4 @@
|
||||
url = https://github.com/davidhalter/jedi.git
|
||||
[submodule "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
|
||||
|
@ -151,6 +151,9 @@ let g:ycm_semantic_triggers =
|
||||
let g:ycm_cache_omnifunc =
|
||||
\ 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
|
||||
" startup procedure.
|
||||
augroup youcompletemeStart
|
||||
|
@ -42,8 +42,8 @@ class CsharpCompleter( ThreadedCompleter ):
|
||||
if vimsupport.GetBoolValue( "g:ycm_auto_start_csharp_server" ):
|
||||
self._StartServer()
|
||||
|
||||
def OnVimLeave( self ):
|
||||
self._StopServer()
|
||||
#def OnVimLeave( self ):
|
||||
#self._StopServer()
|
||||
|
||||
def SupportedFiletypes( self ):
|
||||
""" Just csharp """
|
||||
@ -115,8 +115,7 @@ class CsharpCompleter( ThreadedCompleter ):
|
||||
|
||||
def _ServerIsRunning( self ):
|
||||
""" Check if the OmniSharp server is running """
|
||||
self._StopServer() # temporal fix
|
||||
return False
|
||||
return self._GetResponse( '/poke', silent=True ) != None
|
||||
|
||||
def _GetCompletions( self ):
|
||||
""" Ask server for completions """
|
||||
@ -130,7 +129,7 @@ class CsharpCompleter( ThreadedCompleter ):
|
||||
completions = self._GetResponse( '/autocomplete', parameters )
|
||||
return completions if completions != None else []
|
||||
|
||||
def _GetResponse( self, endPoint, parameters={} ):
|
||||
def _GetResponse( self, endPoint, parameters={}, silent = False ):
|
||||
""" Handle communication with server """
|
||||
target = urlparse.urljoin( self.OmniSharpHost, endPoint )
|
||||
parameters = urllib.urlencode( parameters )
|
||||
@ -138,5 +137,6 @@ class CsharpCompleter( ThreadedCompleter ):
|
||||
response = urllib2.urlopen( target, parameters )
|
||||
return json.loads( response.read() )
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user