Improve server crash notification at startup
Notify the user if the server crashed during server polling at startup.
This commit is contained in:
parent
b5c8e57962
commit
2b8e86797c
@ -487,6 +487,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:PollServerReady( timer_id )
|
function! s:PollServerReady( timer_id )
|
||||||
if !s:Pyeval( 'ycm_state.IsServerAlive()' )
|
if !s:Pyeval( 'ycm_state.IsServerAlive()' )
|
||||||
|
exec s:python_command "ycm_state.NotifyUserIfServerCrashed()"
|
||||||
" Server crashed. Don't poll it again.
|
" Server crashed. Don't poll it again.
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
@ -108,7 +108,7 @@ def RunNotifyUserIfServerCrashed( ycm, test, post_vim_message ):
|
|||||||
ycm._server_popen = MagicMock( autospec = True )
|
ycm._server_popen = MagicMock( autospec = True )
|
||||||
ycm._server_popen.poll.return_value = test[ 'return_code' ]
|
ycm._server_popen.poll.return_value = test[ 'return_code' ]
|
||||||
|
|
||||||
ycm._NotifyUserIfServerCrashed()
|
ycm.OnFileReadyToParse()
|
||||||
|
|
||||||
assert_that( ycm._logger.error.call_args[ 0 ][ 0 ],
|
assert_that( ycm._logger.error.call_args[ 0 ][ 0 ],
|
||||||
test[ 'expected_message' ] )
|
test[ 'expected_message' ] )
|
||||||
|
@ -186,8 +186,6 @@ class YouCompleteMe( object ):
|
|||||||
self._server_popen = utils.SafePopen( args, stdin_windows = PIPE,
|
self._server_popen = utils.SafePopen( args, stdin_windows = PIPE,
|
||||||
stdout = PIPE, stderr = PIPE )
|
stdout = PIPE, stderr = PIPE )
|
||||||
|
|
||||||
self._NotifyUserIfServerCrashed()
|
|
||||||
|
|
||||||
|
|
||||||
def _SetupLogging( self ):
|
def _SetupLogging( self ):
|
||||||
def FreeFileFromOtherProcesses( file_object ):
|
def FreeFileFromOtherProcesses( file_object ):
|
||||||
@ -244,7 +242,7 @@ class YouCompleteMe( object ):
|
|||||||
return self._server_is_ready_with_cache
|
return self._server_is_ready_with_cache
|
||||||
|
|
||||||
|
|
||||||
def _NotifyUserIfServerCrashed( self ):
|
def NotifyUserIfServerCrashed( self ):
|
||||||
if ( not self._server_popen or self._user_notified_about_crash or
|
if ( not self._server_popen or self._user_notified_about_crash or
|
||||||
self.IsServerAlive() ):
|
self.IsServerAlive() ):
|
||||||
return
|
return
|
||||||
@ -371,7 +369,7 @@ class YouCompleteMe( object ):
|
|||||||
|
|
||||||
def OnFileReadyToParse( self ):
|
def OnFileReadyToParse( self ):
|
||||||
if not self.IsServerAlive():
|
if not self.IsServerAlive():
|
||||||
self._NotifyUserIfServerCrashed()
|
self.NotifyUserIfServerCrashed()
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.IsServerReady():
|
if not self.IsServerReady():
|
||||||
|
Loading…
Reference in New Issue
Block a user