Expose OmniSharp's ReloadSolution command
This commit is contained in:
parent
3da402fdf9
commit
2d9c41f527
@ -43,6 +43,7 @@ class CsharpCompleter( Completer ):
|
|||||||
'StartServer': (lambda self, request_data: self._StartServer( request_data )),
|
'StartServer': (lambda self, request_data: self._StartServer( request_data )),
|
||||||
'StopServer': (lambda self, request_data: self._StopServer()),
|
'StopServer': (lambda self, request_data: self._StopServer()),
|
||||||
'RestartServer': (lambda self, request_data: self._RestartServer( request_data )),
|
'RestartServer': (lambda self, request_data: self._RestartServer( request_data )),
|
||||||
|
'ReloadSolution': (lambda self, request_data: self._ReloadSolution()),
|
||||||
'ServerRunning': (lambda self, request_data: self._ServerIsRunning()),
|
'ServerRunning': (lambda self, request_data: self._ServerIsRunning()),
|
||||||
'ServerReady': (lambda self, request_data: self._ServerIsReady()),
|
'ServerReady': (lambda self, request_data: self._ServerIsReady()),
|
||||||
'GoToDefinition': (lambda self, request_data: self._GoToDefinition( request_data )),
|
'GoToDefinition': (lambda self, request_data: self._GoToDefinition( request_data )),
|
||||||
@ -183,6 +184,12 @@ class CsharpCompleter( Completer ):
|
|||||||
return self._StartServer( request_data )
|
return self._StartServer( request_data )
|
||||||
|
|
||||||
|
|
||||||
|
def _ReloadSolution( self ):
|
||||||
|
""" Reloads the solutions in the OmniSharp server """
|
||||||
|
self._logger.info( 'Reloading Solution in OmniSharp server' )
|
||||||
|
return self._GetResponse( '/reloadsolution' )
|
||||||
|
|
||||||
|
|
||||||
def _GetCompletions( self, request_data ):
|
def _GetCompletions( self, request_data ):
|
||||||
""" Ask server for completions """
|
""" Ask server for completions """
|
||||||
completions = self._GetResponse( '/autocomplete',
|
completions = self._GetResponse( '/autocomplete',
|
||||||
|
@ -96,6 +96,42 @@ def GetCompletions_CsCompleter_Works_test():
|
|||||||
command_arguments = ['StopServer'],
|
command_arguments = ['StopServer'],
|
||||||
filetype = 'cs' ) )
|
filetype = 'cs' ) )
|
||||||
|
|
||||||
|
@with_setup( Setup )
|
||||||
|
def GetCompletions_CsCompleter_ReloadSolutionWorks_test():
|
||||||
|
app = TestApp( handlers.app )
|
||||||
|
filepath = PathToTestFile( 'testy/Program.cs' )
|
||||||
|
contents = open( filepath ).read()
|
||||||
|
event_data = BuildRequest( filepath = filepath,
|
||||||
|
filetype = 'cs',
|
||||||
|
contents = contents,
|
||||||
|
event_name = 'FileReadyToParse' )
|
||||||
|
|
||||||
|
app.post_json( '/event_notification', event_data )
|
||||||
|
|
||||||
|
# We need to wait until the server has started up.
|
||||||
|
while True:
|
||||||
|
result = app.post_json( '/run_completer_command',
|
||||||
|
BuildRequest( completer_target = 'filetype_default',
|
||||||
|
command_arguments = ['ServerReady'],
|
||||||
|
filetype = 'cs' ) ).json
|
||||||
|
if result:
|
||||||
|
break
|
||||||
|
time.sleep( 0.2 )
|
||||||
|
|
||||||
|
|
||||||
|
result = app.post_json( '/run_completer_command',
|
||||||
|
BuildRequest( completer_target = 'filetype_default',
|
||||||
|
command_arguments = ['ReloadSolution'],
|
||||||
|
filetype = 'cs' ) ).json
|
||||||
|
|
||||||
|
eq_(result, True)
|
||||||
|
|
||||||
|
# We need to turn off the CS server so that it doesn't stick around
|
||||||
|
app.post_json( '/run_completer_command',
|
||||||
|
BuildRequest( completer_target = 'filetype_default',
|
||||||
|
command_arguments = ['StopServer'],
|
||||||
|
filetype = 'cs' ) )
|
||||||
|
|
||||||
@with_setup( Setup )
|
@with_setup( Setup )
|
||||||
def GetCompletions_CsCompleter_StartsWithUnambiguousMultipleSolutions_test():
|
def GetCompletions_CsCompleter_StartsWithUnambiguousMultipleSolutions_test():
|
||||||
app = TestApp( handlers.app )
|
app = TestApp( handlers.app )
|
||||||
|
Loading…
Reference in New Issue
Block a user