diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index cd03b157..823b134f 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -487,6 +487,7 @@ endfunction function! s:PollServerReady( timer_id ) if !s:Pyeval( 'ycm_state.IsServerAlive()' ) + exec s:python_command "ycm_state.NotifyUserIfServerCrashed()" " Server crashed. Don't poll it again. return endif diff --git a/python/ycm/tests/youcompleteme_test.py b/python/ycm/tests/youcompleteme_test.py index 4c5ce539..75e90582 100644 --- a/python/ycm/tests/youcompleteme_test.py +++ b/python/ycm/tests/youcompleteme_test.py @@ -108,7 +108,7 @@ def RunNotifyUserIfServerCrashed( ycm, test, post_vim_message ): ycm._server_popen = MagicMock( autospec = True ) ycm._server_popen.poll.return_value = test[ 'return_code' ] - ycm._NotifyUserIfServerCrashed() + ycm.OnFileReadyToParse() assert_that( ycm._logger.error.call_args[ 0 ][ 0 ], test[ 'expected_message' ] ) diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index 7d16abe8..c9ef35ed 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -186,8 +186,6 @@ class YouCompleteMe( object ): self._server_popen = utils.SafePopen( args, stdin_windows = PIPE, stdout = PIPE, stderr = PIPE ) - self._NotifyUserIfServerCrashed() - def _SetupLogging( self ): def FreeFileFromOtherProcesses( file_object ): @@ -244,7 +242,7 @@ class YouCompleteMe( object ): 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 self.IsServerAlive() ): return @@ -371,7 +369,7 @@ class YouCompleteMe( object ): def OnFileReadyToParse( self ): if not self.IsServerAlive(): - self._NotifyUserIfServerCrashed() + self.NotifyUserIfServerCrashed() return if not self.IsServerReady():