From 6cd929c829893db1d1eb98754d2152899bc4958d Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Mon, 9 Jun 2014 10:18:03 -0700 Subject: [PATCH] Further support for diag line_num < 1 Fixes #1028 --- python/ycm/vimsupport.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/ycm/vimsupport.py b/python/ycm/vimsupport.py index db7003ce..2c39470d 100644 --- a/python/ycm/vimsupport.py +++ b/python/ycm/vimsupport.py @@ -140,6 +140,11 @@ def UnplaceAllSignsInBuffer( buffer_number ): def PlaceSign( sign_id, line_num, buffer_num, is_error = True ): + # libclang can give us diagnostics that point "outside" the file; Vim borks + # on these. + if line_num < 1: + line_num = 1 + sign_name = 'YcmError' if is_error else 'YcmWarning' vim.command( 'sign place {0} line={1} name={2} buffer={3}'.format( sign_id, line_num, sign_name, buffer_num ) )