|
@@ -45,7 +45,9 @@ class DiagnosticInterface( object ):
|
|
|
|
|
|
|
|
|
def UpdateWithNewDiagnostics( self, diags ):
|
|
|
- self._buffer_number_to_line_to_diags = _ConvertDiagListToDict( diags )
|
|
|
+ normalized_diags = [ _NormalizeDiagnostic( x ) for x in diags ]
|
|
|
+ self._buffer_number_to_line_to_diags = _ConvertDiagListToDict(
|
|
|
+ normalized_diags )
|
|
|
|
|
|
if self._user_options[ 'enable_diagnostic_signs' ]:
|
|
|
self._placed_signs, self._next_sign_id = _UpdateSigns(
|
|
@@ -58,7 +60,7 @@ class DiagnosticInterface( object ):
|
|
|
|
|
|
if self._user_options[ 'always_populate_location_list' ]:
|
|
|
vimsupport.SetLocationList(
|
|
|
- vimsupport.ConvertDiagnosticsToQfList( diags ) )
|
|
|
+ vimsupport.ConvertDiagnosticsToQfList( normalized_diags ) )
|
|
|
|
|
|
|
|
|
def _EchoDiagnosticForLine( self, line_num ):
|
|
@@ -204,6 +206,16 @@ def _DiagnosticIsError( diag ):
|
|
|
return diag[ 'kind' ] == 'ERROR'
|
|
|
|
|
|
|
|
|
+def _NormalizeDiagnostic( diag ):
|
|
|
+ def ClampToOne( value ):
|
|
|
+ return value if value > 0 else 1
|
|
|
+
|
|
|
+ location = diag[ 'location' ]
|
|
|
+ location[ 'column_num' ] = ClampToOne( location[ 'column_num' ] )
|
|
|
+ location[ 'line_num' ] = ClampToOne( location[ 'line_num' ] )
|
|
|
+ return diag
|
|
|
+
|
|
|
+
|
|
|
class _DiagSignPlacement( namedtuple( "_DiagSignPlacement",
|
|
|
[ 'id', 'line', 'buffer', 'is_error' ] ) ):
|
|
|
# We want two signs that have different ids but the same location to compare
|