From f44723689cb8d3d117a823f0db282c5a56c53ec1 Mon Sep 17 00:00:00 2001 From: micbou Date: Mon, 23 Apr 2018 10:54:01 +0200 Subject: [PATCH] Fix resending request when buffer is not yet parsed --- python/ycm/buffer.py | 2 +- python/ycm/tests/youcompleteme_test.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/python/ycm/buffer.py b/python/ycm/buffer.py index 3bed55e1..9d1266b6 100644 --- a/python/ycm/buffer.py +++ b/python/ycm/buffer.py @@ -67,7 +67,7 @@ class Buffer( object ): def ShouldResendParseRequest( self ): - return self._parse_request.ShouldResend() + return bool( self._parse_request and self._parse_request.ShouldResend() ) def UpdateDiagnostics( self, force=False ): diff --git a/python/ycm/tests/youcompleteme_test.py b/python/ycm/tests/youcompleteme_test.py index 39a6e122..8d8d9690 100644 --- a/python/ycm/tests/youcompleteme_test.py +++ b/python/ycm/tests/youcompleteme_test.py @@ -1058,3 +1058,10 @@ def YouCompleteMe_OnCompleteDone_NoCompletionRequest_test( ycm, on_complete_done ): ycm.OnCompleteDone() on_complete_done.assert_not_called() + + +@YouCompleteMeInstance() +def YouCompleteMe_ShouldResendFileParseRequest_NoParseRequest_test( ycm ): + current_buffer = VimBuffer( 'current_buffer' ) + with MockVimBuffers( [ current_buffer ], current_buffer ): + assert_that( ycm.ShouldResendFileParseRequest(), equal_to( False ) )