in src/ulsp/controller/scip/consume.go [164:182]
func IsMatchingPosition(occ *model.Occurrence, pos protocol.Position) bool {
rng, err := scip.NewRange(occ.Range)
if err != nil {
return false
}
if rng.IsSingleLine() {
return rng.Start.Line == int32(pos.Line) &&
rng.Start.Character <= int32(pos.Character) &&
rng.End.Character >= int32(pos.Character)
}
// For multiline ranges we need a slightly more complex check:
// 1. If the position is between the start and end line, we don't need to do a character check
// 2. If the position is on the start line, we need to check if it's beyond the start of the range
// 3. If the position is on the end line, we need to check if it's before the end of the range
return (rng.Start.Line < int32(pos.Line) && rng.End.Line > int32(pos.Line)) ||
(rng.Start.Line == int32(pos.Line) && rng.Start.Character <= int32(pos.Character)) ||
(rng.End.Line == int32(pos.Line) && rng.End.Character >= int32(pos.Character))
}