in src/scip-lib/mapper/scip_types.go [101:143]
func ScipDiagnosticToModelDiagnostic(occ *scip.Occurrence) []*protocol.Diagnostic {
if occ == nil {
return nil
}
var positions protocol.Range
if len(occ.Range) >= 4 {
positions = protocol.Range{
Start: protocol.Position{
Line: uint32(occ.Range[0]),
Character: uint32(occ.Range[1]),
},
End: protocol.Position{
Line: uint32(occ.Range[2]),
Character: uint32(occ.Range[3]),
},
}
} else if len(occ.Range) >= 3 {
positions = protocol.Range{
Start: protocol.Position{
Line: uint32(occ.Range[0]),
Character: uint32(occ.Range[1]),
},
End: protocol.Position{
Line: uint32(occ.Range[0]),
Character: uint32(occ.Range[2]),
},
}
}
res := make([]*protocol.Diagnostic, 0, len(occ.Diagnostics))
for _, diag := range occ.Diagnostics {
res = append(res, &protocol.Diagnostic{
Range: positions,
Severity: protocol.DiagnosticSeverity(diag.Severity),
Code: diag.Code,
Message: diag.Message,
Source: diag.Source,
Tags: convertDiagnosticTags(diag.Tags),
})
}
return res
}