diff --git a/python/ycm/base.py b/python/ycm/base.py index 05314dd5..2e172d98 100644 --- a/python/ycm/base.py +++ b/python/ycm/base.py @@ -131,6 +131,8 @@ def AdjustCandidateInsertionText( candidates ): new_candidates = [] text_after_cursor = vimsupport.TextAfterCursor() + if not text_after_cursor: + return candidates for candidate in candidates: if type( candidate ) is dict: new_candidate = candidate.copy() diff --git a/python/ycm/tests/base_test.py b/python/ycm/tests/base_test.py index f022486a..bebc930f 100644 --- a/python/ycm/tests/base_test.py +++ b/python/ycm/tests/base_test.py @@ -67,8 +67,8 @@ def AdjustCandidateInsertionText_NotSuffix_test(): def AdjustCandidateInsertionText_NothingAfterCursor_test(): vimsupport.TextAfterCursor = MagicMock( return_value = '' ) - eq_( [ { 'abbr': 'foofoo', 'word': 'foofoo' }, - { 'abbr': 'zobar', 'word': 'zobar' }, ], + eq_( [ 'foofoo', + 'zobar' ], base.AdjustCandidateInsertionText( [ 'foofoo', 'zobar' ] ) )