From 47f3f9d2c628eb02798d51fe77dd32c8b00e006d Mon Sep 17 00:00:00 2001 From: micbou Date: Thu, 6 Apr 2017 02:22:04 +0200 Subject: [PATCH] Fix diagnostic highlighting with invalid location extent Ignore location extent when starting column is zero. Do not highlight warnings as errors when location extent is invalid. --- python/ycm/diagnostic_interface.py | 7 ++++--- python/ycm/tests/youcompleteme_test.py | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/python/ycm/diagnostic_interface.py b/python/ycm/diagnostic_interface.py index f68d09f0..89051635 100644 --- a/python/ycm/diagnostic_interface.py +++ b/python/ycm/diagnostic_interface.py @@ -138,11 +138,12 @@ def _UpdateSquiggles( buffer_number_to_line_to_diags ): location_extent = diag[ 'location_extent' ] is_error = _DiagnosticIsError( diag ) - if location_extent[ 'start' ][ 'line_num' ] < 0: + if location_extent[ 'start' ][ 'line_num' ] <= 0: location = diag[ 'location' ] vimsupport.AddDiagnosticSyntaxMatch( - location[ 'line_num' ], - location[ 'column_num' ] ) + location[ 'line_num' ], + location[ 'column_num' ], + is_error = is_error ) else: vimsupport.AddDiagnosticSyntaxMatch( location_extent[ 'start' ][ 'line_num' ], diff --git a/python/ycm/tests/youcompleteme_test.py b/python/ycm/tests/youcompleteme_test.py index 68fc82eb..53a95b87 100644 --- a/python/ycm/tests/youcompleteme_test.py +++ b/python/ycm/tests/youcompleteme_test.py @@ -520,8 +520,7 @@ def YouCompleteMe_UpdateDiagnosticInterface_PrioritizeErrorsOverWarnings_test( contains( VimMatch( 'YcmWarningSection', '\%3l\%5c\_.\{-}\%3l\%7c' ), VimMatch( 'YcmWarningSection', '\%3l\%3c\_.\{-}\%3l\%9c' ), - # FIXME: match should be inserted at the end of line 3 (missing ";"). - VimMatch( 'YcmErrorSection', '\%0l\%0c' ) + VimMatch( 'YcmErrorSection', '\%3l\%8c' ) ) )