Showing clang diag ranges with red squiggles
This commit is contained in:
parent
209d22cfdb
commit
6fdddc861b
@ -63,9 +63,20 @@ def _UpdateSquiggles( buffer_number_to_line_to_diags ):
|
||||
for diags in line_to_diags.itervalues():
|
||||
for diag in diags:
|
||||
location = diag[ 'location' ]
|
||||
vimsupport.AddDiagnosticSyntaxMatch( location[ 'line_num' ] + 1,
|
||||
location[ 'column_num' ] + 1,
|
||||
_DiagnosticIsError( diag ) )
|
||||
is_error = _DiagnosticIsError( diag )
|
||||
|
||||
vimsupport.AddDiagnosticSyntaxMatch(
|
||||
location[ 'line_num' ] + 1,
|
||||
location[ 'column_num' ] + 1,
|
||||
is_error = is_error )
|
||||
|
||||
for diag_range in diag[ 'ranges' ]:
|
||||
vimsupport.AddDiagnosticSyntaxMatch(
|
||||
diag_range[ 'start' ][ 'line_num' ] + 1,
|
||||
diag_range[ 'start' ][ 'column_num' ] + 1,
|
||||
diag_range[ 'end' ][ 'line_num' ] + 1,
|
||||
diag_range[ 'end' ][ 'column_num' ] + 1,
|
||||
is_error = is_error )
|
||||
|
||||
|
||||
def _UpdateSigns( buffer_number_to_line_to_diags, next_sign_id ):
|
||||
|
@ -128,10 +128,23 @@ def ClearYcmSyntaxMatches():
|
||||
|
||||
|
||||
# Returns the ID of the newly added match
|
||||
def AddDiagnosticSyntaxMatch( line_num, column_num, is_error ):
|
||||
def AddDiagnosticSyntaxMatch( line_num,
|
||||
column_num,
|
||||
line_end_num = None,
|
||||
column_end_num = None,
|
||||
is_error = True ):
|
||||
group = 'YcmErrorSection' if is_error else 'YcmWarningSection'
|
||||
return GetIntValue(
|
||||
"matchadd('{0}', '\%{1}l\%{2}c')".format( group, line_num, column_num ) )
|
||||
|
||||
if not line_end_num:
|
||||
line_end_num = line_num
|
||||
|
||||
if not column_end_num:
|
||||
return GetIntValue(
|
||||
"matchadd('{0}', '\%{1}l\%{2}c')".format( group, line_num, column_num ) )
|
||||
else:
|
||||
return GetIntValue(
|
||||
"matchadd('{0}', '\%{1}l\%{2}c.*\%{3}l\%{4}c')".format(
|
||||
group, line_num, column_num, line_end_num, column_end_num ) )
|
||||
|
||||
|
||||
# Given a dict like {'a': 1}, loads it into Vim as if you ran 'let g:a = 1'
|
||||
|
Loading…
Reference in New Issue
Block a user