Use new Omnisharp Server ready command

This commit is contained in:
Spencer G. Jones 2014-02-19 09:48:22 -07:00
parent 2bf3bd5cac
commit 5b5e182194
2 changed files with 13 additions and 1 deletions

View File

@ -69,6 +69,7 @@ class CsharpCompleter( Completer ):
'StopServer',
'RestartServer',
'ServerRunning',
'ServerReady',
'GoToDefinition',
'GoToDeclaration',
'GoToDefinitionElseDeclaration' ]
@ -95,6 +96,8 @@ class CsharpCompleter( Completer ):
return self._StartServer( request_data )
elif command == 'ServerRunning':
return self._ServerIsRunning()
elif command == 'ServerReady':
return self._ServerIsReady()
elif command in [ 'GoToDefinition',
'GoToDeclaration',
'GoToDefinitionElseDeclaration' ]:
@ -221,6 +224,15 @@ class CsharpCompleter( Completer ):
return False
def _ServerIsReady( self ):
""" Check if our OmniSharp server is ready """
try:
return bool( self._omnisharp_port and
self._GetResponse( '/checkreadystatus', silent = True ) )
except:
return False
def _ServerLocation( self ):
return 'http://localhost:' + str( self._omnisharp_port )

View File

@ -73,7 +73,7 @@ def GetCompletions_CsCompleter_Works_test():
while True:
result = app.post_json( '/run_completer_command',
BuildRequest( completer_target = 'filetype_default',
command_arguments = ['ServerRunning'],
command_arguments = ['ServerReady'],
filetype = 'cs' ) ).json
if result:
break