Surfacing ycmd server PID to user scripts

To get the PID, call function youcompleteme#ServerPid().
This commit is contained in:
Strahinja Val Markovic 2013-10-22 10:51:37 -07:00
parent 5719a5e080
commit 6d9969fa9c
3 changed files with 12 additions and 0 deletions

View File

@ -588,6 +588,11 @@ function! youcompleteme#OmniComplete( findstart, base )
endfunction
function! youcompleteme#ServerPid()
return pyeval( 'ycm_state.ServerPid()' )
endfunction
function! s:RestartServer()
py ycm_state.RestartServer()
endfunction

View File

@ -217,3 +217,4 @@ def GetBoolValue( variable ):
def GetIntValue( variable ):
return int( vim.eval( variable ) )

View File

@ -109,6 +109,12 @@ class YouCompleteMe( object ):
vimsupport.PostVimMessage( SERVER_CRASH_MESSAGE_SAME_STDERR )
def ServerPid( self ):
if not self._server_popen:
return -1
return self._server_popen.pid
def RestartServer( self ):
vimsupport.PostVimMessage( 'Restarting ycmd server...' )
self.OnVimLeave()