Skip to content

Commit

Permalink
autostart/stop server
Browse files Browse the repository at this point in the history
  • Loading branch information
chtenb committed Jul 7, 2013
1 parent d2a7fe9 commit 2f207cb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions python/ycm/completers/cs/cs_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ def __init__( self ):
super( CsharpCompleter, self ).__init__()
self.OmniSharpPort = 2000
self.OmniSharpHost = 'http://localhost:' + str( self.OmniSharpPort )
#self._StartServer()
if vimsupport.GetBoolValue( "g:ycm_auto_start_csharp_server" ):
self._StartServer()

def OnVimLeave( self ):
self._StopServer()

def SupportedFiletypes( self ):
""" Just csharp """
Expand All @@ -53,7 +57,8 @@ def ComputeCandidates( self, unused_query, unused_start_column ):

def DefinedSubcommands( self ):
return [ 'StartServer',
'StopServer' ]
'StopServer',
'RestartServer' ]

def OnUserCommand( self, arguments ):
if not arguments:
Expand All @@ -65,6 +70,9 @@ def OnUserCommand( self, arguments ):
self._StartServer()
elif command == 'StopServer':
self._StopServer()
elif command == 'RestartServer':
self._StopServer()
self._StartServer()

def _StartServer( self ):
""" Start the OmniSharp server """
Expand Down Expand Up @@ -103,7 +111,7 @@ def _StartServer( self ):

def _StopServer( self ):
""" Stop the OmniSharp server """
self._GetResponse( '/stopserver' )
self._GetResponse( '/stopserver' ) # Should only stop when server running

def _ServerIsRunning( self ):
""" Check if the OmniSharp server is running """
Expand Down

0 comments on commit 2f207cb

Please sign in to comment.