@codingame/monaco-vscode-api 1.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3234 @@
1
+ import * as vscode from 'vscode';
2
+
3
+ declare enum Severity {
4
+ Ignore = 0,
5
+ Info = 1,
6
+ Warning = 2,
7
+ Error = 3
8
+ }
9
+ declare namespace Severity {
10
+ /**
11
+ * Parses 'error', 'warning', 'warn', 'info' in call casings
12
+ * and falls back to ignore.
13
+ */
14
+ function fromValue(value: string): Severity;
15
+ function toString(severity: Severity): string;
16
+ }
17
+
18
+ interface IDisposable {
19
+ dispose(): void;
20
+ }
21
+ declare class DisposableStore implements IDisposable {
22
+ static DISABLE_DISPOSED_WARNING: boolean;
23
+ private _toDispose;
24
+ private _isDisposed;
25
+ constructor();
26
+ /**
27
+ * Dispose of all registered disposables and mark this object as disposed.
28
+ *
29
+ * Any future disposables added to this object will be disposed of on `add`.
30
+ */
31
+ dispose(): void;
32
+ /**
33
+ * Returns `true` if this object has been disposed
34
+ */
35
+ get isDisposed(): boolean;
36
+ /**
37
+ * Dispose of all registered disposables but do not mark this object as disposed.
38
+ */
39
+ clear(): void;
40
+ add<T extends IDisposable>(o: T): T;
41
+ }
42
+
43
+ interface CancellationToken {
44
+ /**
45
+ * A flag signalling is cancellation has been requested.
46
+ */
47
+ readonly isCancellationRequested: boolean;
48
+ /**
49
+ * An event which fires when cancellation is requested. This event
50
+ * only ever fires `once` as cancellation can only happen once. Listeners
51
+ * that are registered after cancellation will be called (next event loop run),
52
+ * but also only once.
53
+ *
54
+ * @event
55
+ */
56
+ readonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable;
57
+ }
58
+ declare namespace CancellationToken {
59
+ function isCancellationToken(thing: unknown): thing is CancellationToken;
60
+ const None: Readonly<CancellationToken>;
61
+ const Cancelled: Readonly<CancellationToken>;
62
+ }
63
+
64
+ /**
65
+ * To an event a function with one or zero parameters
66
+ * can be subscribed. The event is the subscriber function itself.
67
+ */
68
+ interface Event<T> {
69
+ (listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;
70
+ }
71
+ declare namespace Event {
72
+ const None: Event<any>;
73
+ /**
74
+ * Given an event, returns another event which only fires once.
75
+ */
76
+ function once<T>(event: Event<T>): Event<T>;
77
+ /**
78
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
79
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
80
+ * returned event causes this utility to leak a listener on the original event.
81
+ */
82
+ function map<I, O>(event: Event<I>, map: (i: I) => O, disposable?: DisposableStore): Event<O>;
83
+ /**
84
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
85
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
86
+ * returned event causes this utility to leak a listener on the original event.
87
+ */
88
+ function forEach<I>(event: Event<I>, each: (i: I) => void, disposable?: DisposableStore): Event<I>;
89
+ /**
90
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
91
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
92
+ * returned event causes this utility to leak a listener on the original event.
93
+ */
94
+ function filter<T, U>(event: Event<T | U>, filter: (e: T | U) => e is T, disposable?: DisposableStore): Event<T>;
95
+ function filter<T>(event: Event<T>, filter: (e: T) => boolean, disposable?: DisposableStore): Event<T>;
96
+ function filter<T, R>(event: Event<T | R>, filter: (e: T | R) => e is R, disposable?: DisposableStore): Event<R>;
97
+ /**
98
+ * Given an event, returns the same event but typed as `Event<void>`.
99
+ */
100
+ function signal<T>(event: Event<T>): Event<void>;
101
+ /**
102
+ * Given a collection of events, returns a single event which emits
103
+ * whenever any of the provided events emit.
104
+ */
105
+ function any<T>(...events: Event<T>[]): Event<T>;
106
+ function any(...events: Event<any>[]): Event<void>;
107
+ /**
108
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
109
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
110
+ * returned event causes this utility to leak a listener on the original event.
111
+ */
112
+ function reduce<I, O>(event: Event<I>, merge: (last: O | undefined, event: I) => O, initial?: O, disposable?: DisposableStore): Event<O>;
113
+ /**
114
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
115
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
116
+ * returned event causes this utility to leak a listener on the original event.
117
+ */
118
+ function debounce<T>(event: Event<T>, merge: (last: T | undefined, event: T) => T, delay?: number, leading?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event<T>;
119
+ /**
120
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
121
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
122
+ * returned event causes this utility to leak a listener on the original event.
123
+ */
124
+ function debounce<I, O>(event: Event<I>, merge: (last: O | undefined, event: I) => O, delay?: number, leading?: boolean, leakWarningThreshold?: number, disposable?: DisposableStore): Event<O>;
125
+ /**
126
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
127
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
128
+ * returned event causes this utility to leak a listener on the original event.
129
+ */
130
+ function latch<T>(event: Event<T>, equals?: (a: T, b: T) => boolean, disposable?: DisposableStore): Event<T>;
131
+ /**
132
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
133
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
134
+ * returned event causes this utility to leak a listener on the original event.
135
+ */
136
+ function split<T, U>(event: Event<T | U>, isT: (e: T | U) => e is T, disposable?: DisposableStore): [Event<T>, Event<U>];
137
+ /**
138
+ * *NOTE* that this function returns an `Event` and it MUST be called with a `DisposableStore` whenever the returned
139
+ * event is accessible to "third parties", e.g the event is a public property. Otherwise a leaked listener on the
140
+ * returned event causes this utility to leak a listener on the original event.
141
+ */
142
+ function buffer<T>(event: Event<T>, flushAfterTimeout?: boolean, _buffer?: T[]): Event<T>;
143
+ interface IChainableEvent<T> {
144
+ event: Event<T>;
145
+ map<O>(fn: (i: T) => O): IChainableEvent<O>;
146
+ forEach(fn: (i: T) => void): IChainableEvent<T>;
147
+ filter(fn: (e: T) => boolean): IChainableEvent<T>;
148
+ filter<R>(fn: (e: T | R) => e is R): IChainableEvent<R>;
149
+ reduce<R>(merge: (last: R | undefined, event: T) => R, initial?: R): IChainableEvent<R>;
150
+ latch(): IChainableEvent<T>;
151
+ debounce(merge: (last: T | undefined, event: T) => T, delay?: number, leading?: boolean, leakWarningThreshold?: number): IChainableEvent<T>;
152
+ debounce<R>(merge: (last: R | undefined, event: T) => R, delay?: number, leading?: boolean, leakWarningThreshold?: number): IChainableEvent<R>;
153
+ on(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;
154
+ once(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[]): IDisposable;
155
+ }
156
+ /**
157
+ * @deprecated DO NOT use, this leaks memory
158
+ */
159
+ function chain<T>(event: Event<T>): IChainableEvent<T>;
160
+ interface NodeEventEmitter {
161
+ on(event: string | symbol, listener: Function): unknown;
162
+ removeListener(event: string | symbol, listener: Function): unknown;
163
+ }
164
+ function fromNodeEventEmitter<T>(emitter: NodeEventEmitter, eventName: string, map?: (...args: any[]) => T): Event<T>;
165
+ interface DOMEventEmitter {
166
+ addEventListener(event: string | symbol, listener: Function): void;
167
+ removeEventListener(event: string | symbol, listener: Function): void;
168
+ }
169
+ function fromDOMEventEmitter<T>(emitter: DOMEventEmitter, eventName: string, map?: (...args: any[]) => T): Event<T>;
170
+ function toPromise<T>(event: Event<T>): Promise<T>;
171
+ function runAndSubscribe<T>(event: Event<T>, handler: (e: T | undefined) => any): IDisposable;
172
+ function runAndSubscribeWithStore<T>(event: Event<T>, handler: (e: T | undefined, disposableStore: DisposableStore) => any): IDisposable;
173
+ }
174
+
175
+ /**
176
+ * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.
177
+ * This class is a simple parser which creates the basic component parts
178
+ * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
179
+ * and encoding.
180
+ *
181
+ * ```txt
182
+ * foo://example.com:8042/over/there?name=ferret#nose
183
+ * \_/ \______________/\_________/ \_________/ \__/
184
+ * | | | | |
185
+ * scheme authority path query fragment
186
+ * | _____________________|__
187
+ * / \ / \
188
+ * urn:example:animal:ferret:nose
189
+ * ```
190
+ */
191
+ declare class URI implements UriComponents {
192
+ static isUri(thing: any): thing is URI;
193
+ /**
194
+ * scheme is the 'http' part of 'http://www.example.com/some/path?query#fragment'.
195
+ * The part before the first colon.
196
+ */
197
+ readonly scheme: string;
198
+ /**
199
+ * authority is the 'www.example.com' part of 'http://www.example.com/some/path?query#fragment'.
200
+ * The part between the first double slashes and the next slash.
201
+ */
202
+ readonly authority: string;
203
+ /**
204
+ * path is the '/some/path' part of 'http://www.example.com/some/path?query#fragment'.
205
+ */
206
+ readonly path: string;
207
+ /**
208
+ * query is the 'query' part of 'http://www.example.com/some/path?query#fragment'.
209
+ */
210
+ readonly query: string;
211
+ /**
212
+ * fragment is the 'fragment' part of 'http://www.example.com/some/path?query#fragment'.
213
+ */
214
+ readonly fragment: string;
215
+ /**
216
+ * @internal
217
+ */
218
+ protected constructor(scheme: string, authority?: string, path?: string, query?: string, fragment?: string, _strict?: boolean);
219
+ /**
220
+ * @internal
221
+ */
222
+ protected constructor(components: UriComponents);
223
+ /**
224
+ * Returns a string representing the corresponding file system path of this URI.
225
+ * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the
226
+ * platform specific path separator.
227
+ *
228
+ * * Will *not* validate the path for invalid characters and semantics.
229
+ * * Will *not* look at the scheme of this URI.
230
+ * * The result shall *not* be used for display purposes but for accessing a file on disk.
231
+ *
232
+ *
233
+ * The *difference* to `URI#path` is the use of the platform specific separator and the handling
234
+ * of UNC paths. See the below sample of a file-uri with an authority (UNC path).
235
+ *
236
+ * ```ts
237
+ const u = URI.parse('file://server/c$/folder/file.txt')
238
+ u.authority === 'server'
239
+ u.path === '/shares/c$/file.txt'
240
+ u.fsPath === '\\server\c$\folder\file.txt'
241
+ ```
242
+ *
243
+ * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,
244
+ * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working
245
+ * with URIs that represent files on disk (`file` scheme).
246
+ */
247
+ get fsPath(): string;
248
+ with(change: {
249
+ scheme?: string;
250
+ authority?: string | null;
251
+ path?: string | null;
252
+ query?: string | null;
253
+ fragment?: string | null;
254
+ }): URI;
255
+ /**
256
+ * Creates a new URI from a string, e.g. `http://www.example.com/some/path`,
257
+ * `file:///usr/home`, or `scheme:with/path`.
258
+ *
259
+ * @param value A string which represents an URI (see `URI#toString`).
260
+ */
261
+ static parse(value: string, _strict?: boolean): URI;
262
+ /**
263
+ * Creates a new URI from a file system path, e.g. `c:\my\files`,
264
+ * `/usr/home`, or `\\server\share\some\path`.
265
+ *
266
+ * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument
267
+ * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**
268
+ * `URI.parse('file://' + path)` because the path might contain characters that are
269
+ * interpreted (# and ?). See the following sample:
270
+ * ```ts
271
+ const good = URI.file('/coding/c#/project1');
272
+ good.scheme === 'file';
273
+ good.path === '/coding/c#/project1';
274
+ good.fragment === '';
275
+ const bad = URI.parse('file://' + '/coding/c#/project1');
276
+ bad.scheme === 'file';
277
+ bad.path === '/coding/c'; // path is now broken
278
+ bad.fragment === '/project1';
279
+ ```
280
+ *
281
+ * @param path A file system path (see `URI#fsPath`)
282
+ */
283
+ static file(path: string): URI;
284
+ static from(components: {
285
+ scheme: string;
286
+ authority?: string;
287
+ path?: string;
288
+ query?: string;
289
+ fragment?: string;
290
+ }): URI;
291
+ /**
292
+ * Join a URI path with path fragments and normalizes the resulting path.
293
+ *
294
+ * @param uri The input URI.
295
+ * @param pathFragment The path fragment to add to the URI path.
296
+ * @returns The resulting URI.
297
+ */
298
+ static joinPath(uri: URI, ...pathFragment: string[]): URI;
299
+ /**
300
+ * Creates a string representation for this URI. It's guaranteed that calling
301
+ * `URI.parse` with the result of this function creates an URI which is equal
302
+ * to this URI.
303
+ *
304
+ * * The result shall *not* be used for display purposes but for externalization or transport.
305
+ * * The result will be encoded using the percentage encoding and encoding happens mostly
306
+ * ignore the scheme-specific encoding rules.
307
+ *
308
+ * @param skipEncoding Do not encode the result, default is `false`
309
+ */
310
+ toString(skipEncoding?: boolean): string;
311
+ toJSON(): UriComponents;
312
+ static revive(data: UriComponents | URI): URI;
313
+ static revive(data: UriComponents | URI | undefined): URI | undefined;
314
+ static revive(data: UriComponents | URI | null): URI | null;
315
+ static revive(data: UriComponents | URI | undefined | null): URI | undefined | null;
316
+ }
317
+ interface UriComponents {
318
+ scheme: string;
319
+ authority: string;
320
+ path: string;
321
+ query: string;
322
+ fragment: string;
323
+ }
324
+
325
+ interface IMarkdownString {
326
+ readonly value: string;
327
+ readonly isTrusted?: boolean;
328
+ readonly supportThemeIcons?: boolean;
329
+ readonly supportHtml?: boolean;
330
+ readonly baseUri?: UriComponents;
331
+ uris?: {
332
+ [href: string]: UriComponents;
333
+ };
334
+ }
335
+
336
+ /**
337
+ * A position in the editor. This interface is suitable for serialization.
338
+ */
339
+ interface IPosition {
340
+ /**
341
+ * line number (starts at 1)
342
+ */
343
+ readonly lineNumber: number;
344
+ /**
345
+ * column (the first character in a line is between column 1 and column 2)
346
+ */
347
+ readonly column: number;
348
+ }
349
+ /**
350
+ * A position in the editor.
351
+ */
352
+ declare class Position {
353
+ /**
354
+ * line number (starts at 1)
355
+ */
356
+ readonly lineNumber: number;
357
+ /**
358
+ * column (the first character in a line is between column 1 and column 2)
359
+ */
360
+ readonly column: number;
361
+ constructor(lineNumber: number, column: number);
362
+ /**
363
+ * Create a new position from this position.
364
+ *
365
+ * @param newLineNumber new line number
366
+ * @param newColumn new column
367
+ */
368
+ with(newLineNumber?: number, newColumn?: number): Position;
369
+ /**
370
+ * Derive a new position from this position.
371
+ *
372
+ * @param deltaLineNumber line number delta
373
+ * @param deltaColumn column delta
374
+ */
375
+ delta(deltaLineNumber?: number, deltaColumn?: number): Position;
376
+ /**
377
+ * Test if this position equals other position
378
+ */
379
+ equals(other: IPosition): boolean;
380
+ /**
381
+ * Test if position `a` equals position `b`
382
+ */
383
+ static equals(a: IPosition | null, b: IPosition | null): boolean;
384
+ /**
385
+ * Test if this position is before other position.
386
+ * If the two positions are equal, the result will be false.
387
+ */
388
+ isBefore(other: IPosition): boolean;
389
+ /**
390
+ * Test if position `a` is before position `b`.
391
+ * If the two positions are equal, the result will be false.
392
+ */
393
+ static isBefore(a: IPosition, b: IPosition): boolean;
394
+ /**
395
+ * Test if this position is before other position.
396
+ * If the two positions are equal, the result will be true.
397
+ */
398
+ isBeforeOrEqual(other: IPosition): boolean;
399
+ /**
400
+ * Test if position `a` is before position `b`.
401
+ * If the two positions are equal, the result will be true.
402
+ */
403
+ static isBeforeOrEqual(a: IPosition, b: IPosition): boolean;
404
+ /**
405
+ * A function that compares positions, useful for sorting
406
+ */
407
+ static compare(a: IPosition, b: IPosition): number;
408
+ /**
409
+ * Clone this position.
410
+ */
411
+ clone(): Position;
412
+ /**
413
+ * Convert to a human-readable representation.
414
+ */
415
+ toString(): string;
416
+ /**
417
+ * Create a `Position` from an `IPosition`.
418
+ */
419
+ static lift(pos: IPosition): Position;
420
+ /**
421
+ * Test if `obj` is an `IPosition`.
422
+ */
423
+ static isIPosition(obj: any): obj is IPosition;
424
+ }
425
+
426
+ /**
427
+ * A range in the editor. This interface is suitable for serialization.
428
+ */
429
+ interface IRange {
430
+ /**
431
+ * Line number on which the range starts (starts at 1).
432
+ */
433
+ readonly startLineNumber: number;
434
+ /**
435
+ * Column on which the range starts in line `startLineNumber` (starts at 1).
436
+ */
437
+ readonly startColumn: number;
438
+ /**
439
+ * Line number on which the range ends.
440
+ */
441
+ readonly endLineNumber: number;
442
+ /**
443
+ * Column on which the range ends in line `endLineNumber`.
444
+ */
445
+ readonly endColumn: number;
446
+ }
447
+ /**
448
+ * A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)
449
+ */
450
+ declare class Range {
451
+ /**
452
+ * Line number on which the range starts (starts at 1).
453
+ */
454
+ readonly startLineNumber: number;
455
+ /**
456
+ * Column on which the range starts in line `startLineNumber` (starts at 1).
457
+ */
458
+ readonly startColumn: number;
459
+ /**
460
+ * Line number on which the range ends.
461
+ */
462
+ readonly endLineNumber: number;
463
+ /**
464
+ * Column on which the range ends in line `endLineNumber`.
465
+ */
466
+ readonly endColumn: number;
467
+ constructor(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number);
468
+ /**
469
+ * Test if this range is empty.
470
+ */
471
+ isEmpty(): boolean;
472
+ /**
473
+ * Test if `range` is empty.
474
+ */
475
+ static isEmpty(range: IRange): boolean;
476
+ /**
477
+ * Test if position is in this range. If the position is at the edges, will return true.
478
+ */
479
+ containsPosition(position: IPosition): boolean;
480
+ /**
481
+ * Test if `position` is in `range`. If the position is at the edges, will return true.
482
+ */
483
+ static containsPosition(range: IRange, position: IPosition): boolean;
484
+ /**
485
+ * Test if `position` is in `range`. If the position is at the edges, will return false.
486
+ * @internal
487
+ */
488
+ static strictContainsPosition(range: IRange, position: IPosition): boolean;
489
+ /**
490
+ * Test if range is in this range. If the range is equal to this range, will return true.
491
+ */
492
+ containsRange(range: IRange): boolean;
493
+ /**
494
+ * Test if `otherRange` is in `range`. If the ranges are equal, will return true.
495
+ */
496
+ static containsRange(range: IRange, otherRange: IRange): boolean;
497
+ /**
498
+ * Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.
499
+ */
500
+ strictContainsRange(range: IRange): boolean;
501
+ /**
502
+ * Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false.
503
+ */
504
+ static strictContainsRange(range: IRange, otherRange: IRange): boolean;
505
+ /**
506
+ * A reunion of the two ranges.
507
+ * The smallest position will be used as the start point, and the largest one as the end point.
508
+ */
509
+ plusRange(range: IRange): Range;
510
+ /**
511
+ * A reunion of the two ranges.
512
+ * The smallest position will be used as the start point, and the largest one as the end point.
513
+ */
514
+ static plusRange(a: IRange, b: IRange): Range;
515
+ /**
516
+ * A intersection of the two ranges.
517
+ */
518
+ intersectRanges(range: IRange): Range | null;
519
+ /**
520
+ * A intersection of the two ranges.
521
+ */
522
+ static intersectRanges(a: IRange, b: IRange): Range | null;
523
+ /**
524
+ * Test if this range equals other.
525
+ */
526
+ equalsRange(other: IRange | null): boolean;
527
+ /**
528
+ * Test if range `a` equals `b`.
529
+ */
530
+ static equalsRange(a: IRange | null, b: IRange | null): boolean;
531
+ /**
532
+ * Return the end position (which will be after or equal to the start position)
533
+ */
534
+ getEndPosition(): Position;
535
+ /**
536
+ * Return the end position (which will be after or equal to the start position)
537
+ */
538
+ static getEndPosition(range: IRange): Position;
539
+ /**
540
+ * Return the start position (which will be before or equal to the end position)
541
+ */
542
+ getStartPosition(): Position;
543
+ /**
544
+ * Return the start position (which will be before or equal to the end position)
545
+ */
546
+ static getStartPosition(range: IRange): Position;
547
+ /**
548
+ * Transform to a user presentable string representation.
549
+ */
550
+ toString(): string;
551
+ /**
552
+ * Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.
553
+ */
554
+ setEndPosition(endLineNumber: number, endColumn: number): Range;
555
+ /**
556
+ * Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.
557
+ */
558
+ setStartPosition(startLineNumber: number, startColumn: number): Range;
559
+ /**
560
+ * Create a new empty range using this range's start position.
561
+ */
562
+ collapseToStart(): Range;
563
+ /**
564
+ * Create a new empty range using this range's start position.
565
+ */
566
+ static collapseToStart(range: IRange): Range;
567
+ static fromPositions(start: IPosition, end?: IPosition): Range;
568
+ /**
569
+ * Create a `Range` from an `IRange`.
570
+ */
571
+ static lift(range: undefined | null): null;
572
+ static lift(range: IRange): Range;
573
+ static lift(range: IRange | undefined | null): Range | null;
574
+ /**
575
+ * Test if `obj` is an `IRange`.
576
+ */
577
+ static isIRange(obj: any): obj is IRange;
578
+ /**
579
+ * Test if the two ranges are touching in any way.
580
+ */
581
+ static areIntersectingOrTouching(a: IRange, b: IRange): boolean;
582
+ /**
583
+ * Test if the two ranges are intersecting. If the ranges are touching it returns true.
584
+ */
585
+ static areIntersecting(a: IRange, b: IRange): boolean;
586
+ /**
587
+ * A function that compares ranges, useful for sorting ranges
588
+ * It will first compare ranges on the startPosition and then on the endPosition
589
+ */
590
+ static compareRangesUsingStarts(a: IRange | null | undefined, b: IRange | null | undefined): number;
591
+ /**
592
+ * A function that compares ranges, useful for sorting ranges
593
+ * It will first compare ranges on the endPosition and then on the startPosition
594
+ */
595
+ static compareRangesUsingEnds(a: IRange, b: IRange): number;
596
+ /**
597
+ * Test if the range spans multiple lines.
598
+ */
599
+ static spansMultipleLines(range: IRange): boolean;
600
+ toJSON(): IRange;
601
+ }
602
+
603
+ /**
604
+ * A selection in the editor.
605
+ * The selection is a range that has an orientation.
606
+ */
607
+ interface ISelection {
608
+ /**
609
+ * The line number on which the selection has started.
610
+ */
611
+ readonly selectionStartLineNumber: number;
612
+ /**
613
+ * The column on `selectionStartLineNumber` where the selection has started.
614
+ */
615
+ readonly selectionStartColumn: number;
616
+ /**
617
+ * The line number on which the selection has ended.
618
+ */
619
+ readonly positionLineNumber: number;
620
+ /**
621
+ * The column on `positionLineNumber` where the selection has ended.
622
+ */
623
+ readonly positionColumn: number;
624
+ }
625
+ /**
626
+ * The direction of a selection.
627
+ */
628
+ declare const enum SelectionDirection {
629
+ /**
630
+ * The selection starts above where it ends.
631
+ */
632
+ LTR = 0,
633
+ /**
634
+ * The selection starts below where it ends.
635
+ */
636
+ RTL = 1
637
+ }
638
+ /**
639
+ * A selection in the editor.
640
+ * The selection is a range that has an orientation.
641
+ */
642
+ declare class Selection extends Range {
643
+ /**
644
+ * The line number on which the selection has started.
645
+ */
646
+ readonly selectionStartLineNumber: number;
647
+ /**
648
+ * The column on `selectionStartLineNumber` where the selection has started.
649
+ */
650
+ readonly selectionStartColumn: number;
651
+ /**
652
+ * The line number on which the selection has ended.
653
+ */
654
+ readonly positionLineNumber: number;
655
+ /**
656
+ * The column on `positionLineNumber` where the selection has ended.
657
+ */
658
+ readonly positionColumn: number;
659
+ constructor(selectionStartLineNumber: number, selectionStartColumn: number, positionLineNumber: number, positionColumn: number);
660
+ /**
661
+ * Transform to a human-readable representation.
662
+ */
663
+ toString(): string;
664
+ /**
665
+ * Test if equals other selection.
666
+ */
667
+ equalsSelection(other: ISelection): boolean;
668
+ /**
669
+ * Test if the two selections are equal.
670
+ */
671
+ static selectionsEqual(a: ISelection, b: ISelection): boolean;
672
+ /**
673
+ * Get directions (LTR or RTL).
674
+ */
675
+ getDirection(): SelectionDirection;
676
+ /**
677
+ * Create a new selection with a different `positionLineNumber` and `positionColumn`.
678
+ */
679
+ setEndPosition(endLineNumber: number, endColumn: number): Selection;
680
+ /**
681
+ * Get the position at `positionLineNumber` and `positionColumn`.
682
+ */
683
+ getPosition(): Position;
684
+ /**
685
+ * Get the position at the start of the selection.
686
+ */
687
+ getSelectionStart(): Position;
688
+ /**
689
+ * Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`.
690
+ */
691
+ setStartPosition(startLineNumber: number, startColumn: number): Selection;
692
+ /**
693
+ * Create a `Selection` from one or two positions
694
+ */
695
+ static fromPositions(start: IPosition, end?: IPosition): Selection;
696
+ /**
697
+ * Creates a `Selection` from a range, given a direction.
698
+ */
699
+ static fromRange(range: Range, direction: SelectionDirection): Selection;
700
+ /**
701
+ * Create a `Selection` from an `ISelection`.
702
+ */
703
+ static liftSelection(sel: ISelection): Selection;
704
+ /**
705
+ * `a` equals `b`.
706
+ */
707
+ static selectionsArrEqual(a: ISelection[], b: ISelection[]): boolean;
708
+ /**
709
+ * Test if `obj` is an `ISelection`.
710
+ */
711
+ static isISelection(obj: any): obj is ISelection;
712
+ /**
713
+ * Create with a direction.
714
+ */
715
+ static createWithDirection(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number, direction: SelectionDirection): Selection;
716
+ }
717
+
718
+ /**
719
+ * A single edit operation, that acts as a simple replace.
720
+ * i.e. Replace text at `range` with `text` in model.
721
+ */
722
+ interface ISingleEditOperation {
723
+ /**
724
+ * The range to replace. This can be empty to emulate a simple insert.
725
+ */
726
+ range: IRange;
727
+ /**
728
+ * The text to replace with. This can be null to emulate a simple delete.
729
+ */
730
+ text: string | null;
731
+ /**
732
+ * This indicates that this operation has "insert" semantics.
733
+ * i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved.
734
+ */
735
+ forceMoveMarkers?: boolean;
736
+ }
737
+
738
+ declare class TextChange {
739
+ readonly oldPosition: number;
740
+ readonly oldText: string;
741
+ readonly newPosition: number;
742
+ readonly newText: string;
743
+ get oldLength(): number;
744
+ get oldEnd(): number;
745
+ get newLength(): number;
746
+ get newEnd(): number;
747
+ constructor(oldPosition: number, oldText: string, newPosition: number, newText: string);
748
+ toString(): string;
749
+ private static _writeStringSize;
750
+ private static _writeString;
751
+ private static _readString;
752
+ writeSize(): number;
753
+ write(b: Uint8Array, offset: number): number;
754
+ static read(b: Uint8Array, offset: number, dest: TextChange[]): number;
755
+ }
756
+
757
+ /**
758
+ * A fast character classifier that uses a compact array for ASCII values.
759
+ */
760
+ declare class CharacterClassifier<T extends number> {
761
+ /**
762
+ * Maintain a compact (fully initialized ASCII map for quickly classifying ASCII characters - used more often in code).
763
+ */
764
+ protected _asciiMap: Uint8Array;
765
+ /**
766
+ * The entire map (sparse array).
767
+ */
768
+ protected _map: Map<number, number>;
769
+ protected _defaultValue: number;
770
+ constructor(_defaultValue: T);
771
+ private static _createAsciiMap;
772
+ set(charCode: number, _value: T): void;
773
+ get(charCode: number): T;
774
+ }
775
+
776
+ declare const enum WordCharacterClass {
777
+ Regular = 0,
778
+ Whitespace = 1,
779
+ WordSeparator = 2
780
+ }
781
+ declare class WordCharacterClassifier extends CharacterClassifier<WordCharacterClass> {
782
+ constructor(wordSeparators: string);
783
+ }
784
+
785
+ /**
786
+ * Word inside a model.
787
+ */
788
+ interface IWordAtPosition {
789
+ /**
790
+ * The word.
791
+ */
792
+ readonly word: string;
793
+ /**
794
+ * The column where the word starts.
795
+ */
796
+ readonly startColumn: number;
797
+ /**
798
+ * The column where the word ends.
799
+ */
800
+ readonly endColumn: number;
801
+ }
802
+
803
+ interface IViewLineTokens {
804
+ equals(other: IViewLineTokens): boolean;
805
+ getCount(): number;
806
+ getForeground(tokenIndex: number): ColorId;
807
+ getEndOffset(tokenIndex: number): number;
808
+ getClassName(tokenIndex: number): string;
809
+ getInlineStyle(tokenIndex: number, colorMap: string[]): string;
810
+ getPresentation(tokenIndex: number): ITokenPresentation;
811
+ findTokenIndexAtOffset(offset: number): number;
812
+ getLineContent(): string;
813
+ getMetadata(tokenIndex: number): number;
814
+ getLanguageId(tokenIndex: number): string;
815
+ }
816
+ declare class LineTokens implements IViewLineTokens {
817
+ _lineTokensBrand: void;
818
+ private readonly _tokens;
819
+ private readonly _tokensCount;
820
+ private readonly _text;
821
+ private readonly _languageIdCodec;
822
+ static defaultTokenMetadata: number;
823
+ static createEmpty(lineContent: string, decoder: ILanguageIdCodec): LineTokens;
824
+ constructor(tokens: Uint32Array, text: string, decoder: ILanguageIdCodec);
825
+ equals(other: IViewLineTokens): boolean;
826
+ slicedEquals(other: LineTokens, sliceFromTokenIndex: number, sliceTokenCount: number): boolean;
827
+ getLineContent(): string;
828
+ getCount(): number;
829
+ getStartOffset(tokenIndex: number): number;
830
+ getMetadata(tokenIndex: number): number;
831
+ getLanguageId(tokenIndex: number): string;
832
+ getStandardTokenType(tokenIndex: number): StandardTokenType;
833
+ getForeground(tokenIndex: number): ColorId;
834
+ getClassName(tokenIndex: number): string;
835
+ getInlineStyle(tokenIndex: number, colorMap: string[]): string;
836
+ getPresentation(tokenIndex: number): ITokenPresentation;
837
+ getEndOffset(tokenIndex: number): number;
838
+ /**
839
+ * Find the token containing offset `offset`.
840
+ * @param offset The search offset
841
+ * @return The index of the token containing the offset.
842
+ */
843
+ findTokenIndexAtOffset(offset: number): number;
844
+ inflate(): IViewLineTokens;
845
+ sliceAndInflate(startOffset: number, endOffset: number, deltaOffset: number): IViewLineTokens;
846
+ static convertToEndOffset(tokens: Uint32Array, lineTextLength: number): void;
847
+ static findIndexInTokensArray(tokens: Uint32Array, desiredIndex: number): number;
848
+ /**
849
+ * @pure
850
+ * @param insertTokens Must be sorted by offset.
851
+ */
852
+ withInserted(insertTokens: {
853
+ offset: number;
854
+ text: string;
855
+ tokenMetadata: number;
856
+ }[]): LineTokens;
857
+ }
858
+
859
+ /**
860
+ * Describes how comments for a language work.
861
+ */
862
+ interface CommentRule {
863
+ /**
864
+ * The line comment token, like `// this is a comment`
865
+ */
866
+ lineComment?: string | null;
867
+ /**
868
+ * The block comment character pair, like `/* block comment *&#47;`
869
+ */
870
+ blockComment?: CharacterPair | null;
871
+ }
872
+ /**
873
+ * The language configuration interface defines the contract between extensions and
874
+ * various editor features, like automatic bracket insertion, automatic indentation etc.
875
+ */
876
+ interface LanguageConfiguration {
877
+ /**
878
+ * The language's comment settings.
879
+ */
880
+ comments?: CommentRule;
881
+ /**
882
+ * The language's brackets.
883
+ * This configuration implicitly affects pressing Enter around these brackets.
884
+ */
885
+ brackets?: CharacterPair[];
886
+ /**
887
+ * The language's word definition.
888
+ * If the language supports Unicode identifiers (e.g. JavaScript), it is preferable
889
+ * to provide a word definition that uses exclusion of known separators.
890
+ * e.g.: A regex that matches anything except known separators (and dot is allowed to occur in a floating point number):
891
+ * /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
892
+ */
893
+ wordPattern?: RegExp;
894
+ /**
895
+ * The language's indentation settings.
896
+ */
897
+ indentationRules?: IndentationRule;
898
+ /**
899
+ * The language's rules to be evaluated when pressing Enter.
900
+ */
901
+ onEnterRules?: OnEnterRule[];
902
+ /**
903
+ * The language's auto closing pairs. The 'close' character is automatically inserted with the
904
+ * 'open' character is typed. If not set, the configured brackets will be used.
905
+ */
906
+ autoClosingPairs?: IAutoClosingPairConditional[];
907
+ /**
908
+ * The language's surrounding pairs. When the 'open' character is typed on a selection, the
909
+ * selected string is surrounded by the open and close characters. If not set, the autoclosing pairs
910
+ * settings will be used.
911
+ */
912
+ surroundingPairs?: IAutoClosingPair[];
913
+ /**
914
+ * Defines a list of bracket pairs that are colorized depending on their nesting level.
915
+ * If not set, the configured brackets will be used.
916
+ */
917
+ colorizedBracketPairs?: CharacterPair[];
918
+ /**
919
+ * Defines what characters must be after the cursor for bracket or quote autoclosing to occur when using the \'languageDefined\' autoclosing setting.
920
+ *
921
+ * This is typically the set of characters which can not start an expression, such as whitespace, closing brackets, non-unary operators, etc.
922
+ */
923
+ autoCloseBefore?: string;
924
+ /**
925
+ * The language's folding rules.
926
+ */
927
+ folding?: FoldingRules;
928
+ /**
929
+ * **Deprecated** Do not use.
930
+ *
931
+ * @deprecated Will be replaced by a better API soon.
932
+ */
933
+ __electricCharacterSupport?: {
934
+ docComment?: IDocComment;
935
+ };
936
+ }
937
+ /**
938
+ * Describes indentation rules for a language.
939
+ */
940
+ interface IndentationRule {
941
+ /**
942
+ * If a line matches this pattern, then all the lines after it should be unindented once (until another rule matches).
943
+ */
944
+ decreaseIndentPattern: RegExp;
945
+ /**
946
+ * If a line matches this pattern, then all the lines after it should be indented once (until another rule matches).
947
+ */
948
+ increaseIndentPattern: RegExp;
949
+ /**
950
+ * If a line matches this pattern, then **only the next line** after it should be indented once.
951
+ */
952
+ indentNextLinePattern?: RegExp | null;
953
+ /**
954
+ * If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules.
955
+ */
956
+ unIndentedLinePattern?: RegExp | null;
957
+ }
958
+ /**
959
+ * Describes language specific folding markers such as '#region' and '#endregion'.
960
+ * The start and end regexes will be tested against the contents of all lines and must be designed efficiently:
961
+ * - the regex should start with '^'
962
+ * - regexp flags (i, g) are ignored
963
+ */
964
+ interface FoldingMarkers {
965
+ start: RegExp;
966
+ end: RegExp;
967
+ }
968
+ /**
969
+ * Describes folding rules for a language.
970
+ */
971
+ interface FoldingRules {
972
+ /**
973
+ * Used by the indentation based strategy to decide whether empty lines belong to the previous or the next block.
974
+ * A language adheres to the off-side rule if blocks in that language are expressed by their indentation.
975
+ * See [wikipedia](https://en.wikipedia.org/wiki/Off-side_rule) for more information.
976
+ * If not set, `false` is used and empty lines belong to the previous block.
977
+ */
978
+ offSide?: boolean;
979
+ /**
980
+ * Region markers used by the language.
981
+ */
982
+ markers?: FoldingMarkers;
983
+ }
984
+ /**
985
+ * Describes a rule to be evaluated when pressing Enter.
986
+ */
987
+ interface OnEnterRule {
988
+ /**
989
+ * This rule will only execute if the text before the cursor matches this regular expression.
990
+ */
991
+ beforeText: RegExp;
992
+ /**
993
+ * This rule will only execute if the text after the cursor matches this regular expression.
994
+ */
995
+ afterText?: RegExp;
996
+ /**
997
+ * This rule will only execute if the text above the this line matches this regular expression.
998
+ */
999
+ previousLineText?: RegExp;
1000
+ /**
1001
+ * The action to execute.
1002
+ */
1003
+ action: EnterAction;
1004
+ }
1005
+ /**
1006
+ * Definition of documentation comments (e.g. Javadoc/JSdoc)
1007
+ */
1008
+ interface IDocComment {
1009
+ /**
1010
+ * The string that starts a doc comment (e.g. '/**')
1011
+ */
1012
+ open: string;
1013
+ /**
1014
+ * The string that appears on the last line and closes the doc comment (e.g. ' * /').
1015
+ */
1016
+ close?: string;
1017
+ }
1018
+ /**
1019
+ * A tuple of two characters, like a pair of
1020
+ * opening and closing brackets.
1021
+ */
1022
+ declare type CharacterPair = [string, string];
1023
+ interface IAutoClosingPair {
1024
+ open: string;
1025
+ close: string;
1026
+ }
1027
+ interface IAutoClosingPairConditional extends IAutoClosingPair {
1028
+ notIn?: string[];
1029
+ }
1030
+ /**
1031
+ * Describes what to do with the indentation when pressing Enter.
1032
+ */
1033
+ declare enum IndentAction {
1034
+ /**
1035
+ * Insert new line and copy the previous line's indentation.
1036
+ */
1037
+ None = 0,
1038
+ /**
1039
+ * Insert new line and indent once (relative to the previous line's indentation).
1040
+ */
1041
+ Indent = 1,
1042
+ /**
1043
+ * Insert two new lines:
1044
+ * - the first one indented which will hold the cursor
1045
+ * - the second one at the same indentation level
1046
+ */
1047
+ IndentOutdent = 2,
1048
+ /**
1049
+ * Insert new line and outdent once (relative to the previous line's indentation).
1050
+ */
1051
+ Outdent = 3
1052
+ }
1053
+ /**
1054
+ * Describes what to do when pressing Enter.
1055
+ */
1056
+ interface EnterAction {
1057
+ /**
1058
+ * Describe what to do with the indentation.
1059
+ */
1060
+ indentAction: IndentAction;
1061
+ /**
1062
+ * Describes text to be appended after the new line and after the indentation.
1063
+ */
1064
+ appendText?: string;
1065
+ /**
1066
+ * Describes the number of characters to remove from the new line's indentation.
1067
+ */
1068
+ removeText?: number;
1069
+ }
1070
+
1071
+ /**
1072
+ * Captures all bracket related configurations for a single language.
1073
+ * Immutable.
1074
+ */
1075
+ declare class LanguageBracketsConfiguration {
1076
+ readonly languageId: string;
1077
+ private readonly _openingBrackets;
1078
+ private readonly _closingBrackets;
1079
+ constructor(languageId: string, config: LanguageConfiguration);
1080
+ /**
1081
+ * No two brackets have the same bracket text.
1082
+ */
1083
+ get openingBrackets(): readonly OpeningBracketKind[];
1084
+ /**
1085
+ * No two brackets have the same bracket text.
1086
+ */
1087
+ get closingBrackets(): readonly ClosingBracketKind[];
1088
+ getOpeningBracketInfo(bracketText: string): OpeningBracketKind | undefined;
1089
+ getClosingBracketInfo(bracketText: string): ClosingBracketKind | undefined;
1090
+ getBracketInfo(bracketText: string): BracketKind | undefined;
1091
+ }
1092
+ declare type BracketKind = OpeningBracketKind | ClosingBracketKind;
1093
+ declare class BracketKindBase {
1094
+ protected readonly config: LanguageBracketsConfiguration;
1095
+ readonly bracketText: string;
1096
+ constructor(config: LanguageBracketsConfiguration, bracketText: string);
1097
+ get languageId(): string;
1098
+ }
1099
+ declare class OpeningBracketKind extends BracketKindBase {
1100
+ readonly openedBrackets: ReadonlySet<ClosingBracketKind>;
1101
+ readonly isOpeningBracket = true;
1102
+ constructor(config: LanguageBracketsConfiguration, bracketText: string, openedBrackets: ReadonlySet<ClosingBracketKind>);
1103
+ }
1104
+ declare class ClosingBracketKind extends BracketKindBase {
1105
+ /**
1106
+ * Non empty array of all opening brackets this bracket closes.
1107
+ */
1108
+ readonly closedBrackets: ReadonlySet<OpeningBracketKind>;
1109
+ readonly isOpeningBracket = false;
1110
+ constructor(config: LanguageBracketsConfiguration, bracketText: string,
1111
+ /**
1112
+ * Non empty array of all opening brackets this bracket closes.
1113
+ */
1114
+ closedBrackets: ReadonlySet<OpeningBracketKind>);
1115
+ /**
1116
+ * Checks if this bracket closes the given other bracket.
1117
+ * Brackets from other language configuration can be used (they will always return false).
1118
+ * If other is a bracket with the same language id, they have to be from the same configuration.
1119
+ */
1120
+ closes(other: OpeningBracketKind): boolean;
1121
+ getClosedBrackets(): readonly OpeningBracketKind[];
1122
+ }
1123
+
1124
+ /**
1125
+ * Represents a non-negative length in terms of line and column count.
1126
+ * Does not allocate.
1127
+ */
1128
+ declare type Length = {
1129
+ _brand: 'Length';
1130
+ };
1131
+
1132
+ /**
1133
+ * Represents an immutable set that works best for a small number of elements (less than 32).
1134
+ * It uses bits to encode element membership efficiently.
1135
+ */
1136
+ declare class SmallImmutableSet<T> {
1137
+ private readonly items;
1138
+ private readonly additionalItems;
1139
+ private static cache;
1140
+ private static create;
1141
+ private static empty;
1142
+ static getEmpty<T>(): SmallImmutableSet<T>;
1143
+ private constructor();
1144
+ add(value: T, keyProvider: IDenseKeyProvider<T>): SmallImmutableSet<T>;
1145
+ has(value: T, keyProvider: IDenseKeyProvider<T>): boolean;
1146
+ merge(other: SmallImmutableSet<T>): SmallImmutableSet<T>;
1147
+ intersects(other: SmallImmutableSet<T>): boolean;
1148
+ equals(other: SmallImmutableSet<T>): boolean;
1149
+ }
1150
+ interface IDenseKeyProvider<T> {
1151
+ getKey(value: T): number;
1152
+ }
1153
+
1154
+ declare type OpeningBracketId = number;
1155
+
1156
+ declare const enum AstNodeKind {
1157
+ Text = 0,
1158
+ Bracket = 1,
1159
+ Pair = 2,
1160
+ UnexpectedClosingBracket = 3,
1161
+ List = 4
1162
+ }
1163
+ declare type AstNode = PairAstNode | ListAstNode | BracketAstNode | InvalidBracketAstNode | TextAstNode;
1164
+ /**
1165
+ * The base implementation for all AST nodes.
1166
+ */
1167
+ declare abstract class BaseAstNode {
1168
+ abstract readonly kind: AstNodeKind;
1169
+ abstract readonly childrenLength: number;
1170
+ /**
1171
+ * Might return null even if {@link idx} is smaller than {@link BaseAstNode.childrenLength}.
1172
+ */
1173
+ abstract getChild(idx: number): AstNode | null;
1174
+ /**
1175
+ * Try to avoid using this property, as implementations might need to allocate the resulting array.
1176
+ */
1177
+ abstract readonly children: readonly AstNode[];
1178
+ /**
1179
+ * Represents the set of all (potentially) missing opening bracket ids in this node.
1180
+ * E.g. in `{ ] ) }` that set is {`[`, `(` }.
1181
+ */
1182
+ abstract readonly missingOpeningBracketIds: SmallImmutableSet<OpeningBracketId>;
1183
+ /**
1184
+ * In case of a list, determines the height of the (2,3) tree.
1185
+ */
1186
+ abstract readonly listHeight: number;
1187
+ protected _length: Length;
1188
+ /**
1189
+ * The length of the entire node, which should equal the sum of lengths of all children.
1190
+ */
1191
+ get length(): Length;
1192
+ constructor(length: Length);
1193
+ /**
1194
+ * @param openBracketIds The set of all opening brackets that have not yet been closed.
1195
+ */
1196
+ abstract canBeReused(openBracketIds: SmallImmutableSet<OpeningBracketId>): boolean;
1197
+ /**
1198
+ * Flattens all lists in this AST. Only for debugging.
1199
+ */
1200
+ abstract flattenLists(): AstNode;
1201
+ /**
1202
+ * Creates a deep clone.
1203
+ */
1204
+ abstract deepClone(): AstNode;
1205
+ abstract computeMinIndentation(offset: Length, textModel: ITextModel): number;
1206
+ }
1207
+ /**
1208
+ * Represents a bracket pair including its child (e.g. `{ ... }`).
1209
+ * Might be unclosed.
1210
+ * Immutable, if all children are immutable.
1211
+ */
1212
+ declare class PairAstNode extends BaseAstNode {
1213
+ readonly openingBracket: BracketAstNode;
1214
+ readonly child: AstNode | null;
1215
+ readonly closingBracket: BracketAstNode | null;
1216
+ readonly missingOpeningBracketIds: SmallImmutableSet<OpeningBracketId>;
1217
+ static create(openingBracket: BracketAstNode, child: AstNode | null, closingBracket: BracketAstNode | null): PairAstNode;
1218
+ get kind(): AstNodeKind.Pair;
1219
+ get listHeight(): number;
1220
+ get childrenLength(): number;
1221
+ getChild(idx: number): AstNode | null;
1222
+ /**
1223
+ * Avoid using this property, it allocates an array!
1224
+ */
1225
+ get children(): AstNode[];
1226
+ private constructor();
1227
+ canBeReused(openBracketIds: SmallImmutableSet<OpeningBracketId>): boolean;
1228
+ flattenLists(): PairAstNode;
1229
+ deepClone(): PairAstNode;
1230
+ computeMinIndentation(offset: Length, textModel: ITextModel): number;
1231
+ }
1232
+ declare abstract class ListAstNode extends BaseAstNode {
1233
+ readonly listHeight: number;
1234
+ private _missingOpeningBracketIds;
1235
+ /**
1236
+ * This method uses more memory-efficient list nodes that can only store 2 or 3 children.
1237
+ */
1238
+ static create23(item1: AstNode, item2: AstNode, item3: AstNode | null, immutable?: boolean): ListAstNode;
1239
+ static create(items: AstNode[], immutable?: boolean): ListAstNode;
1240
+ static getEmpty(): ImmutableArrayListAstNode;
1241
+ get kind(): AstNodeKind.List;
1242
+ get missingOpeningBracketIds(): SmallImmutableSet<OpeningBracketId>;
1243
+ private cachedMinIndentation;
1244
+ /**
1245
+ * Use ListAstNode.create.
1246
+ */
1247
+ constructor(length: Length, listHeight: number, _missingOpeningBracketIds: SmallImmutableSet<OpeningBracketId>);
1248
+ protected throwIfImmutable(): void;
1249
+ protected abstract setChild(idx: number, child: AstNode): void;
1250
+ makeLastElementMutable(): AstNode | undefined;
1251
+ makeFirstElementMutable(): AstNode | undefined;
1252
+ canBeReused(openBracketIds: SmallImmutableSet<OpeningBracketId>): boolean;
1253
+ handleChildrenChanged(): void;
1254
+ flattenLists(): ListAstNode;
1255
+ computeMinIndentation(offset: Length, textModel: ITextModel): number;
1256
+ /**
1257
+ * Creates a shallow clone that is mutable, or itself if it is already mutable.
1258
+ */
1259
+ abstract toMutable(): ListAstNode;
1260
+ abstract appendChildOfSameHeight(node: AstNode): void;
1261
+ abstract unappendChild(): AstNode | undefined;
1262
+ abstract prependChildOfSameHeight(node: AstNode): void;
1263
+ abstract unprependChild(): AstNode | undefined;
1264
+ }
1265
+ /**
1266
+ * For debugging.
1267
+ */
1268
+ declare class ArrayListAstNode extends ListAstNode {
1269
+ private readonly _children;
1270
+ get childrenLength(): number;
1271
+ getChild(idx: number): AstNode | null;
1272
+ setChild(idx: number, child: AstNode): void;
1273
+ get children(): readonly AstNode[];
1274
+ constructor(length: Length, listHeight: number, _children: AstNode[], missingOpeningBracketIds: SmallImmutableSet<OpeningBracketId>);
1275
+ deepClone(): ListAstNode;
1276
+ appendChildOfSameHeight(node: AstNode): void;
1277
+ unappendChild(): AstNode | undefined;
1278
+ prependChildOfSameHeight(node: AstNode): void;
1279
+ unprependChild(): AstNode | undefined;
1280
+ toMutable(): ListAstNode;
1281
+ }
1282
+ /**
1283
+ * Immutable, if all children are immutable.
1284
+ */
1285
+ declare class ImmutableArrayListAstNode extends ArrayListAstNode {
1286
+ toMutable(): ListAstNode;
1287
+ protected throwIfImmutable(): void;
1288
+ }
1289
+ declare abstract class ImmutableLeafAstNode extends BaseAstNode {
1290
+ get listHeight(): number;
1291
+ get childrenLength(): number;
1292
+ getChild(idx: number): AstNode | null;
1293
+ get children(): readonly AstNode[];
1294
+ flattenLists(): this & AstNode;
1295
+ deepClone(): this & AstNode;
1296
+ }
1297
+ declare class TextAstNode extends ImmutableLeafAstNode {
1298
+ get kind(): AstNodeKind.Text;
1299
+ get missingOpeningBracketIds(): SmallImmutableSet<OpeningBracketId>;
1300
+ canBeReused(_openedBracketIds: SmallImmutableSet<OpeningBracketId>): boolean;
1301
+ computeMinIndentation(offset: Length, textModel: ITextModel): number;
1302
+ }
1303
+ declare class BracketAstNode extends ImmutableLeafAstNode {
1304
+ readonly bracketInfo: BracketKind;
1305
+ /**
1306
+ * In case of a opening bracket, this is the id of the opening bracket.
1307
+ * In case of a closing bracket, this contains the ids of all opening brackets it can close.
1308
+ */
1309
+ readonly bracketIds: SmallImmutableSet<OpeningBracketId>;
1310
+ static create(length: Length, bracketInfo: BracketKind, bracketIds: SmallImmutableSet<OpeningBracketId>): BracketAstNode;
1311
+ get kind(): AstNodeKind.Bracket;
1312
+ get missingOpeningBracketIds(): SmallImmutableSet<OpeningBracketId>;
1313
+ private constructor();
1314
+ get text(): string;
1315
+ get languageId(): string;
1316
+ canBeReused(_openedBracketIds: SmallImmutableSet<OpeningBracketId>): boolean;
1317
+ computeMinIndentation(offset: Length, textModel: ITextModel): number;
1318
+ }
1319
+ declare class InvalidBracketAstNode extends ImmutableLeafAstNode {
1320
+ get kind(): AstNodeKind.UnexpectedClosingBracket;
1321
+ readonly missingOpeningBracketIds: SmallImmutableSet<OpeningBracketId>;
1322
+ constructor(closingBrackets: SmallImmutableSet<OpeningBracketId>, length: Length);
1323
+ canBeReused(openedBracketIds: SmallImmutableSet<OpeningBracketId>): boolean;
1324
+ computeMinIndentation(offset: Length, textModel: ITextModel): number;
1325
+ }
1326
+
1327
+ interface IBracketPairsTextModelPart {
1328
+ /**
1329
+ * Is fired when bracket pairs change, either due to a text or a settings change.
1330
+ */
1331
+ onDidChange: Event<void>;
1332
+ /**
1333
+ * Gets all bracket pairs that intersect the given position.
1334
+ * The result is sorted by the start position.
1335
+ */
1336
+ getBracketPairsInRange(range: IRange): BracketPairInfo[];
1337
+ /**
1338
+ * Gets all bracket pairs that intersect the given position.
1339
+ * The result is sorted by the start position.
1340
+ */
1341
+ getBracketPairsInRangeWithMinIndentation(range: IRange): BracketPairWithMinIndentationInfo[];
1342
+ getBracketsInRange(range: IRange): BracketInfo[];
1343
+ /**
1344
+ * Find the matching bracket of `request` up, counting brackets.
1345
+ * @param request The bracket we're searching for
1346
+ * @param position The position at which to start the search.
1347
+ * @return The range of the matching bracket, or null if the bracket match was not found.
1348
+ */
1349
+ findMatchingBracketUp(bracket: string, position: IPosition, maxDuration?: number): Range | null;
1350
+ /**
1351
+ * Find the first bracket in the model before `position`.
1352
+ * @param position The position at which to start the search.
1353
+ * @return The info for the first bracket before `position`, or null if there are no more brackets before `positions`.
1354
+ */
1355
+ findPrevBracket(position: IPosition): IFoundBracket | null;
1356
+ /**
1357
+ * Find the first bracket in the model after `position`.
1358
+ * @param position The position at which to start the search.
1359
+ * @return The info for the first bracket after `position`, or null if there are no more brackets after `positions`.
1360
+ */
1361
+ findNextBracket(position: IPosition): IFoundBracket | null;
1362
+ /**
1363
+ * Find the enclosing brackets that contain `position`.
1364
+ * @param position The position at which to start the search.
1365
+ */
1366
+ findEnclosingBrackets(position: IPosition, maxDuration?: number): [Range, Range] | null;
1367
+ /**
1368
+ * Given a `position`, if the position is on top or near a bracket,
1369
+ * find the matching bracket of that bracket and return the ranges of both brackets.
1370
+ * @param position The position at which to look for a bracket.
1371
+ */
1372
+ matchBracket(position: IPosition, maxDuration?: number): [Range, Range] | null;
1373
+ }
1374
+ interface IFoundBracket {
1375
+ range: Range;
1376
+ bracketInfo: OpeningBracketKind | ClosingBracketKind;
1377
+ }
1378
+ declare class BracketInfo {
1379
+ readonly range: Range;
1380
+ /** 0-based level */
1381
+ readonly nestingLevel: number;
1382
+ readonly nestingLevelOfEqualBracketType: number;
1383
+ readonly isInvalid: boolean;
1384
+ constructor(range: Range,
1385
+ /** 0-based level */
1386
+ nestingLevel: number, nestingLevelOfEqualBracketType: number, isInvalid: boolean);
1387
+ }
1388
+ declare class BracketPairInfo {
1389
+ readonly range: Range;
1390
+ readonly openingBracketRange: Range;
1391
+ readonly closingBracketRange: Range | undefined;
1392
+ /** 0-based */
1393
+ readonly nestingLevel: number;
1394
+ readonly nestingLevelOfEqualBracketType: number;
1395
+ private readonly bracketPairNode;
1396
+ constructor(range: Range, openingBracketRange: Range, closingBracketRange: Range | undefined,
1397
+ /** 0-based */
1398
+ nestingLevel: number, nestingLevelOfEqualBracketType: number, bracketPairNode: PairAstNode);
1399
+ get openingBracketInfo(): OpeningBracketKind;
1400
+ get closingBracketInfo(): ClosingBracketKind | undefined;
1401
+ }
1402
+ declare class BracketPairWithMinIndentationInfo extends BracketPairInfo {
1403
+ /**
1404
+ * -1 if not requested, otherwise the size of the minimum indentation in the bracket pair in terms of visible columns.
1405
+ */
1406
+ readonly minVisibleColumnIndentation: number;
1407
+ constructor(range: Range, openingBracketRange: Range, closingBracketRange: Range | undefined,
1408
+ /**
1409
+ * 0-based
1410
+ */
1411
+ nestingLevel: number, nestingLevelOfEqualBracketType: number, bracketPairNode: PairAstNode,
1412
+ /**
1413
+ * -1 if not requested, otherwise the size of the minimum indentation in the bracket pair in terms of visible columns.
1414
+ */
1415
+ minVisibleColumnIndentation: number);
1416
+ }
1417
+
1418
+ /**
1419
+ * An event describing that the current language associated with a model has changed.
1420
+ */
1421
+ interface IModelLanguageChangedEvent {
1422
+ /**
1423
+ * Previous language
1424
+ */
1425
+ readonly oldLanguage: string;
1426
+ /**
1427
+ * New language
1428
+ */
1429
+ readonly newLanguage: string;
1430
+ }
1431
+ /**
1432
+ * An event describing that the language configuration associated with a model has changed.
1433
+ */
1434
+ interface IModelLanguageConfigurationChangedEvent {
1435
+ }
1436
+ interface IModelContentChange {
1437
+ /**
1438
+ * The range that got replaced.
1439
+ */
1440
+ readonly range: IRange;
1441
+ /**
1442
+ * The offset of the range that got replaced.
1443
+ */
1444
+ readonly rangeOffset: number;
1445
+ /**
1446
+ * The length of the range that got replaced.
1447
+ */
1448
+ readonly rangeLength: number;
1449
+ /**
1450
+ * The new text for the range.
1451
+ */
1452
+ readonly text: string;
1453
+ }
1454
+ /**
1455
+ * An event describing a change in the text of a model.
1456
+ */
1457
+ interface IModelContentChangedEvent {
1458
+ readonly changes: IModelContentChange[];
1459
+ /**
1460
+ * The (new) end-of-line character.
1461
+ */
1462
+ readonly eol: string;
1463
+ /**
1464
+ * The new version id the model has transitioned to.
1465
+ */
1466
+ readonly versionId: number;
1467
+ /**
1468
+ * Flag that indicates that this event was generated while undoing.
1469
+ */
1470
+ readonly isUndoing: boolean;
1471
+ /**
1472
+ * Flag that indicates that this event was generated while redoing.
1473
+ */
1474
+ readonly isRedoing: boolean;
1475
+ /**
1476
+ * Flag that indicates that all decorations were lost with this edit.
1477
+ * The model has been reset to a new value.
1478
+ */
1479
+ readonly isFlush: boolean;
1480
+ }
1481
+ /**
1482
+ * An event describing that model decorations have changed.
1483
+ */
1484
+ interface IModelDecorationsChangedEvent {
1485
+ readonly affectsMinimap: boolean;
1486
+ readonly affectsOverviewRuler: boolean;
1487
+ }
1488
+ /**
1489
+ * An event describing that some ranges of lines have been tokenized (their tokens have changed).
1490
+ * @internal
1491
+ */
1492
+ interface IModelTokensChangedEvent {
1493
+ readonly tokenizationSupportChanged: boolean;
1494
+ readonly semanticTokensApplied: boolean;
1495
+ readonly ranges: {
1496
+ /**
1497
+ * The start of the range (inclusive)
1498
+ */
1499
+ readonly fromLineNumber: number;
1500
+ /**
1501
+ * The end of the range (inclusive)
1502
+ */
1503
+ readonly toLineNumber: number;
1504
+ }[];
1505
+ }
1506
+ interface IModelOptionsChangedEvent {
1507
+ readonly tabSize: boolean;
1508
+ readonly indentSize: boolean;
1509
+ readonly insertSpaces: boolean;
1510
+ readonly trimAutoWhitespace: boolean;
1511
+ }
1512
+ /**
1513
+ * @internal
1514
+ */
1515
+ declare const enum RawContentChangedType {
1516
+ Flush = 1,
1517
+ LineChanged = 2,
1518
+ LinesDeleted = 3,
1519
+ LinesInserted = 4,
1520
+ EOLChanged = 5
1521
+ }
1522
+ /**
1523
+ * An event describing that a model has been reset to a new value.
1524
+ * @internal
1525
+ */
1526
+ declare class ModelRawFlush {
1527
+ readonly changeType = RawContentChangedType.Flush;
1528
+ }
1529
+ /**
1530
+ * Represents text injected on a line
1531
+ * @internal
1532
+ */
1533
+ declare class LineInjectedText {
1534
+ readonly ownerId: number;
1535
+ readonly lineNumber: number;
1536
+ readonly column: number;
1537
+ readonly options: InjectedTextOptions;
1538
+ readonly order: number;
1539
+ static applyInjectedText(lineText: string, injectedTexts: LineInjectedText[] | null): string;
1540
+ static fromDecorations(decorations: IModelDecoration[]): LineInjectedText[];
1541
+ constructor(ownerId: number, lineNumber: number, column: number, options: InjectedTextOptions, order: number);
1542
+ withText(text: string): LineInjectedText;
1543
+ }
1544
+ /**
1545
+ * An event describing that a line has changed in a model.
1546
+ * @internal
1547
+ */
1548
+ declare class ModelRawLineChanged {
1549
+ readonly changeType = RawContentChangedType.LineChanged;
1550
+ /**
1551
+ * The line that has changed.
1552
+ */
1553
+ readonly lineNumber: number;
1554
+ /**
1555
+ * The new value of the line.
1556
+ */
1557
+ readonly detail: string;
1558
+ /**
1559
+ * The injected text on the line.
1560
+ */
1561
+ readonly injectedText: LineInjectedText[] | null;
1562
+ constructor(lineNumber: number, detail: string, injectedText: LineInjectedText[] | null);
1563
+ }
1564
+ /**
1565
+ * An event describing that line(s) have been deleted in a model.
1566
+ * @internal
1567
+ */
1568
+ declare class ModelRawLinesDeleted {
1569
+ readonly changeType = RawContentChangedType.LinesDeleted;
1570
+ /**
1571
+ * At what line the deletion began (inclusive).
1572
+ */
1573
+ readonly fromLineNumber: number;
1574
+ /**
1575
+ * At what line the deletion stopped (inclusive).
1576
+ */
1577
+ readonly toLineNumber: number;
1578
+ constructor(fromLineNumber: number, toLineNumber: number);
1579
+ }
1580
+ /**
1581
+ * An event describing that line(s) have been inserted in a model.
1582
+ * @internal
1583
+ */
1584
+ declare class ModelRawLinesInserted {
1585
+ readonly changeType = RawContentChangedType.LinesInserted;
1586
+ /**
1587
+ * Before what line did the insertion begin
1588
+ */
1589
+ readonly fromLineNumber: number;
1590
+ /**
1591
+ * `toLineNumber` - `fromLineNumber` + 1 denotes the number of lines that were inserted
1592
+ */
1593
+ readonly toLineNumber: number;
1594
+ /**
1595
+ * The text that was inserted
1596
+ */
1597
+ readonly detail: string[];
1598
+ /**
1599
+ * The injected texts for every inserted line.
1600
+ */
1601
+ readonly injectedTexts: (LineInjectedText[] | null)[];
1602
+ constructor(fromLineNumber: number, toLineNumber: number, detail: string[], injectedTexts: (LineInjectedText[] | null)[]);
1603
+ }
1604
+ /**
1605
+ * An event describing that a model has had its EOL changed.
1606
+ * @internal
1607
+ */
1608
+ declare class ModelRawEOLChanged {
1609
+ readonly changeType = RawContentChangedType.EOLChanged;
1610
+ }
1611
+ /**
1612
+ * @internal
1613
+ */
1614
+ declare type ModelRawChange = ModelRawFlush | ModelRawLineChanged | ModelRawLinesDeleted | ModelRawLinesInserted | ModelRawEOLChanged;
1615
+ /**
1616
+ * An event describing a change in the text of a model.
1617
+ * @internal
1618
+ */
1619
+ declare class ModelRawContentChangedEvent {
1620
+ readonly changes: ModelRawChange[];
1621
+ /**
1622
+ * The new version id the model has transitioned to.
1623
+ */
1624
+ readonly versionId: number;
1625
+ /**
1626
+ * Flag that indicates that this event was generated while undoing.
1627
+ */
1628
+ readonly isUndoing: boolean;
1629
+ /**
1630
+ * Flag that indicates that this event was generated while redoing.
1631
+ */
1632
+ readonly isRedoing: boolean;
1633
+ resultingSelection: Selection[] | null;
1634
+ constructor(changes: ModelRawChange[], versionId: number, isUndoing: boolean, isRedoing: boolean);
1635
+ containsEvent(type: RawContentChangedType): boolean;
1636
+ static merge(a: ModelRawContentChangedEvent, b: ModelRawContentChangedEvent): ModelRawContentChangedEvent;
1637
+ }
1638
+ /**
1639
+ * An event describing a change in injected text.
1640
+ * @internal
1641
+ */
1642
+ declare class ModelInjectedTextChangedEvent {
1643
+ readonly changes: ModelRawLineChanged[];
1644
+ constructor(changes: ModelRawLineChanged[]);
1645
+ }
1646
+ /**
1647
+ * @internal
1648
+ */
1649
+ declare class InternalModelContentChangeEvent {
1650
+ readonly rawContentChangedEvent: ModelRawContentChangedEvent;
1651
+ readonly contentChangedEvent: IModelContentChangedEvent;
1652
+ constructor(rawContentChangedEvent: ModelRawContentChangedEvent, contentChangedEvent: IModelContentChangedEvent);
1653
+ merge(other: InternalModelContentChangeEvent): InternalModelContentChangeEvent;
1654
+ private static _mergeChangeEvents;
1655
+ }
1656
+
1657
+ interface IGuidesTextModelPart {
1658
+ /**
1659
+ * @internal
1660
+ */
1661
+ getActiveIndentGuide(lineNumber: number, minLineNumber: number, maxLineNumber: number): IActiveIndentGuideInfo;
1662
+ /**
1663
+ * @internal
1664
+ */
1665
+ getLinesIndentGuides(startLineNumber: number, endLineNumber: number): number[];
1666
+ /**
1667
+ * Requests the the indent guides for the given range of lines.
1668
+ * `result[i]` will contain the indent guides of the `startLineNumber + i`th line.
1669
+ * @internal
1670
+ */
1671
+ getLinesBracketGuides(startLineNumber: number, endLineNumber: number, activePosition: IPosition | null, options: BracketGuideOptions): IndentGuide[][];
1672
+ }
1673
+ interface IActiveIndentGuideInfo {
1674
+ startLineNumber: number;
1675
+ endLineNumber: number;
1676
+ indent: number;
1677
+ }
1678
+ declare enum HorizontalGuidesState {
1679
+ Disabled = 0,
1680
+ EnabledForActive = 1,
1681
+ Enabled = 2
1682
+ }
1683
+ interface BracketGuideOptions {
1684
+ includeInactive: boolean;
1685
+ horizontalGuides: HorizontalGuidesState;
1686
+ highlightActive: boolean;
1687
+ }
1688
+ declare class IndentGuide {
1689
+ readonly visibleColumn: number | -1;
1690
+ readonly column: number | -1;
1691
+ readonly className: string;
1692
+ /**
1693
+ * If set, this indent guide is a horizontal guide (no vertical part).
1694
+ * It starts at visibleColumn and continues until endColumn.
1695
+ */
1696
+ readonly horizontalLine: IndentGuideHorizontalLine | null;
1697
+ /**
1698
+ * If set (!= -1), only show this guide for wrapped lines that don't contain this model column, but are after it.
1699
+ */
1700
+ readonly forWrappedLinesAfterColumn: number | -1;
1701
+ readonly forWrappedLinesBeforeOrAtColumn: number | -1;
1702
+ constructor(visibleColumn: number | -1, column: number | -1, className: string,
1703
+ /**
1704
+ * If set, this indent guide is a horizontal guide (no vertical part).
1705
+ * It starts at visibleColumn and continues until endColumn.
1706
+ */
1707
+ horizontalLine: IndentGuideHorizontalLine | null,
1708
+ /**
1709
+ * If set (!= -1), only show this guide for wrapped lines that don't contain this model column, but are after it.
1710
+ */
1711
+ forWrappedLinesAfterColumn: number | -1, forWrappedLinesBeforeOrAtColumn: number | -1);
1712
+ }
1713
+ declare class IndentGuideHorizontalLine {
1714
+ readonly top: boolean;
1715
+ readonly endColumn: number;
1716
+ constructor(top: boolean, endColumn: number);
1717
+ }
1718
+
1719
+ /**
1720
+ * Represents contiguous tokens over a contiguous range of lines.
1721
+ */
1722
+ declare class ContiguousMultilineTokens {
1723
+ static deserialize(buff: Uint8Array, offset: number, result: ContiguousMultilineTokens[]): number;
1724
+ /**
1725
+ * The start line number for this block of tokens.
1726
+ */
1727
+ private _startLineNumber;
1728
+ /**
1729
+ * The tokens are stored in a binary format. There is an element for each line,
1730
+ * so `tokens[index]` contains all tokens on line `startLineNumber + index`.
1731
+ *
1732
+ * On a specific line, each token occupies two array indices. For token i:
1733
+ * - at offset 2*i => endOffset
1734
+ * - at offset 2*i + 1 => metadata
1735
+ *
1736
+ */
1737
+ private _tokens;
1738
+ /**
1739
+ * (Inclusive) start line number for these tokens.
1740
+ */
1741
+ get startLineNumber(): number;
1742
+ /**
1743
+ * (Inclusive) end line number for these tokens.
1744
+ */
1745
+ get endLineNumber(): number;
1746
+ constructor(startLineNumber: number, tokens: Uint32Array[]);
1747
+ /**
1748
+ * @see {@link _tokens}
1749
+ */
1750
+ getLineTokens(lineNumber: number): Uint32Array | ArrayBuffer | null;
1751
+ appendLineTokens(lineTokens: Uint32Array): void;
1752
+ serializeSize(): number;
1753
+ serialize(destination: Uint8Array, offset: number): number;
1754
+ applyEdit(range: IRange, text: string): void;
1755
+ private _acceptDeleteRange;
1756
+ private _acceptInsertText;
1757
+ private _insertLines;
1758
+ }
1759
+
1760
+ /**
1761
+ * Represents sparse tokens over a contiguous range of lines.
1762
+ */
1763
+ declare class SparseMultilineTokens {
1764
+ static create(startLineNumber: number, tokens: Uint32Array): SparseMultilineTokens;
1765
+ private _startLineNumber;
1766
+ private _endLineNumber;
1767
+ private readonly _tokens;
1768
+ /**
1769
+ * (Inclusive) start line number for these tokens.
1770
+ */
1771
+ get startLineNumber(): number;
1772
+ /**
1773
+ * (Inclusive) end line number for these tokens.
1774
+ */
1775
+ get endLineNumber(): number;
1776
+ private constructor();
1777
+ toString(): string;
1778
+ private _updateEndLineNumber;
1779
+ isEmpty(): boolean;
1780
+ getLineTokens(lineNumber: number): SparseLineTokens | null;
1781
+ getRange(): Range | null;
1782
+ removeTokens(range: Range): void;
1783
+ split(range: Range): [SparseMultilineTokens, SparseMultilineTokens];
1784
+ applyEdit(range: IRange, text: string): void;
1785
+ acceptEdit(range: IRange, eolCount: number, firstLineLength: number, lastLineLength: number, firstCharCode: number): void;
1786
+ private _acceptDeleteRange;
1787
+ private _acceptInsertText;
1788
+ }
1789
+ declare class SparseLineTokens {
1790
+ private readonly _tokens;
1791
+ constructor(tokens: Uint32Array);
1792
+ getCount(): number;
1793
+ getStartCharacter(tokenIndex: number): number;
1794
+ getEndCharacter(tokenIndex: number): number;
1795
+ getMetadata(tokenIndex: number): number;
1796
+ }
1797
+
1798
+ /**
1799
+ * Provides tokenization related functionality of the text model.
1800
+ */
1801
+ interface ITokenizationTextModelPart {
1802
+ /**
1803
+ * @internal
1804
+ */
1805
+ setTokens(tokens: ContiguousMultilineTokens[]): void;
1806
+ /**
1807
+ * Replaces all semantic tokens with the provided `tokens`.
1808
+ * @internal
1809
+ */
1810
+ setSemanticTokens(tokens: SparseMultilineTokens[] | null, isComplete: boolean): void;
1811
+ /**
1812
+ * Merges the provided semantic tokens into existing semantic tokens.
1813
+ * @internal
1814
+ */
1815
+ setPartialSemanticTokens(range: Range, tokens: SparseMultilineTokens[] | null): void;
1816
+ /**
1817
+ * @internal
1818
+ */
1819
+ hasCompleteSemanticTokens(): boolean;
1820
+ /**
1821
+ * @internal
1822
+ */
1823
+ hasSomeSemanticTokens(): boolean;
1824
+ /**
1825
+ * Flush all tokenization state.
1826
+ * @internal
1827
+ */
1828
+ resetTokenization(): void;
1829
+ /**
1830
+ * Force tokenization information for `lineNumber` to be accurate.
1831
+ * @internal
1832
+ */
1833
+ forceTokenization(lineNumber: number): void;
1834
+ /**
1835
+ * If it is cheap, force tokenization information for `lineNumber` to be accurate.
1836
+ * This is based on a heuristic.
1837
+ * @internal
1838
+ */
1839
+ tokenizeIfCheap(lineNumber: number): void;
1840
+ /**
1841
+ * Check if calling `forceTokenization` for this `lineNumber` will be cheap (time-wise).
1842
+ * This is based on a heuristic.
1843
+ * @internal
1844
+ */
1845
+ isCheapToTokenize(lineNumber: number): boolean;
1846
+ /**
1847
+ * Get the tokens for the line `lineNumber`.
1848
+ * The tokens might be inaccurate. Use `forceTokenization` to ensure accurate tokens.
1849
+ * @internal
1850
+ */
1851
+ getLineTokens(lineNumber: number): LineTokens;
1852
+ /**
1853
+ * Returns the standard token type for a character if the character were to be inserted at
1854
+ * the given position. If the result cannot be accurate, it returns null.
1855
+ * @internal
1856
+ */
1857
+ getTokenTypeIfInsertingCharacter(lineNumber: number, column: number, character: string): StandardTokenType;
1858
+ /**
1859
+ * @internal
1860
+ */
1861
+ tokenizeLineWithEdit(position: IPosition, length: number, newText: string): LineTokens | null;
1862
+ /**
1863
+ * @internal
1864
+ */
1865
+ tokenizeViewport(startLineNumber: number, endLineNumber: number): void;
1866
+ getLanguageId(): string;
1867
+ getLanguageIdAtPosition(lineNumber: number, column: number): string;
1868
+ setLanguageId(languageId: string): void;
1869
+ readonly backgroundTokenizationState: BackgroundTokenizationState;
1870
+ readonly onBackgroundTokenizationStateChanged: Event<void>;
1871
+ }
1872
+ declare const enum BackgroundTokenizationState {
1873
+ Uninitialized = 0,
1874
+ InProgress = 1,
1875
+ Completed = 2
1876
+ }
1877
+
1878
+ interface ThemeColor {
1879
+ id: string;
1880
+ }
1881
+ declare namespace ThemeColor {
1882
+ function isThemeColor(obj: any): obj is ThemeColor;
1883
+ }
1884
+
1885
+ /**
1886
+ * Vertical Lane in the overview ruler of the editor.
1887
+ */
1888
+ declare enum OverviewRulerLane {
1889
+ Left = 1,
1890
+ Center = 2,
1891
+ Right = 4,
1892
+ Full = 7
1893
+ }
1894
+ /**
1895
+ * Position in the minimap to render the decoration.
1896
+ */
1897
+ declare enum MinimapPosition {
1898
+ Inline = 1,
1899
+ Gutter = 2
1900
+ }
1901
+ interface IDecorationOptions {
1902
+ /**
1903
+ * CSS color to render.
1904
+ * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
1905
+ */
1906
+ color: string | ThemeColor | undefined;
1907
+ /**
1908
+ * CSS color to render.
1909
+ * e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
1910
+ */
1911
+ darkColor?: string | ThemeColor;
1912
+ }
1913
+ /**
1914
+ * Options for rendering a model decoration in the overview ruler.
1915
+ */
1916
+ interface IModelDecorationOverviewRulerOptions extends IDecorationOptions {
1917
+ /**
1918
+ * The position in the overview ruler.
1919
+ */
1920
+ position: OverviewRulerLane;
1921
+ }
1922
+ /**
1923
+ * Options for rendering a model decoration in the overview ruler.
1924
+ */
1925
+ interface IModelDecorationMinimapOptions extends IDecorationOptions {
1926
+ /**
1927
+ * The position in the overview ruler.
1928
+ */
1929
+ position: MinimapPosition;
1930
+ }
1931
+ /**
1932
+ * Options for a model decoration.
1933
+ */
1934
+ interface IModelDecorationOptions {
1935
+ /**
1936
+ * A debug description that can be used for inspecting model decorations.
1937
+ * @internal
1938
+ */
1939
+ description: string;
1940
+ /**
1941
+ * Customize the growing behavior of the decoration when typing at the edges of the decoration.
1942
+ * Defaults to TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges
1943
+ */
1944
+ stickiness?: TrackedRangeStickiness;
1945
+ /**
1946
+ * CSS class name describing the decoration.
1947
+ */
1948
+ className?: string | null;
1949
+ /**
1950
+ * Message to be rendered when hovering over the glyph margin decoration.
1951
+ */
1952
+ glyphMarginHoverMessage?: IMarkdownString | IMarkdownString[] | null;
1953
+ /**
1954
+ * Array of MarkdownString to render as the decoration message.
1955
+ */
1956
+ hoverMessage?: IMarkdownString | IMarkdownString[] | null;
1957
+ /**
1958
+ * Should the decoration expand to encompass a whole line.
1959
+ */
1960
+ isWholeLine?: boolean;
1961
+ /**
1962
+ * Always render the decoration (even when the range it encompasses is collapsed).
1963
+ * @internal
1964
+ */
1965
+ showIfCollapsed?: boolean;
1966
+ /**
1967
+ * Collapse the decoration if its entire range is being replaced via an edit.
1968
+ * @internal
1969
+ */
1970
+ collapseOnReplaceEdit?: boolean;
1971
+ /**
1972
+ * Specifies the stack order of a decoration.
1973
+ * A decoration with greater stack order is always in front of a decoration with
1974
+ * a lower stack order when the decorations are on the same line.
1975
+ */
1976
+ zIndex?: number;
1977
+ /**
1978
+ * If set, render this decoration in the overview ruler.
1979
+ */
1980
+ overviewRuler?: IModelDecorationOverviewRulerOptions | null;
1981
+ /**
1982
+ * If set, render this decoration in the minimap.
1983
+ */
1984
+ minimap?: IModelDecorationMinimapOptions | null;
1985
+ /**
1986
+ * If set, the decoration will be rendered in the glyph margin with this CSS class name.
1987
+ */
1988
+ glyphMarginClassName?: string | null;
1989
+ /**
1990
+ * If set, the decoration will be rendered in the lines decorations with this CSS class name.
1991
+ */
1992
+ linesDecorationsClassName?: string | null;
1993
+ /**
1994
+ * If set, the decoration will be rendered in the lines decorations with this CSS class name, but only for the first line in case of line wrapping.
1995
+ */
1996
+ firstLineDecorationClassName?: string | null;
1997
+ /**
1998
+ * If set, the decoration will be rendered in the margin (covering its full width) with this CSS class name.
1999
+ */
2000
+ marginClassName?: string | null;
2001
+ /**
2002
+ * If set, the decoration will be rendered inline with the text with this CSS class name.
2003
+ * Please use this only for CSS rules that must impact the text. For example, use `className`
2004
+ * to have a background color decoration.
2005
+ */
2006
+ inlineClassName?: string | null;
2007
+ /**
2008
+ * If there is an `inlineClassName` which affects letter spacing.
2009
+ */
2010
+ inlineClassNameAffectsLetterSpacing?: boolean;
2011
+ /**
2012
+ * If set, the decoration will be rendered before the text with this CSS class name.
2013
+ */
2014
+ beforeContentClassName?: string | null;
2015
+ /**
2016
+ * If set, the decoration will be rendered after the text with this CSS class name.
2017
+ */
2018
+ afterContentClassName?: string | null;
2019
+ /**
2020
+ * If set, text will be injected in the view after the range.
2021
+ */
2022
+ after?: InjectedTextOptions | null;
2023
+ /**
2024
+ * If set, text will be injected in the view before the range.
2025
+ */
2026
+ before?: InjectedTextOptions | null;
2027
+ /**
2028
+ * If set, this decoration will not be rendered for comment tokens.
2029
+ * @internal
2030
+ */
2031
+ hideInCommentTokens?: boolean | null;
2032
+ /**
2033
+ * If set, this decoration will not be rendered for string tokens.
2034
+ * @internal
2035
+ */
2036
+ hideInStringTokens?: boolean | null;
2037
+ }
2038
+ /**
2039
+ * Configures text that is injected into the view without changing the underlying document.
2040
+ */
2041
+ interface InjectedTextOptions {
2042
+ /**
2043
+ * Sets the text to inject. Must be a single line.
2044
+ */
2045
+ readonly content: string;
2046
+ /**
2047
+ * If set, the decoration will be rendered inline with the text with this CSS class name.
2048
+ */
2049
+ readonly inlineClassName?: string | null;
2050
+ /**
2051
+ * If there is an `inlineClassName` which affects letter spacing.
2052
+ */
2053
+ readonly inlineClassNameAffectsLetterSpacing?: boolean;
2054
+ /**
2055
+ * This field allows to attach data to this injected text.
2056
+ * The data can be read when injected texts at a given position are queried.
2057
+ */
2058
+ readonly attachedData?: unknown;
2059
+ /**
2060
+ * Configures cursor stops around injected text.
2061
+ * Defaults to {@link InjectedTextCursorStops.Both}.
2062
+ */
2063
+ readonly cursorStops?: InjectedTextCursorStops | null;
2064
+ }
2065
+ declare enum InjectedTextCursorStops {
2066
+ Both = 0,
2067
+ Right = 1,
2068
+ Left = 2,
2069
+ None = 3
2070
+ }
2071
+ /**
2072
+ * New model decorations.
2073
+ */
2074
+ interface IModelDeltaDecoration {
2075
+ /**
2076
+ * Range that this decoration covers.
2077
+ */
2078
+ range: IRange;
2079
+ /**
2080
+ * Options associated with this decoration.
2081
+ */
2082
+ options: IModelDecorationOptions;
2083
+ }
2084
+ /**
2085
+ * A decoration in the model.
2086
+ */
2087
+ interface IModelDecoration {
2088
+ /**
2089
+ * Identifier for a decoration.
2090
+ */
2091
+ readonly id: string;
2092
+ /**
2093
+ * Identifier for a decoration's owner.
2094
+ */
2095
+ readonly ownerId: number;
2096
+ /**
2097
+ * Range that this decoration covers.
2098
+ */
2099
+ readonly range: Range;
2100
+ /**
2101
+ * Options associated with this decoration.
2102
+ */
2103
+ readonly options: IModelDecorationOptions;
2104
+ }
2105
+ /**
2106
+ * An accessor that can add, change or remove model decorations.
2107
+ * @internal
2108
+ */
2109
+ interface IModelDecorationsChangeAccessor {
2110
+ /**
2111
+ * Add a new decoration.
2112
+ * @param range Range that this decoration covers.
2113
+ * @param options Options associated with this decoration.
2114
+ * @return An unique identifier associated with this decoration.
2115
+ */
2116
+ addDecoration(range: IRange, options: IModelDecorationOptions): string;
2117
+ /**
2118
+ * Change the range that an existing decoration covers.
2119
+ * @param id The unique identifier associated with the decoration.
2120
+ * @param newRange The new range that this decoration covers.
2121
+ */
2122
+ changeDecoration(id: string, newRange: IRange): void;
2123
+ /**
2124
+ * Change the options associated with an existing decoration.
2125
+ * @param id The unique identifier associated with the decoration.
2126
+ * @param newOptions The new options associated with this decoration.
2127
+ */
2128
+ changeDecorationOptions(id: string, newOptions: IModelDecorationOptions): void;
2129
+ /**
2130
+ * Remove an existing decoration.
2131
+ * @param id The unique identifier associated with the decoration.
2132
+ */
2133
+ removeDecoration(id: string): void;
2134
+ /**
2135
+ * Perform a minimum amount of operations, in order to transform the decorations
2136
+ * identified by `oldDecorations` to the decorations described by `newDecorations`
2137
+ * and returns the new identifiers associated with the resulting decorations.
2138
+ *
2139
+ * @param oldDecorations Array containing previous decorations identifiers.
2140
+ * @param newDecorations Array describing what decorations should result after the call.
2141
+ * @return An array containing the new decorations identifiers.
2142
+ */
2143
+ deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[];
2144
+ }
2145
+ /**
2146
+ * End of line character preference.
2147
+ */
2148
+ declare const enum EndOfLinePreference {
2149
+ /**
2150
+ * Use the end of line character identified in the text buffer.
2151
+ */
2152
+ TextDefined = 0,
2153
+ /**
2154
+ * Use line feed (\n) as the end of line character.
2155
+ */
2156
+ LF = 1,
2157
+ /**
2158
+ * Use carriage return and line feed (\r\n) as the end of line character.
2159
+ */
2160
+ CRLF = 2
2161
+ }
2162
+ /**
2163
+ * The default end of line to use when instantiating models.
2164
+ */
2165
+ declare const enum DefaultEndOfLine {
2166
+ /**
2167
+ * Use line feed (\n) as the end of line character.
2168
+ */
2169
+ LF = 1,
2170
+ /**
2171
+ * Use carriage return and line feed (\r\n) as the end of line character.
2172
+ */
2173
+ CRLF = 2
2174
+ }
2175
+ /**
2176
+ * End of line character preference.
2177
+ */
2178
+ declare const enum EndOfLineSequence {
2179
+ /**
2180
+ * Use line feed (\n) as the end of line character.
2181
+ */
2182
+ LF = 0,
2183
+ /**
2184
+ * Use carriage return and line feed (\r\n) as the end of line character.
2185
+ */
2186
+ CRLF = 1
2187
+ }
2188
+ /**
2189
+ * An identifier for a single edit operation.
2190
+ * @internal
2191
+ */
2192
+ interface ISingleEditOperationIdentifier {
2193
+ /**
2194
+ * Identifier major
2195
+ */
2196
+ major: number;
2197
+ /**
2198
+ * Identifier minor
2199
+ */
2200
+ minor: number;
2201
+ }
2202
+ /**
2203
+ * A single edit operation, that has an identifier.
2204
+ */
2205
+ interface IIdentifiedSingleEditOperation extends ISingleEditOperation {
2206
+ /**
2207
+ * An identifier associated with this single edit operation.
2208
+ * @internal
2209
+ */
2210
+ identifier?: ISingleEditOperationIdentifier | null;
2211
+ /**
2212
+ * This indicates that this operation is inserting automatic whitespace
2213
+ * that can be removed on next model edit operation if `config.trimAutoWhitespace` is true.
2214
+ * @internal
2215
+ */
2216
+ isAutoWhitespaceEdit?: boolean;
2217
+ /**
2218
+ * This indicates that this operation is in a set of operations that are tracked and should not be "simplified".
2219
+ * @internal
2220
+ */
2221
+ _isTracked?: boolean;
2222
+ }
2223
+ interface IValidEditOperation {
2224
+ /**
2225
+ * An identifier associated with this single edit operation.
2226
+ * @internal
2227
+ */
2228
+ identifier: ISingleEditOperationIdentifier | null;
2229
+ /**
2230
+ * The range to replace. This can be empty to emulate a simple insert.
2231
+ */
2232
+ range: Range;
2233
+ /**
2234
+ * The text to replace with. This can be empty to emulate a simple delete.
2235
+ */
2236
+ text: string;
2237
+ /**
2238
+ * @internal
2239
+ */
2240
+ textChange: TextChange;
2241
+ }
2242
+ /**
2243
+ * A callback that can compute the cursor state after applying a series of edit operations.
2244
+ */
2245
+ interface ICursorStateComputer {
2246
+ /**
2247
+ * A callback that can compute the resulting cursors state after some edit operations have been executed.
2248
+ */
2249
+ (inverseEditOperations: IValidEditOperation[]): Selection[] | null;
2250
+ }
2251
+ declare class TextModelResolvedOptions {
2252
+ _textModelResolvedOptionsBrand: void;
2253
+ readonly tabSize: number;
2254
+ readonly indentSize: number;
2255
+ readonly insertSpaces: boolean;
2256
+ readonly defaultEOL: DefaultEndOfLine;
2257
+ readonly trimAutoWhitespace: boolean;
2258
+ readonly bracketPairColorizationOptions: BracketPairColorizationOptions;
2259
+ /**
2260
+ * @internal
2261
+ */
2262
+ constructor(src: {
2263
+ tabSize: number;
2264
+ indentSize: number;
2265
+ insertSpaces: boolean;
2266
+ defaultEOL: DefaultEndOfLine;
2267
+ trimAutoWhitespace: boolean;
2268
+ bracketPairColorizationOptions: BracketPairColorizationOptions;
2269
+ });
2270
+ /**
2271
+ * @internal
2272
+ */
2273
+ equals(other: TextModelResolvedOptions): boolean;
2274
+ /**
2275
+ * @internal
2276
+ */
2277
+ createChangeEvent(newOpts: TextModelResolvedOptions): IModelOptionsChangedEvent;
2278
+ }
2279
+ interface BracketPairColorizationOptions {
2280
+ enabled: boolean;
2281
+ independentColorPoolPerBracketType: boolean;
2282
+ }
2283
+ interface ITextModelUpdateOptions {
2284
+ tabSize?: number;
2285
+ indentSize?: number;
2286
+ insertSpaces?: boolean;
2287
+ trimAutoWhitespace?: boolean;
2288
+ bracketColorizationOptions?: BracketPairColorizationOptions;
2289
+ }
2290
+ declare class FindMatch {
2291
+ _findMatchBrand: void;
2292
+ readonly range: Range;
2293
+ readonly matches: string[] | null;
2294
+ /**
2295
+ * @internal
2296
+ */
2297
+ constructor(range: Range, matches: string[] | null);
2298
+ }
2299
+ /**
2300
+ * Describes the behavior of decorations when typing/editing near their edges.
2301
+ * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
2302
+ */
2303
+ declare const enum TrackedRangeStickiness {
2304
+ AlwaysGrowsWhenTypingAtEdges = 0,
2305
+ NeverGrowsWhenTypingAtEdges = 1,
2306
+ GrowsOnlyWhenTypingBefore = 2,
2307
+ GrowsOnlyWhenTypingAfter = 3
2308
+ }
2309
+ /**
2310
+ * Text snapshot that works like an iterator.
2311
+ * Will try to return chunks of roughly ~64KB size.
2312
+ * Will return null when finished.
2313
+ *
2314
+ * @internal
2315
+ */
2316
+ interface ITextSnapshot {
2317
+ read(): string | null;
2318
+ }
2319
+ /**
2320
+ * A model.
2321
+ */
2322
+ interface ITextModel {
2323
+ /**
2324
+ * Gets the resource associated with this editor model.
2325
+ */
2326
+ readonly uri: URI;
2327
+ /**
2328
+ * A unique identifier associated with this model.
2329
+ */
2330
+ readonly id: string;
2331
+ /**
2332
+ * This model is constructed for a simple widget code editor.
2333
+ * @internal
2334
+ */
2335
+ readonly isForSimpleWidget: boolean;
2336
+ /**
2337
+ * If true, the text model might contain RTL.
2338
+ * If false, the text model **contains only** contain LTR.
2339
+ * @internal
2340
+ */
2341
+ mightContainRTL(): boolean;
2342
+ /**
2343
+ * If true, the text model might contain LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS).
2344
+ * If false, the text model definitely does not contain these.
2345
+ * @internal
2346
+ */
2347
+ mightContainUnusualLineTerminators(): boolean;
2348
+ /**
2349
+ * @internal
2350
+ */
2351
+ removeUnusualLineTerminators(selections?: Selection[]): void;
2352
+ /**
2353
+ * If true, the text model might contain non basic ASCII.
2354
+ * If false, the text model **contains only** basic ASCII.
2355
+ * @internal
2356
+ */
2357
+ mightContainNonBasicASCII(): boolean;
2358
+ /**
2359
+ * Get the resolved options for this model.
2360
+ */
2361
+ getOptions(): TextModelResolvedOptions;
2362
+ /**
2363
+ * Get the formatting options for this model.
2364
+ * @internal
2365
+ */
2366
+ getFormattingOptions(): FormattingOptions;
2367
+ /**
2368
+ * Get the current version id of the model.
2369
+ * Anytime a change happens to the model (even undo/redo),
2370
+ * the version id is incremented.
2371
+ */
2372
+ getVersionId(): number;
2373
+ /**
2374
+ * Get the alternative version id of the model.
2375
+ * This alternative version id is not always incremented,
2376
+ * it will return the same values in the case of undo-redo.
2377
+ */
2378
+ getAlternativeVersionId(): number;
2379
+ /**
2380
+ * Replace the entire text buffer value contained in this model.
2381
+ */
2382
+ setValue(newValue: string): void;
2383
+ /**
2384
+ * Get the text stored in this model.
2385
+ * @param eol The end of line character preference. Defaults to `EndOfLinePreference.TextDefined`.
2386
+ * @param preserverBOM Preserve a BOM character if it was detected when the model was constructed.
2387
+ * @return The text.
2388
+ */
2389
+ getValue(eol?: EndOfLinePreference, preserveBOM?: boolean): string;
2390
+ /**
2391
+ * Get the text stored in this model.
2392
+ * @param preserverBOM Preserve a BOM character if it was detected when the model was constructed.
2393
+ * @return The text snapshot (it is safe to consume it asynchronously).
2394
+ * @internal
2395
+ */
2396
+ createSnapshot(preserveBOM?: boolean): ITextSnapshot;
2397
+ /**
2398
+ * Get the length of the text stored in this model.
2399
+ */
2400
+ getValueLength(eol?: EndOfLinePreference, preserveBOM?: boolean): number;
2401
+ /**
2402
+ * Check if the raw text stored in this model equals another raw text.
2403
+ * @internal
2404
+ */
2405
+ equalsTextBuffer(other: ITextBuffer): boolean;
2406
+ /**
2407
+ * Get the underling text buffer.
2408
+ * @internal
2409
+ */
2410
+ getTextBuffer(): ITextBuffer;
2411
+ /**
2412
+ * Get the text in a certain range.
2413
+ * @param range The range describing what text to get.
2414
+ * @param eol The end of line character preference. This will only be used for multiline ranges. Defaults to `EndOfLinePreference.TextDefined`.
2415
+ * @return The text.
2416
+ */
2417
+ getValueInRange(range: IRange, eol?: EndOfLinePreference): string;
2418
+ /**
2419
+ * Get the length of text in a certain range.
2420
+ * @param range The range describing what text length to get.
2421
+ * @return The text length.
2422
+ */
2423
+ getValueLengthInRange(range: IRange): number;
2424
+ /**
2425
+ * Get the character count of text in a certain range.
2426
+ * @param range The range describing what text length to get.
2427
+ */
2428
+ getCharacterCountInRange(range: IRange): number;
2429
+ /**
2430
+ * Splits characters in two buckets. First bucket (A) is of characters that
2431
+ * sit in lines with length < `LONG_LINE_BOUNDARY`. Second bucket (B) is of
2432
+ * characters that sit in lines with length >= `LONG_LINE_BOUNDARY`.
2433
+ * If count(B) > count(A) return true. Returns false otherwise.
2434
+ * @internal
2435
+ */
2436
+ isDominatedByLongLines(): boolean;
2437
+ /**
2438
+ * Get the number of lines in the model.
2439
+ */
2440
+ getLineCount(): number;
2441
+ /**
2442
+ * Get the text for a certain line.
2443
+ */
2444
+ getLineContent(lineNumber: number): string;
2445
+ /**
2446
+ * Get the text length for a certain line.
2447
+ */
2448
+ getLineLength(lineNumber: number): number;
2449
+ /**
2450
+ * Get the text for all lines.
2451
+ */
2452
+ getLinesContent(): string[];
2453
+ /**
2454
+ * Get the end of line sequence predominantly used in the text buffer.
2455
+ * @return EOL char sequence (e.g.: '\n' or '\r\n').
2456
+ */
2457
+ getEOL(): string;
2458
+ /**
2459
+ * Get the end of line sequence predominantly used in the text buffer.
2460
+ */
2461
+ getEndOfLineSequence(): EndOfLineSequence;
2462
+ /**
2463
+ * Get the minimum legal column for line at `lineNumber`
2464
+ */
2465
+ getLineMinColumn(lineNumber: number): number;
2466
+ /**
2467
+ * Get the maximum legal column for line at `lineNumber`
2468
+ */
2469
+ getLineMaxColumn(lineNumber: number): number;
2470
+ /**
2471
+ * Returns the column before the first non whitespace character for line at `lineNumber`.
2472
+ * Returns 0 if line is empty or contains only whitespace.
2473
+ */
2474
+ getLineFirstNonWhitespaceColumn(lineNumber: number): number;
2475
+ /**
2476
+ * Returns the column after the last non whitespace character for line at `lineNumber`.
2477
+ * Returns 0 if line is empty or contains only whitespace.
2478
+ */
2479
+ getLineLastNonWhitespaceColumn(lineNumber: number): number;
2480
+ /**
2481
+ * Create a valid position.
2482
+ */
2483
+ validatePosition(position: IPosition): Position;
2484
+ /**
2485
+ * Advances the given position by the given offset (negative offsets are also accepted)
2486
+ * and returns it as a new valid position.
2487
+ *
2488
+ * If the offset and position are such that their combination goes beyond the beginning or
2489
+ * end of the model, throws an exception.
2490
+ *
2491
+ * If the offset is such that the new position would be in the middle of a multi-byte
2492
+ * line terminator, throws an exception.
2493
+ */
2494
+ modifyPosition(position: IPosition, offset: number): Position;
2495
+ /**
2496
+ * Create a valid range.
2497
+ */
2498
+ validateRange(range: IRange): Range;
2499
+ /**
2500
+ * Converts the position to a zero-based offset.
2501
+ *
2502
+ * The position will be [adjusted](#TextDocument.validatePosition).
2503
+ *
2504
+ * @param position A position.
2505
+ * @return A valid zero-based offset.
2506
+ */
2507
+ getOffsetAt(position: IPosition): number;
2508
+ /**
2509
+ * Converts a zero-based offset to a position.
2510
+ *
2511
+ * @param offset A zero-based offset.
2512
+ * @return A valid [position](#Position).
2513
+ */
2514
+ getPositionAt(offset: number): Position;
2515
+ /**
2516
+ * Get a range covering the entire model.
2517
+ */
2518
+ getFullModelRange(): Range;
2519
+ /**
2520
+ * Returns if the model was disposed or not.
2521
+ */
2522
+ isDisposed(): boolean;
2523
+ /**
2524
+ * This model is so large that it would not be a good idea to sync it over
2525
+ * to web workers or other places.
2526
+ * @internal
2527
+ */
2528
+ isTooLargeForSyncing(): boolean;
2529
+ /**
2530
+ * The file is so large, that even tokenization is disabled.
2531
+ * @internal
2532
+ */
2533
+ isTooLargeForTokenization(): boolean;
2534
+ /**
2535
+ * Search the model.
2536
+ * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
2537
+ * @param searchOnlyEditableRange Limit the searching to only search inside the editable range of the model.
2538
+ * @param isRegex Used to indicate that `searchString` is a regular expression.
2539
+ * @param matchCase Force the matching to match lower/upper case exactly.
2540
+ * @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
2541
+ * @param captureMatches The result will contain the captured groups.
2542
+ * @param limitResultCount Limit the number of results
2543
+ * @return The ranges where the matches are. It is empty if not matches have been found.
2544
+ */
2545
+ findMatches(searchString: string, searchOnlyEditableRange: boolean, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount?: number): FindMatch[];
2546
+ /**
2547
+ * Search the model.
2548
+ * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
2549
+ * @param searchScope Limit the searching to only search inside these ranges.
2550
+ * @param isRegex Used to indicate that `searchString` is a regular expression.
2551
+ * @param matchCase Force the matching to match lower/upper case exactly.
2552
+ * @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
2553
+ * @param captureMatches The result will contain the captured groups.
2554
+ * @param limitResultCount Limit the number of results
2555
+ * @return The ranges where the matches are. It is empty if no matches have been found.
2556
+ */
2557
+ findMatches(searchString: string, searchScope: IRange | IRange[], isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount?: number): FindMatch[];
2558
+ /**
2559
+ * Search the model for the next match. Loops to the beginning of the model if needed.
2560
+ * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
2561
+ * @param searchStart Start the searching at the specified position.
2562
+ * @param isRegex Used to indicate that `searchString` is a regular expression.
2563
+ * @param matchCase Force the matching to match lower/upper case exactly.
2564
+ * @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
2565
+ * @param captureMatches The result will contain the captured groups.
2566
+ * @return The range where the next match is. It is null if no next match has been found.
2567
+ */
2568
+ findNextMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch | null;
2569
+ /**
2570
+ * Search the model for the previous match. Loops to the end of the model if needed.
2571
+ * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
2572
+ * @param searchStart Start the searching at the specified position.
2573
+ * @param isRegex Used to indicate that `searchString` is a regular expression.
2574
+ * @param matchCase Force the matching to match lower/upper case exactly.
2575
+ * @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
2576
+ * @param captureMatches The result will contain the captured groups.
2577
+ * @return The range where the previous match is. It is null if no previous match has been found.
2578
+ */
2579
+ findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch | null;
2580
+ /**
2581
+ * Get the language associated with this model.
2582
+ */
2583
+ getLanguageId(): string;
2584
+ /**
2585
+ * Set the current language mode associated with the model.
2586
+ * @internal
2587
+ */
2588
+ setMode(languageId: string): void;
2589
+ /**
2590
+ * Returns the real (inner-most) language mode at a given position.
2591
+ * The result might be inaccurate. Use `forceTokenization` to ensure accurate tokens.
2592
+ * @internal
2593
+ */
2594
+ getLanguageIdAtPosition(lineNumber: number, column: number): string;
2595
+ /**
2596
+ * Get the word under or besides `position`.
2597
+ * @param position The position to look for a word.
2598
+ * @return The word under or besides `position`. Might be null.
2599
+ */
2600
+ getWordAtPosition(position: IPosition): IWordAtPosition | null;
2601
+ /**
2602
+ * Get the word under or besides `position` trimmed to `position`.column
2603
+ * @param position The position to look for a word.
2604
+ * @return The word under or besides `position`. Will never be null.
2605
+ */
2606
+ getWordUntilPosition(position: IPosition): IWordAtPosition;
2607
+ /**
2608
+ * Change the decorations. The callback will be called with a change accessor
2609
+ * that becomes invalid as soon as the callback finishes executing.
2610
+ * This allows for all events to be queued up until the change
2611
+ * is completed. Returns whatever the callback returns.
2612
+ * @param ownerId Identifies the editor id in which these decorations should appear. If no `ownerId` is provided, the decorations will appear in all editors that attach this model.
2613
+ * @internal
2614
+ */
2615
+ changeDecorations<T>(callback: (changeAccessor: IModelDecorationsChangeAccessor) => T, ownerId?: number): T | null;
2616
+ /**
2617
+ * Perform a minimum amount of operations, in order to transform the decorations
2618
+ * identified by `oldDecorations` to the decorations described by `newDecorations`
2619
+ * and returns the new identifiers associated with the resulting decorations.
2620
+ *
2621
+ * @param oldDecorations Array containing previous decorations identifiers.
2622
+ * @param newDecorations Array describing what decorations should result after the call.
2623
+ * @param ownerId Identifies the editor id in which these decorations should appear. If no `ownerId` is provided, the decorations will appear in all editors that attach this model.
2624
+ * @return An array containing the new decorations identifiers.
2625
+ */
2626
+ deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[], ownerId?: number): string[];
2627
+ /**
2628
+ * Remove all decorations that have been added with this specific ownerId.
2629
+ * @param ownerId The owner id to search for.
2630
+ * @internal
2631
+ */
2632
+ removeAllDecorationsWithOwnerId(ownerId: number): void;
2633
+ /**
2634
+ * Get the options associated with a decoration.
2635
+ * @param id The decoration id.
2636
+ * @return The decoration options or null if the decoration was not found.
2637
+ */
2638
+ getDecorationOptions(id: string): IModelDecorationOptions | null;
2639
+ /**
2640
+ * Get the range associated with a decoration.
2641
+ * @param id The decoration id.
2642
+ * @return The decoration range or null if the decoration was not found.
2643
+ */
2644
+ getDecorationRange(id: string): Range | null;
2645
+ /**
2646
+ * Gets all the decorations for the line `lineNumber` as an array.
2647
+ * @param lineNumber The line number
2648
+ * @param ownerId If set, it will ignore decorations belonging to other owners.
2649
+ * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
2650
+ * @return An array with the decorations
2651
+ */
2652
+ getLineDecorations(lineNumber: number, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
2653
+ /**
2654
+ * Gets all the decorations for the lines between `startLineNumber` and `endLineNumber` as an array.
2655
+ * @param startLineNumber The start line number
2656
+ * @param endLineNumber The end line number
2657
+ * @param ownerId If set, it will ignore decorations belonging to other owners.
2658
+ * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
2659
+ * @return An array with the decorations
2660
+ */
2661
+ getLinesDecorations(startLineNumber: number, endLineNumber: number, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
2662
+ /**
2663
+ * Gets all the decorations in a range as an array. Only `startLineNumber` and `endLineNumber` from `range` are used for filtering.
2664
+ * So for now it returns all the decorations on the same line as `range`.
2665
+ * @param range The range to search in
2666
+ * @param ownerId If set, it will ignore decorations belonging to other owners.
2667
+ * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
2668
+ * @return An array with the decorations
2669
+ */
2670
+ getDecorationsInRange(range: IRange, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
2671
+ /**
2672
+ * Gets all the decorations as an array.
2673
+ * @param ownerId If set, it will ignore decorations belonging to other owners.
2674
+ * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
2675
+ */
2676
+ getAllDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
2677
+ /**
2678
+ * Gets all the decorations that should be rendered in the overview ruler as an array.
2679
+ * @param ownerId If set, it will ignore decorations belonging to other owners.
2680
+ * @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
2681
+ */
2682
+ getOverviewRulerDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
2683
+ /**
2684
+ * Gets all the decorations that contain injected text.
2685
+ * @param ownerId If set, it will ignore decorations belonging to other owners.
2686
+ */
2687
+ getInjectedTextDecorations(ownerId?: number): IModelDecoration[];
2688
+ /**
2689
+ * @internal
2690
+ */
2691
+ _getTrackedRange(id: string): Range | null;
2692
+ /**
2693
+ * @internal
2694
+ */
2695
+ _setTrackedRange(id: string | null, newRange: null, newStickiness: TrackedRangeStickiness): null;
2696
+ /**
2697
+ * @internal
2698
+ */
2699
+ _setTrackedRange(id: string | null, newRange: Range, newStickiness: TrackedRangeStickiness): string;
2700
+ /**
2701
+ * Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs).
2702
+ */
2703
+ normalizeIndentation(str: string): string;
2704
+ /**
2705
+ * Change the options of this model.
2706
+ */
2707
+ updateOptions(newOpts: ITextModelUpdateOptions): void;
2708
+ /**
2709
+ * Detect the indentation options for this model from its content.
2710
+ */
2711
+ detectIndentation(defaultInsertSpaces: boolean, defaultTabSize: number): void;
2712
+ /**
2713
+ * Close the current undo-redo element.
2714
+ * This offers a way to create an undo/redo stop point.
2715
+ */
2716
+ pushStackElement(): void;
2717
+ /**
2718
+ * Open the current undo-redo element.
2719
+ * This offers a way to remove the current undo/redo stop point.
2720
+ */
2721
+ popStackElement(): void;
2722
+ /**
2723
+ * Push edit operations, basically editing the model. This is the preferred way
2724
+ * of editing the model. The edit operations will land on the undo stack.
2725
+ * @param beforeCursorState The cursor state before the edit operations. This cursor state will be returned when `undo` or `redo` are invoked.
2726
+ * @param editOperations The edit operations.
2727
+ * @param cursorStateComputer A callback that can compute the resulting cursors state after the edit operations have been executed.
2728
+ * @return The cursor state returned by the `cursorStateComputer`.
2729
+ */
2730
+ pushEditOperations(beforeCursorState: Selection[] | null, editOperations: IIdentifiedSingleEditOperation[], cursorStateComputer: ICursorStateComputer): Selection[] | null;
2731
+ /**
2732
+ * Change the end of line sequence. This is the preferred way of
2733
+ * changing the eol sequence. This will land on the undo stack.
2734
+ */
2735
+ pushEOL(eol: EndOfLineSequence): void;
2736
+ /**
2737
+ * Edit the model without adding the edits to the undo stack.
2738
+ * This can have dire consequences on the undo stack! See @pushEditOperations for the preferred way.
2739
+ * @param operations The edit operations.
2740
+ * @return If desired, the inverse edit operations, that, when applied, will bring the model back to the previous state.
2741
+ */
2742
+ applyEdits(operations: IIdentifiedSingleEditOperation[]): void;
2743
+ applyEdits(operations: IIdentifiedSingleEditOperation[], computeUndoEdits: false): void;
2744
+ applyEdits(operations: IIdentifiedSingleEditOperation[], computeUndoEdits: true): IValidEditOperation[];
2745
+ /**
2746
+ * Change the end of line sequence without recording in the undo stack.
2747
+ * This can have dire consequences on the undo stack! See @pushEOL for the preferred way.
2748
+ */
2749
+ setEOL(eol: EndOfLineSequence): void;
2750
+ /**
2751
+ * @internal
2752
+ */
2753
+ _applyUndo(changes: TextChange[], eol: EndOfLineSequence, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void;
2754
+ /**
2755
+ * @internal
2756
+ */
2757
+ _applyRedo(changes: TextChange[], eol: EndOfLineSequence, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void;
2758
+ /**
2759
+ * Undo edit operations until the previous undo/redo point.
2760
+ * The inverse edit operations will be pushed on the redo stack.
2761
+ * @internal
2762
+ */
2763
+ undo(): void | Promise<void>;
2764
+ /**
2765
+ * Is there anything in the undo stack?
2766
+ * @internal
2767
+ */
2768
+ canUndo(): boolean;
2769
+ /**
2770
+ * Redo edit operations until the next undo/redo point.
2771
+ * The inverse edit operations will be pushed on the undo stack.
2772
+ * @internal
2773
+ */
2774
+ redo(): void | Promise<void>;
2775
+ /**
2776
+ * Is there anything in the redo stack?
2777
+ * @internal
2778
+ */
2779
+ canRedo(): boolean;
2780
+ /**
2781
+ * @deprecated Please use `onDidChangeContent` instead.
2782
+ * An event emitted when the contents of the model have changed.
2783
+ * @internal
2784
+ * @event
2785
+ */
2786
+ readonly onDidChangeContentOrInjectedText: Event<InternalModelContentChangeEvent | ModelInjectedTextChangedEvent>;
2787
+ /**
2788
+ * An event emitted when the contents of the model have changed.
2789
+ * @event
2790
+ */
2791
+ onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable;
2792
+ /**
2793
+ * An event emitted when decorations of the model have changed.
2794
+ * @event
2795
+ */
2796
+ readonly onDidChangeDecorations: Event<IModelDecorationsChangedEvent>;
2797
+ /**
2798
+ * An event emitted when the model options have changed.
2799
+ * @event
2800
+ */
2801
+ readonly onDidChangeOptions: Event<IModelOptionsChangedEvent>;
2802
+ /**
2803
+ * An event emitted when the language associated with the model has changed.
2804
+ * @event
2805
+ */
2806
+ readonly onDidChangeLanguage: Event<IModelLanguageChangedEvent>;
2807
+ /**
2808
+ * An event emitted when the language configuration associated with the model has changed.
2809
+ * @event
2810
+ */
2811
+ readonly onDidChangeLanguageConfiguration: Event<IModelLanguageConfigurationChangedEvent>;
2812
+ /**
2813
+ * An event emitted when the tokens associated with the model have changed.
2814
+ * @event
2815
+ * @internal
2816
+ */
2817
+ readonly onDidChangeTokens: Event<IModelTokensChangedEvent>;
2818
+ /**
2819
+ * An event emitted when the model has been attached to the first editor or detached from the last editor.
2820
+ * @event
2821
+ */
2822
+ readonly onDidChangeAttached: Event<void>;
2823
+ /**
2824
+ * An event emitted right before disposing the model.
2825
+ * @event
2826
+ */
2827
+ readonly onWillDispose: Event<void>;
2828
+ /**
2829
+ * Destroy this model.
2830
+ */
2831
+ dispose(): void;
2832
+ /**
2833
+ * @internal
2834
+ */
2835
+ onBeforeAttached(): void;
2836
+ /**
2837
+ * @internal
2838
+ */
2839
+ onBeforeDetached(): void;
2840
+ /**
2841
+ * Returns if this model is attached to an editor or not.
2842
+ */
2843
+ isAttachedToEditor(): boolean;
2844
+ /**
2845
+ * Returns the count of editors this model is attached to.
2846
+ * @internal
2847
+ */
2848
+ getAttachedEditorCount(): number;
2849
+ /**
2850
+ * Among all positions that are projected to the same position in the underlying text model as
2851
+ * the given position, select a unique position as indicated by the affinity.
2852
+ *
2853
+ * PositionAffinity.Left:
2854
+ * The normalized position must be equal or left to the requested position.
2855
+ *
2856
+ * PositionAffinity.Right:
2857
+ * The normalized position must be equal or right to the requested position.
2858
+ *
2859
+ * @internal
2860
+ */
2861
+ normalizePosition(position: Position, affinity: PositionAffinity): Position;
2862
+ /**
2863
+ * Gets the column at which indentation stops at a given line.
2864
+ * @internal
2865
+ */
2866
+ getLineIndentColumn(lineNumber: number): number;
2867
+ /**
2868
+ * Returns an object that can be used to query brackets.
2869
+ * @internal
2870
+ */
2871
+ readonly bracketPairs: IBracketPairsTextModelPart;
2872
+ /**
2873
+ * Returns an object that can be used to query indent guides.
2874
+ * @internal
2875
+ */
2876
+ readonly guides: IGuidesTextModelPart;
2877
+ /**
2878
+ * @internal
2879
+ */
2880
+ readonly tokenization: ITokenizationTextModelPart;
2881
+ }
2882
+ declare const enum PositionAffinity {
2883
+ /**
2884
+ * Prefers the left most position.
2885
+ */
2886
+ Left = 0,
2887
+ /**
2888
+ * Prefers the right most position.
2889
+ */
2890
+ Right = 1,
2891
+ /**
2892
+ * No preference.
2893
+ */
2894
+ None = 2,
2895
+ /**
2896
+ * If the given position is on injected text, prefers the position left of it.
2897
+ */
2898
+ LeftOfInjectedText = 3,
2899
+ /**
2900
+ * If the given position is on injected text, prefers the position right of it.
2901
+ */
2902
+ RightOfInjectedText = 4
2903
+ }
2904
+ /**
2905
+ * @internal
2906
+ */
2907
+ declare class ValidAnnotatedEditOperation implements IIdentifiedSingleEditOperation {
2908
+ readonly identifier: ISingleEditOperationIdentifier | null;
2909
+ readonly range: Range;
2910
+ readonly text: string | null;
2911
+ readonly forceMoveMarkers: boolean;
2912
+ readonly isAutoWhitespaceEdit: boolean;
2913
+ readonly _isTracked: boolean;
2914
+ constructor(identifier: ISingleEditOperationIdentifier | null, range: Range, text: string | null, forceMoveMarkers: boolean, isAutoWhitespaceEdit: boolean, _isTracked: boolean);
2915
+ }
2916
+ /**
2917
+ * @internal
2918
+ *
2919
+ * `lineNumber` is 1 based.
2920
+ */
2921
+ interface IReadonlyTextBuffer {
2922
+ onDidChangeContent: Event<void>;
2923
+ equals(other: ITextBuffer): boolean;
2924
+ mightContainRTL(): boolean;
2925
+ mightContainUnusualLineTerminators(): boolean;
2926
+ resetMightContainUnusualLineTerminators(): void;
2927
+ mightContainNonBasicASCII(): boolean;
2928
+ getBOM(): string;
2929
+ getEOL(): string;
2930
+ getOffsetAt(lineNumber: number, column: number): number;
2931
+ getPositionAt(offset: number): Position;
2932
+ getRangeAt(offset: number, length: number): Range;
2933
+ getValueInRange(range: Range, eol: EndOfLinePreference): string;
2934
+ createSnapshot(preserveBOM: boolean): ITextSnapshot;
2935
+ getValueLengthInRange(range: Range, eol: EndOfLinePreference): number;
2936
+ getCharacterCountInRange(range: Range, eol: EndOfLinePreference): number;
2937
+ getLength(): number;
2938
+ getLineCount(): number;
2939
+ getLinesContent(): string[];
2940
+ getLineContent(lineNumber: number): string;
2941
+ getLineCharCode(lineNumber: number, index: number): number;
2942
+ getCharCode(offset: number): number;
2943
+ getLineLength(lineNumber: number): number;
2944
+ getLineFirstNonWhitespaceColumn(lineNumber: number): number;
2945
+ getLineLastNonWhitespaceColumn(lineNumber: number): number;
2946
+ findMatchesLineByLine(searchRange: Range, searchData: SearchData, captureMatches: boolean, limitResultCount: number): FindMatch[];
2947
+ }
2948
+ /**
2949
+ * @internal
2950
+ */
2951
+ declare class SearchData {
2952
+ /**
2953
+ * The regex to search for. Always defined.
2954
+ */
2955
+ readonly regex: RegExp;
2956
+ /**
2957
+ * The word separator classifier.
2958
+ */
2959
+ readonly wordSeparators: WordCharacterClassifier | null;
2960
+ /**
2961
+ * The simple string to search for (if possible).
2962
+ */
2963
+ readonly simpleSearch: string | null;
2964
+ constructor(regex: RegExp, wordSeparators: WordCharacterClassifier | null, simpleSearch: string | null);
2965
+ }
2966
+ /**
2967
+ * @internal
2968
+ */
2969
+ interface ITextBuffer extends IReadonlyTextBuffer {
2970
+ setEOL(newEOL: '\r\n' | '\n'): void;
2971
+ applyEdits(rawOperations: ValidAnnotatedEditOperation[], recordTrimAutoWhitespace: boolean, computeUndoEdits: boolean): ApplyEditsResult;
2972
+ }
2973
+ /**
2974
+ * @internal
2975
+ */
2976
+ declare class ApplyEditsResult {
2977
+ readonly reverseEdits: IValidEditOperation[] | null;
2978
+ readonly changes: IInternalModelContentChange[];
2979
+ readonly trimAutoWhitespaceLineNumbers: number[] | null;
2980
+ constructor(reverseEdits: IValidEditOperation[] | null, changes: IInternalModelContentChange[], trimAutoWhitespaceLineNumbers: number[] | null);
2981
+ }
2982
+ /**
2983
+ * @internal
2984
+ */
2985
+ interface IInternalModelContentChange extends IModelContentChange {
2986
+ range: Range;
2987
+ forceMoveMarkers: boolean;
2988
+ }
2989
+
2990
+ /**
2991
+ * Open ended enum at runtime
2992
+ * @internal
2993
+ */
2994
+ declare const enum LanguageId {
2995
+ Null = 0,
2996
+ PlainText = 1
2997
+ }
2998
+ /**
2999
+ * Open ended enum at runtime
3000
+ * @internal
3001
+ */
3002
+ declare const enum ColorId {
3003
+ None = 0,
3004
+ DefaultForeground = 1,
3005
+ DefaultBackground = 2
3006
+ }
3007
+ /**
3008
+ * A standard token type.
3009
+ * @internal
3010
+ */
3011
+ declare const enum StandardTokenType {
3012
+ Other = 0,
3013
+ Comment = 1,
3014
+ String = 2,
3015
+ RegEx = 3
3016
+ }
3017
+ /**
3018
+ * @internal
3019
+ */
3020
+ interface ITokenPresentation {
3021
+ foreground: ColorId;
3022
+ italic: boolean;
3023
+ bold: boolean;
3024
+ underline: boolean;
3025
+ strikethrough: boolean;
3026
+ }
3027
+ /**
3028
+ * @internal
3029
+ */
3030
+ interface ILanguageIdCodec {
3031
+ encodeLanguageId(languageId: string): LanguageId;
3032
+ decodeLanguageId(languageId: LanguageId): string;
3033
+ }
3034
+ /**
3035
+ * A provider result represents the values a provider, like the {@link HoverProvider},
3036
+ * may return. For once this is the actual result type `T`, like `Hover`, or a thenable that resolves
3037
+ * to that type `T`. In addition, `null` and `undefined` can be returned - either directly or from a
3038
+ * thenable.
3039
+ */
3040
+ declare type ProviderResult<T> = T | undefined | null | Thenable<T | undefined | null>;
3041
+ /**
3042
+ * An evaluatable expression represents additional information for an expression in a document. Evaluatable expressions are
3043
+ * evaluated by a debugger or runtime and their result is rendered in a tooltip-like widget.
3044
+ * @internal
3045
+ */
3046
+ interface EvaluatableExpression {
3047
+ /**
3048
+ * The range to which this expression applies.
3049
+ */
3050
+ range: IRange;
3051
+ /**
3052
+ * This expression overrides the expression extracted from the range.
3053
+ */
3054
+ expression?: string;
3055
+ }
3056
+ /**
3057
+ * The evaluatable expression provider interface defines the contract between extensions and
3058
+ * the debug hover.
3059
+ * @internal
3060
+ */
3061
+ interface EvaluatableExpressionProvider {
3062
+ /**
3063
+ * Provide a hover for the given position and document. Multiple hovers at the same
3064
+ * position will be merged by the editor. A hover can have a range which defaults
3065
+ * to the word range at the position when omitted.
3066
+ */
3067
+ provideEvaluatableExpression(model: ITextModel, position: Position, token: CancellationToken): ProviderResult<EvaluatableExpression>;
3068
+ }
3069
+ /**
3070
+ * Represents a location inside a resource, such as a line
3071
+ * inside a text file.
3072
+ */
3073
+ interface Location {
3074
+ /**
3075
+ * The resource identifier of this location.
3076
+ */
3077
+ uri: URI;
3078
+ /**
3079
+ * The document range of this locations.
3080
+ */
3081
+ range: IRange;
3082
+ }
3083
+ /**
3084
+ * A symbol kind.
3085
+ */
3086
+ declare const enum SymbolKind {
3087
+ File = 0,
3088
+ Module = 1,
3089
+ Namespace = 2,
3090
+ Package = 3,
3091
+ Class = 4,
3092
+ Method = 5,
3093
+ Property = 6,
3094
+ Field = 7,
3095
+ Constructor = 8,
3096
+ Enum = 9,
3097
+ Interface = 10,
3098
+ Function = 11,
3099
+ Variable = 12,
3100
+ Constant = 13,
3101
+ String = 14,
3102
+ Number = 15,
3103
+ Boolean = 16,
3104
+ Array = 17,
3105
+ Object = 18,
3106
+ Key = 19,
3107
+ Null = 20,
3108
+ EnumMember = 21,
3109
+ Struct = 22,
3110
+ Event = 23,
3111
+ Operator = 24,
3112
+ TypeParameter = 25
3113
+ }
3114
+ declare const enum SymbolTag {
3115
+ Deprecated = 1
3116
+ }
3117
+ /**
3118
+ * Interface used to format a model
3119
+ */
3120
+ interface FormattingOptions {
3121
+ /**
3122
+ * Size of a tab in spaces.
3123
+ */
3124
+ tabSize: number;
3125
+ /**
3126
+ * Prefer spaces over tabs.
3127
+ */
3128
+ insertSpaces: boolean;
3129
+ }
3130
+
3131
+ interface CallHierarchyItem {
3132
+ _sessionId: string;
3133
+ _itemId: string;
3134
+ kind: SymbolKind;
3135
+ name: string;
3136
+ detail?: string;
3137
+ uri: URI;
3138
+ range: IRange;
3139
+ selectionRange: IRange;
3140
+ tags?: SymbolTag[];
3141
+ }
3142
+ interface IncomingCall {
3143
+ from: CallHierarchyItem;
3144
+ fromRanges: IRange[];
3145
+ }
3146
+ interface OutgoingCall {
3147
+ fromRanges: IRange[];
3148
+ to: CallHierarchyItem;
3149
+ }
3150
+ interface CallHierarchySession {
3151
+ roots: CallHierarchyItem[];
3152
+ dispose(): void;
3153
+ }
3154
+ interface CallHierarchyProvider {
3155
+ prepareCallHierarchy(document: ITextModel, position: IPosition, token: CancellationToken): ProviderResult<CallHierarchySession>;
3156
+ provideIncomingCalls(item: CallHierarchyItem, token: CancellationToken): ProviderResult<IncomingCall[]>;
3157
+ provideOutgoingCalls(item: CallHierarchyItem, token: CancellationToken): ProviderResult<OutgoingCall[]>;
3158
+ }
3159
+
3160
+ interface TypeHierarchyItem {
3161
+ _sessionId: string;
3162
+ _itemId: string;
3163
+ kind: SymbolKind;
3164
+ name: string;
3165
+ detail?: string;
3166
+ uri: URI;
3167
+ range: IRange;
3168
+ selectionRange: IRange;
3169
+ tags?: SymbolTag[];
3170
+ }
3171
+ interface TypeHierarchySession {
3172
+ roots: TypeHierarchyItem[];
3173
+ dispose(): void;
3174
+ }
3175
+ interface TypeHierarchyProvider {
3176
+ prepareTypeHierarchy(document: ITextModel, position: IPosition, token: CancellationToken): ProviderResult<TypeHierarchySession>;
3177
+ provideSupertypes(item: TypeHierarchyItem, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;
3178
+ provideSubtypes(item: TypeHierarchyItem, token: CancellationToken): ProviderResult<TypeHierarchyItem[]>;
3179
+ }
3180
+
3181
+ interface IWorkspaceSymbol {
3182
+ name: string;
3183
+ containerName?: string;
3184
+ kind: SymbolKind;
3185
+ tags?: SymbolTag[];
3186
+ location: Location;
3187
+ }
3188
+ interface IWorkspaceSymbolProvider {
3189
+ provideWorkspaceSymbols(search: string, token: CancellationToken): ProviderResult<IWorkspaceSymbol[]>;
3190
+ resolveWorkspaceSymbol?(item: IWorkspaceSymbol, token: CancellationToken): ProviderResult<IWorkspaceSymbol>;
3191
+ }
3192
+
3193
+ interface Languages {
3194
+ registerTypeHierarchyProvider?(documentSelector: vscode.DocumentSelector, provider: TypeHierarchyProvider): vscode.Disposable;
3195
+ registerCallHierarchyProvider?(documentSelector: vscode.DocumentSelector, provider: CallHierarchyProvider): vscode.Disposable;
3196
+ registerEvaluatableExpressionProvider?(documentSelector: vscode.DocumentSelector, provider: EvaluatableExpressionProvider): vscode.Disposable;
3197
+ registerNavigateTypeSupport?(provider: IWorkspaceSymbolProvider): vscode.Disposable;
3198
+ }
3199
+ interface Window {
3200
+ showMessage<T extends vscode.MessageOptions | string | vscode.MessageItem>(type: Severity, message: string, ...rest: T[]): PromiseLike<T | undefined>;
3201
+ createOutputChannel?(name: string): vscode.OutputChannel;
3202
+ withProgress?: typeof vscode.window.withProgress;
3203
+ showTextDocument?(document: vscode.Uri, options?: vscode.TextDocumentShowOptions): PromiseLike<void>;
3204
+ }
3205
+ interface Configurations {
3206
+ getConfiguration(section?: string, resource?: string): vscode.WorkspaceConfiguration;
3207
+ readonly onDidChangeConfiguration: vscode.Event<vscode.ConfigurationChangeEvent>;
3208
+ }
3209
+ interface Workspace {
3210
+ readonly rootPath?: string | null;
3211
+ readonly rootUri: string | null;
3212
+ readonly workspaceFolders?: typeof vscode.workspace.workspaceFolders;
3213
+ readonly onDidChangeWorkspaceFolders?: typeof vscode.workspace.onDidChangeWorkspaceFolders;
3214
+ readonly configurations?: Configurations;
3215
+ readonly onWillSaveTextDocument?: vscode.Event<vscode.TextDocumentWillSaveEvent>;
3216
+ readonly onDidSaveTextDocument?: vscode.Event<vscode.TextDocument>;
3217
+ createFileSystemWatcher?(globPattern: string, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean): vscode.FileSystemWatcher;
3218
+ }
3219
+ interface Env {
3220
+ openExternal?(document: vscode.Uri): PromiseLike<boolean>;
3221
+ }
3222
+ interface Services {
3223
+ workspace?: Workspace;
3224
+ window?: Window;
3225
+ env?: Env;
3226
+ languages?: Languages;
3227
+ }
3228
+ declare namespace Services {
3229
+ type Provider = () => Services;
3230
+ const get: Provider;
3231
+ function install(_services: Services): vscode.Disposable;
3232
+ }
3233
+
3234
+ export { CallHierarchyProvider, Configurations, Env, EvaluatableExpressionProvider, IWorkspaceSymbolProvider, Languages, Services, Severity, TypeHierarchyProvider, Window, Workspace };