Skip to content

Commit

Permalink
Store multiline diags for each line they appear on
Browse files Browse the repository at this point in the history
Diagnostic interface used to store multiline diags only on thte starting
line.
With this pull commit, _line_to_diags stores a multiline diagnostic for
each line in the range `diag['range']['start'/'end'].
  • Loading branch information
bstaletic committed Nov 5, 2023
1 parent 22a27e6 commit a5f3f24
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions python/ycm/diagnostic_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,13 @@ def _UpdateSigns( self ):
def _ConvertDiagListToDict( self ):
self._line_to_diags = defaultdict( list )
for diag in self._diagnostics:
location = diag[ 'location' ]
bufnr = vimsupport.GetBufferNumberForFilename( location[ 'filepath' ] )
r = diag[ 'ranges' ][ 0 ]
start = r[ 'start' ]
end = r[ 'end' ]
bufnr = vimsupport.GetBufferNumberForFilename( start[ 'filepath' ] )
if bufnr == self._bufnr:
line_number = location[ 'line_num' ]
self._line_to_diags[ line_number ].append( diag )
for line_number in range( start[ 'line_num' ], end[ 'line_num' ] + 1 ):
self._line_to_diags[ line_number ].append( diag )

for diags in self._line_to_diags.values():
# We also want errors to be listed before warnings so that errors aren't
Expand Down

0 comments on commit a5f3f24

Please sign in to comment.