String returns a compact string representation of the receiver. Callers should generally prefer to present a range more visually, e.g. via markers directly on the relevant portion of source code.
()
| 128 | // Callers should generally prefer to present a range more visually, |
| 129 | // e.g. via markers directly on the relevant portion of source code. |
| 130 | func (r Range) String() string { |
| 131 | if r.Start.Line == r.End.Line { |
| 132 | return fmt.Sprintf( |
| 133 | "%s:%d,%d-%d", |
| 134 | r.Filename, |
| 135 | r.Start.Line, r.Start.Column, |
| 136 | r.End.Column, |
| 137 | ) |
| 138 | } else { |
| 139 | return fmt.Sprintf( |
| 140 | "%s:%d,%d-%d,%d", |
| 141 | r.Filename, |
| 142 | r.Start.Line, r.Start.Column, |
| 143 | r.End.Line, r.End.Column, |
| 144 | ) |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | func (r Range) Empty() bool { |
| 149 | return r.Start.Byte == r.End.Byte |
no outgoing calls