diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 64d43c91..4aa6feab 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -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 diff --git a/python/ycm/vimsupport.py b/python/ycm/vimsupport.py index 7138cf49..6ee36e3a 100644 --- a/python/ycm/vimsupport.py +++ b/python/ycm/vimsupport.py @@ -217,3 +217,4 @@ def GetBoolValue( variable ): def GetIntValue( variable ): return int( vim.eval( variable ) ) + diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index 8d8fee92..0cc60340 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -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()