Making the cs_completer test less flaky
This commit is contained in:
parent
aac33b61e9
commit
70a51be209
@ -72,6 +72,7 @@ class CsharpCompleter( Completer ):
|
||||
return [ 'StartServer',
|
||||
'StopServer',
|
||||
'RestartServer',
|
||||
'ServerRunning',
|
||||
'GoToDefinition',
|
||||
'GoToDeclaration',
|
||||
'GoToDefinitionElseDeclaration' ]
|
||||
@ -96,6 +97,8 @@ class CsharpCompleter( Completer ):
|
||||
if self._ServerIsRunning():
|
||||
self._StopServer()
|
||||
self._StartServer( request_data )
|
||||
elif command == 'ServerRunning':
|
||||
return self._ServerIsRunning()
|
||||
elif command in [ 'GoToDefinition',
|
||||
'GoToDeclaration',
|
||||
'GoToDefinitionElseDeclaration' ]:
|
||||
@ -198,8 +201,11 @@ class CsharpCompleter( Completer ):
|
||||
|
||||
def _ServerIsRunning( self ):
|
||||
""" Check if our OmniSharp server is running """
|
||||
return ( self._omnisharp_port != None and
|
||||
self._GetResponse( '/checkalivestatus', silent = True ) != None )
|
||||
try:
|
||||
return bool( self._omnisharp_port and
|
||||
self._GetResponse( '/checkalivestatus', silent = True ) )
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
def _ServerLocation( self ):
|
||||
|
@ -115,8 +115,14 @@ def GetCompletions_CsCompleter_Works_test():
|
||||
app.post_json( '/event_notification', event_data )
|
||||
|
||||
# We need to wait until the server has started up.
|
||||
# TODO: This is a HORRIBLE hack. Fix it!
|
||||
time.sleep( 2 )
|
||||
while True:
|
||||
result = app.post_json( '/run_completer_command',
|
||||
BuildRequest( completer_target = 'filetype_default',
|
||||
command_arguments = ['ServerRunning'],
|
||||
filetype = 'cs' ) ).json
|
||||
if result:
|
||||
break
|
||||
time.sleep( 0.2 )
|
||||
|
||||
completion_data = BuildRequest( filepath = filepath,
|
||||
filetype = 'cs',
|
||||
|
Loading…
Reference in New Issue
Block a user