1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | export interface ITextLocation {
|
10 | line: number;
|
11 | column: number;
|
12 | }
|
13 |
|
14 |
|
15 |
|
16 | export declare class TextRange {
|
17 | |
18 |
|
19 |
|
20 | static readonly empty: TextRange;
|
21 | |
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | readonly pos: number;
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | readonly end: number;
|
35 | |
36 |
|
37 |
|
38 | readonly buffer: string;
|
39 | private constructor();
|
40 | /**
|
41 | * Constructs a TextRange that corresponds to an entire string object.
|
42 | */
|
43 | static fromString(buffer: string): TextRange;
|
44 | /**
|
45 | * Constructs a TextRange that corresponds to an entire string object.
|
46 | */
|
47 | static fromStringRange(buffer: string, pos: number, end: number): TextRange;
|
48 | /**
|
49 | * Returns the length of the text range.
|
50 | * @remarks
|
51 | * This value is calculated as the `end` property minus the `pos` property.
|
52 | */
|
53 | get length(): number;
|
54 | /**
|
55 | * Constructs a TextRange that corresponds to a different range of an existing buffer.
|
56 | */
|
57 | getNewRange(pos: number, end: number): TextRange;
|
58 | /**
|
59 | * Returns true if the length of the range is zero. Note that the object reference may not
|
60 | * be equal to `TextRange.empty`, and the buffer may be different.
|
61 | */
|
62 | isEmpty(): boolean;
|
63 | /**
|
64 | * Returns the range from the associated string buffer.
|
65 | */
|
66 | toString(): string;
|
67 | /**
|
68 | * Returns a debugging dump of the range, indicated via custom delimiters.
|
69 | * @remarks
|
70 | * For example if the delimiters are "[" and "]", and the range is 3..5 inside "1234567",
|
71 | * then the output would be "12[345]67".
|
72 | */
|
73 | getDebugDump(posDelimiter: string, endDelimiter: string): string;
|
74 | /**
|
75 | * Calculates the line and column number for the specified offset into the buffer.
|
76 | *
|
77 | * @remarks
|
78 | * This is a potentially expensive operation.
|
79 | *
|
80 | * @param index - an integer offset
|
81 | * @param buffer - the buffer
|
82 | */
|
83 | getLocation(index: number): ITextLocation;
|
84 | private _validateBounds;
|
85 | }
|
86 | //# sourceMappingURL=TextRange.d.ts.map |
\ | No newline at end of file |