UNPKG

825 BTypeScriptView Raw
1import {SourceLocation} from './source_location';
2
3/**
4 * A span of text within a source file.
5 *
6 * @category Logger
7 */
8export interface SourceSpan {
9 /** The beginning of this span, inclusive. */
10 start: SourceLocation;
11
12 /**
13 * The end of this span, exclusive.
14 *
15 * If [[start]] and [[end]] refer to the same location, the span has zero
16 * length and refers to the point immediately after [[start]] and before the
17 * next character.
18 */
19 end: SourceLocation;
20
21 /** The canonical URL of the file this span refers to. */
22 url?: URL;
23
24 /** The text covered by the span. */
25 text: string;
26
27 /**
28 * Text surrounding the span.
29 *
30 * If this is set, it must include only whole lines, and it must include at
31 * least all line(s) which are partially covered by this span.
32 */
33 context?: string;
34}