def _UpdateSquiggles(buffer_number_to_line_to_diags):
    vimsupport.ClearYcmSyntaxMatches()
    line_to_diags = buffer_number_to_line_to_diags[vim.current.buffer.number]

    for diags in itervalues(line_to_diags):
        for diag in diags:
            location_extent = diag['location_extent']
            is_error = _DiagnosticIsError(diag)

            if location_extent['start']['line_num'] < 0:
                location = diag['location']
                vimsupport.AddDiagnosticSyntaxMatch(location['line_num'],
                                                    location['column_num'])
            else:
                vimsupport.AddDiagnosticSyntaxMatch(
                    location_extent['start']['line_num'],
                    location_extent['start']['column_num'],
                    location_extent['end']['line_num'],
                    location_extent['end']['column_num'],
                    is_error=is_error)

            for diag_range in diag['ranges']:
                vimsupport.AddDiagnosticSyntaxMatch(
                    diag_range['start']['line_num'],
                    diag_range['start']['column_num'],
                    diag_range['end']['line_num'],
                    diag_range['end']['column_num'],
                    is_error=is_error)
Пример #2
0
    def _UpdateSquiggles(self):

        vimsupport.ClearYcmSyntaxMatches()

        for diags in itervalues(self._line_to_diags):
            # Insert squiggles in reverse order so that errors overlap warnings.
            for diag in reversed(diags):
                location_extent = diag['location_extent']
                is_error = _DiagnosticIsError(diag)

                if location_extent['start']['line_num'] <= 0:
                    location = diag['location']
                    vimsupport.AddDiagnosticSyntaxMatch(location['line_num'],
                                                        location['column_num'],
                                                        is_error=is_error)
                else:
                    vimsupport.AddDiagnosticSyntaxMatch(
                        location_extent['start']['line_num'],
                        location_extent['start']['column_num'],
                        location_extent['end']['line_num'],
                        location_extent['end']['column_num'],
                        is_error=is_error)

                for diag_range in diag['ranges']:
                    vimsupport.AddDiagnosticSyntaxMatch(
                        diag_range['start']['line_num'],
                        diag_range['start']['column_num'],
                        diag_range['end']['line_num'],
                        diag_range['end']['column_num'],
                        is_error=is_error)