浏览代码

variable for csharp server port added

Chiel92 11 年之前
父节点
当前提交
bdd95ff43f
共有 2 个文件被更改,包括 7 次插入4 次删除
  1. 3 0
      plugin/youcompleteme.vim
  2. 4 4
      python/ycm/completers/cs/cs_completer.py

+ 3 - 0
plugin/youcompleteme.vim

@@ -154,6 +154,9 @@ let g:ycm_cache_omnifunc =
 let g:ycm_auto_start_csharp_server =
       \ get( g:, 'ycm_auto_start_csharp_server', 0 )
 
+let g:ycm_auto_start_csharp_server =
+      \ get( g:, 'ycm_csharp_server_port', 2000 )
+
 " On-demand loading. Let's use the autoload folder and not slow down vim's
 " startup procedure.
 augroup youcompletemeStart

+ 4 - 4
python/ycm/completers/cs/cs_completer.py

@@ -37,13 +37,13 @@ class CsharpCompleter( ThreadedCompleter ):
 
   def __init__( self ):
     super( CsharpCompleter, self ).__init__()
-    self.OmniSharpPort = 2000
+    self.OmniSharpPort = int( vimsupport.GetVariableValue( "g:ycm_csharp_server_port" ) ) 
     self.OmniSharpHost = 'http://localhost:' + str( self.OmniSharpPort )
     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 """
@@ -111,7 +111,7 @@ class CsharpCompleter( ThreadedCompleter ):
 
   def _StopServer( self ):
     """ Stop the OmniSharp server """
-    self._GetResponse( '/stopserver' ) # Should only stop when server running
+    self._GetResponse( '/stopserver' )
 
   def _ServerIsRunning( self ):
     """ Check if the OmniSharp server is running """