Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/monaco.d.ts
3290 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
// eslint-disable-next-line no-var
7
declare var MonacoEnvironment: monaco.Environment | undefined;
8
9
declare namespace monaco {
10
11
export type Thenable<T> = PromiseLike<T>;
12
13
export interface Environment {
14
/**
15
* Define a global `monaco` symbol.
16
* This is true by default in AMD and false by default in ESM.
17
*/
18
globalAPI?: boolean;
19
/**
20
* The base url where the editor sources are found (which contains the vs folder)
21
*/
22
baseUrl?: string;
23
/**
24
* A web worker factory.
25
* NOTE: If `getWorker` is defined, `getWorkerUrl` is not invoked.
26
*/
27
getWorker?(workerId: string, label: string): Promise<Worker> | Worker;
28
/**
29
* Return the location for web worker scripts.
30
* NOTE: If `getWorker` is defined, `getWorkerUrl` is not invoked.
31
*/
32
getWorkerUrl?(workerId: string, label: string): string;
33
/**
34
* Create a trusted types policy (same API as window.trustedTypes.createPolicy)
35
*/
36
createTrustedTypesPolicy?(
37
policyName: string,
38
policyOptions?: ITrustedTypePolicyOptions,
39
): undefined | ITrustedTypePolicy;
40
}
41
42
export interface ITrustedTypePolicyOptions {
43
createHTML?: (input: string, ...arguments: any[]) => string;
44
createScript?: (input: string, ...arguments: any[]) => string;
45
createScriptURL?: (input: string, ...arguments: any[]) => string;
46
}
47
48
export interface ITrustedTypePolicy {
49
readonly name: string;
50
createHTML?(input: string): any;
51
createScript?(input: string): any;
52
createScriptURL?(input: string): any;
53
}
54
55
export interface IDisposable {
56
dispose(): void;
57
}
58
59
export interface IEvent<T> {
60
(listener: (e: T) => any, thisArg?: any): IDisposable;
61
}
62
63
/**
64
* A helper that allows to emit and listen to typed events
65
*/
66
export class Emitter<T> {
67
constructor();
68
readonly event: IEvent<T>;
69
fire(event: T): void;
70
dispose(): void;
71
}
72
73
74
export enum MarkerTag {
75
Unnecessary = 1,
76
Deprecated = 2
77
}
78
79
export enum MarkerSeverity {
80
Hint = 1,
81
Info = 2,
82
Warning = 4,
83
Error = 8
84
}
85
86
export class CancellationTokenSource {
87
constructor(parent?: CancellationToken);
88
get token(): CancellationToken;
89
cancel(): void;
90
dispose(cancel?: boolean): void;
91
}
92
93
export interface CancellationToken {
94
/**
95
* A flag signalling is cancellation has been requested.
96
*/
97
readonly isCancellationRequested: boolean;
98
/**
99
* An event which fires when cancellation is requested. This event
100
* only ever fires `once` as cancellation can only happen once. Listeners
101
* that are registered after cancellation will be called (next event loop run),
102
* but also only once.
103
*
104
* @event
105
*/
106
readonly onCancellationRequested: (listener: (e: any) => any, thisArgs?: any, disposables?: IDisposable[]) => IDisposable;
107
}
108
/**
109
* Uniform Resource Identifier (Uri) http://tools.ietf.org/html/rfc3986.
110
* This class is a simple parser which creates the basic component parts
111
* (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
112
* and encoding.
113
*
114
* ```txt
115
* foo://example.com:8042/over/there?name=ferret#nose
116
* \_/ \______________/\_________/ \_________/ \__/
117
* | | | | |
118
* scheme authority path query fragment
119
* | _____________________|__
120
* / \ / \
121
* urn:example:animal:ferret:nose
122
* ```
123
*/
124
export class Uri implements UriComponents {
125
static isUri(thing: unknown): thing is Uri;
126
/**
127
* scheme is the 'http' part of 'http://www.example.com/some/path?query#fragment'.
128
* The part before the first colon.
129
*/
130
readonly scheme: string;
131
/**
132
* authority is the 'www.example.com' part of 'http://www.example.com/some/path?query#fragment'.
133
* The part between the first double slashes and the next slash.
134
*/
135
readonly authority: string;
136
/**
137
* path is the '/some/path' part of 'http://www.example.com/some/path?query#fragment'.
138
*/
139
readonly path: string;
140
/**
141
* query is the 'query' part of 'http://www.example.com/some/path?query#fragment'.
142
*/
143
readonly query: string;
144
/**
145
* fragment is the 'fragment' part of 'http://www.example.com/some/path?query#fragment'.
146
*/
147
readonly fragment: string;
148
/**
149
* Returns a string representing the corresponding file system path of this Uri.
150
* Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the
151
* platform specific path separator.
152
*
153
* * Will *not* validate the path for invalid characters and semantics.
154
* * Will *not* look at the scheme of this Uri.
155
* * The result shall *not* be used for display purposes but for accessing a file on disk.
156
*
157
*
158
* The *difference* to `Uri#path` is the use of the platform specific separator and the handling
159
* of UNC paths. See the below sample of a file-uri with an authority (UNC path).
160
*
161
* ```ts
162
const u = Uri.parse('file://server/c$/folder/file.txt')
163
u.authority === 'server'
164
u.path === '/shares/c$/file.txt'
165
u.fsPath === '\\server\c$\folder\file.txt'
166
```
167
*
168
* Using `Uri#path` to read a file (using fs-apis) would not be enough because parts of the path,
169
* namely the server name, would be missing. Therefore `Uri#fsPath` exists - it's sugar to ease working
170
* with URIs that represent files on disk (`file` scheme).
171
*/
172
get fsPath(): string;
173
with(change: {
174
scheme?: string;
175
authority?: string | null;
176
path?: string | null;
177
query?: string | null;
178
fragment?: string | null;
179
}): Uri;
180
/**
181
* Creates a new Uri from a string, e.g. `http://www.example.com/some/path`,
182
* `file:///usr/home`, or `scheme:with/path`.
183
*
184
* @param value A string which represents an Uri (see `Uri#toString`).
185
*/
186
static parse(value: string, _strict?: boolean): Uri;
187
/**
188
* Creates a new Uri from a file system path, e.g. `c:\my\files`,
189
* `/usr/home`, or `\\server\share\some\path`.
190
*
191
* The *difference* between `Uri#parse` and `Uri#file` is that the latter treats the argument
192
* as path, not as stringified-uri. E.g. `Uri.file(path)` is **not the same as**
193
* `Uri.parse('file://' + path)` because the path might contain characters that are
194
* interpreted (# and ?). See the following sample:
195
* ```ts
196
const good = Uri.file('/coding/c#/project1');
197
good.scheme === 'file';
198
good.path === '/coding/c#/project1';
199
good.fragment === '';
200
const bad = Uri.parse('file://' + '/coding/c#/project1');
201
bad.scheme === 'file';
202
bad.path === '/coding/c'; // path is now broken
203
bad.fragment === '/project1';
204
```
205
*
206
* @param path A file system path (see `Uri#fsPath`)
207
*/
208
static file(path: string): Uri;
209
/**
210
* Creates new Uri from uri components.
211
*
212
* Unless `strict` is `true` the scheme is defaults to be `file`. This function performs
213
* validation and should be used for untrusted uri components retrieved from storage,
214
* user input, command arguments etc
215
*/
216
static from(components: UriComponents, strict?: boolean): Uri;
217
/**
218
* Join a Uri path with path fragments and normalizes the resulting path.
219
*
220
* @param uri The input Uri.
221
* @param pathFragment The path fragment to add to the Uri path.
222
* @returns The resulting Uri.
223
*/
224
static joinPath(uri: Uri, ...pathFragment: string[]): Uri;
225
/**
226
* Creates a string representation for this Uri. It's guaranteed that calling
227
* `Uri.parse` with the result of this function creates an Uri which is equal
228
* to this Uri.
229
*
230
* * The result shall *not* be used for display purposes but for externalization or transport.
231
* * The result will be encoded using the percentage encoding and encoding happens mostly
232
* ignore the scheme-specific encoding rules.
233
*
234
* @param skipEncoding Do not encode the result, default is `false`
235
*/
236
toString(skipEncoding?: boolean): string;
237
toJSON(): UriComponents;
238
/**
239
* A helper function to revive URIs.
240
*
241
* **Note** that this function should only be used when receiving Uri#toJSON generated data
242
* and that it doesn't do any validation. Use {@link Uri.from} when received "untrusted"
243
* uri components such as command arguments or data from storage.
244
*
245
* @param data The Uri components or Uri to revive.
246
* @returns The revived Uri or undefined or null.
247
*/
248
static revive(data: UriComponents | Uri): Uri;
249
static revive(data: UriComponents | Uri | undefined): Uri | undefined;
250
static revive(data: UriComponents | Uri | null): Uri | null;
251
static revive(data: UriComponents | Uri | undefined | null): Uri | undefined | null;
252
}
253
254
export interface UriComponents {
255
scheme: string;
256
authority?: string;
257
path?: string;
258
query?: string;
259
fragment?: string;
260
}
261
/**
262
* Virtual Key Codes, the value does not hold any inherent meaning.
263
* Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
264
* But these are "more general", as they should work across browsers & OS`s.
265
*/
266
export enum KeyCode {
267
DependsOnKbLayout = -1,
268
/**
269
* Placed first to cover the 0 value of the enum.
270
*/
271
Unknown = 0,
272
Backspace = 1,
273
Tab = 2,
274
Enter = 3,
275
Shift = 4,
276
Ctrl = 5,
277
Alt = 6,
278
PauseBreak = 7,
279
CapsLock = 8,
280
Escape = 9,
281
Space = 10,
282
PageUp = 11,
283
PageDown = 12,
284
End = 13,
285
Home = 14,
286
LeftArrow = 15,
287
UpArrow = 16,
288
RightArrow = 17,
289
DownArrow = 18,
290
Insert = 19,
291
Delete = 20,
292
Digit0 = 21,
293
Digit1 = 22,
294
Digit2 = 23,
295
Digit3 = 24,
296
Digit4 = 25,
297
Digit5 = 26,
298
Digit6 = 27,
299
Digit7 = 28,
300
Digit8 = 29,
301
Digit9 = 30,
302
KeyA = 31,
303
KeyB = 32,
304
KeyC = 33,
305
KeyD = 34,
306
KeyE = 35,
307
KeyF = 36,
308
KeyG = 37,
309
KeyH = 38,
310
KeyI = 39,
311
KeyJ = 40,
312
KeyK = 41,
313
KeyL = 42,
314
KeyM = 43,
315
KeyN = 44,
316
KeyO = 45,
317
KeyP = 46,
318
KeyQ = 47,
319
KeyR = 48,
320
KeyS = 49,
321
KeyT = 50,
322
KeyU = 51,
323
KeyV = 52,
324
KeyW = 53,
325
KeyX = 54,
326
KeyY = 55,
327
KeyZ = 56,
328
Meta = 57,
329
ContextMenu = 58,
330
F1 = 59,
331
F2 = 60,
332
F3 = 61,
333
F4 = 62,
334
F5 = 63,
335
F6 = 64,
336
F7 = 65,
337
F8 = 66,
338
F9 = 67,
339
F10 = 68,
340
F11 = 69,
341
F12 = 70,
342
F13 = 71,
343
F14 = 72,
344
F15 = 73,
345
F16 = 74,
346
F17 = 75,
347
F18 = 76,
348
F19 = 77,
349
F20 = 78,
350
F21 = 79,
351
F22 = 80,
352
F23 = 81,
353
F24 = 82,
354
NumLock = 83,
355
ScrollLock = 84,
356
/**
357
* Used for miscellaneous characters; it can vary by keyboard.
358
* For the US standard keyboard, the ';:' key
359
*/
360
Semicolon = 85,
361
/**
362
* For any country/region, the '+' key
363
* For the US standard keyboard, the '=+' key
364
*/
365
Equal = 86,
366
/**
367
* For any country/region, the ',' key
368
* For the US standard keyboard, the ',<' key
369
*/
370
Comma = 87,
371
/**
372
* For any country/region, the '-' key
373
* For the US standard keyboard, the '-_' key
374
*/
375
Minus = 88,
376
/**
377
* For any country/region, the '.' key
378
* For the US standard keyboard, the '.>' key
379
*/
380
Period = 89,
381
/**
382
* Used for miscellaneous characters; it can vary by keyboard.
383
* For the US standard keyboard, the '/?' key
384
*/
385
Slash = 90,
386
/**
387
* Used for miscellaneous characters; it can vary by keyboard.
388
* For the US standard keyboard, the '`~' key
389
*/
390
Backquote = 91,
391
/**
392
* Used for miscellaneous characters; it can vary by keyboard.
393
* For the US standard keyboard, the '[{' key
394
*/
395
BracketLeft = 92,
396
/**
397
* Used for miscellaneous characters; it can vary by keyboard.
398
* For the US standard keyboard, the '\|' key
399
*/
400
Backslash = 93,
401
/**
402
* Used for miscellaneous characters; it can vary by keyboard.
403
* For the US standard keyboard, the ']}' key
404
*/
405
BracketRight = 94,
406
/**
407
* Used for miscellaneous characters; it can vary by keyboard.
408
* For the US standard keyboard, the ''"' key
409
*/
410
Quote = 95,
411
/**
412
* Used for miscellaneous characters; it can vary by keyboard.
413
*/
414
OEM_8 = 96,
415
/**
416
* Either the angle bracket key or the backslash key on the RT 102-key keyboard.
417
*/
418
IntlBackslash = 97,
419
Numpad0 = 98,// VK_NUMPAD0, 0x60, Numeric keypad 0 key
420
Numpad1 = 99,// VK_NUMPAD1, 0x61, Numeric keypad 1 key
421
Numpad2 = 100,// VK_NUMPAD2, 0x62, Numeric keypad 2 key
422
Numpad3 = 101,// VK_NUMPAD3, 0x63, Numeric keypad 3 key
423
Numpad4 = 102,// VK_NUMPAD4, 0x64, Numeric keypad 4 key
424
Numpad5 = 103,// VK_NUMPAD5, 0x65, Numeric keypad 5 key
425
Numpad6 = 104,// VK_NUMPAD6, 0x66, Numeric keypad 6 key
426
Numpad7 = 105,// VK_NUMPAD7, 0x67, Numeric keypad 7 key
427
Numpad8 = 106,// VK_NUMPAD8, 0x68, Numeric keypad 8 key
428
Numpad9 = 107,// VK_NUMPAD9, 0x69, Numeric keypad 9 key
429
NumpadMultiply = 108,// VK_MULTIPLY, 0x6A, Multiply key
430
NumpadAdd = 109,// VK_ADD, 0x6B, Add key
431
NUMPAD_SEPARATOR = 110,// VK_SEPARATOR, 0x6C, Separator key
432
NumpadSubtract = 111,// VK_SUBTRACT, 0x6D, Subtract key
433
NumpadDecimal = 112,// VK_DECIMAL, 0x6E, Decimal key
434
NumpadDivide = 113,// VK_DIVIDE, 0x6F,
435
/**
436
* Cover all key codes when IME is processing input.
437
*/
438
KEY_IN_COMPOSITION = 114,
439
ABNT_C1 = 115,// Brazilian (ABNT) Keyboard
440
ABNT_C2 = 116,// Brazilian (ABNT) Keyboard
441
AudioVolumeMute = 117,
442
AudioVolumeUp = 118,
443
AudioVolumeDown = 119,
444
BrowserSearch = 120,
445
BrowserHome = 121,
446
BrowserBack = 122,
447
BrowserForward = 123,
448
MediaTrackNext = 124,
449
MediaTrackPrevious = 125,
450
MediaStop = 126,
451
MediaPlayPause = 127,
452
LaunchMediaPlayer = 128,
453
LaunchMail = 129,
454
LaunchApp2 = 130,
455
/**
456
* VK_CLEAR, 0x0C, CLEAR key
457
*/
458
Clear = 131,
459
/**
460
* Placed last to cover the length of the enum.
461
* Please do not depend on this value!
462
*/
463
MAX_VALUE = 132
464
}
465
export class KeyMod {
466
static readonly CtrlCmd: number;
467
static readonly Shift: number;
468
static readonly Alt: number;
469
static readonly WinCtrl: number;
470
static chord(firstPart: number, secondPart: number): number;
471
}
472
473
export interface IMarkdownString {
474
readonly value: string;
475
readonly isTrusted?: boolean | MarkdownStringTrustedOptions;
476
readonly supportThemeIcons?: boolean;
477
readonly supportHtml?: boolean;
478
readonly baseUri?: UriComponents;
479
uris?: {
480
[href: string]: UriComponents;
481
};
482
}
483
484
export interface MarkdownStringTrustedOptions {
485
readonly enabledCommands: readonly string[];
486
}
487
488
export interface IKeyboardEvent {
489
readonly _standardKeyboardEventBrand: true;
490
readonly browserEvent: KeyboardEvent;
491
readonly target: HTMLElement;
492
readonly ctrlKey: boolean;
493
readonly shiftKey: boolean;
494
readonly altKey: boolean;
495
readonly metaKey: boolean;
496
readonly altGraphKey: boolean;
497
readonly keyCode: KeyCode;
498
readonly code: string;
499
equals(keybinding: number): boolean;
500
preventDefault(): void;
501
stopPropagation(): void;
502
}
503
export interface IMouseEvent {
504
readonly browserEvent: MouseEvent;
505
readonly leftButton: boolean;
506
readonly middleButton: boolean;
507
readonly rightButton: boolean;
508
readonly buttons: number;
509
readonly target: HTMLElement;
510
readonly detail: number;
511
readonly posx: number;
512
readonly posy: number;
513
readonly ctrlKey: boolean;
514
readonly shiftKey: boolean;
515
readonly altKey: boolean;
516
readonly metaKey: boolean;
517
readonly timestamp: number;
518
readonly defaultPrevented: boolean;
519
preventDefault(): void;
520
stopPropagation(): void;
521
}
522
523
export interface IScrollEvent {
524
readonly scrollTop: number;
525
readonly scrollLeft: number;
526
readonly scrollWidth: number;
527
readonly scrollHeight: number;
528
readonly scrollTopChanged: boolean;
529
readonly scrollLeftChanged: boolean;
530
readonly scrollWidthChanged: boolean;
531
readonly scrollHeightChanged: boolean;
532
}
533
/**
534
* A position in the editor. This interface is suitable for serialization.
535
*/
536
export interface IPosition {
537
/**
538
* line number (starts at 1)
539
*/
540
readonly lineNumber: number;
541
/**
542
* column (the first character in a line is between column 1 and column 2)
543
*/
544
readonly column: number;
545
}
546
547
/**
548
* A position in the editor.
549
*/
550
export class Position {
551
/**
552
* line number (starts at 1)
553
*/
554
readonly lineNumber: number;
555
/**
556
* column (the first character in a line is between column 1 and column 2)
557
*/
558
readonly column: number;
559
constructor(lineNumber: number, column: number);
560
/**
561
* Create a new position from this position.
562
*
563
* @param newLineNumber new line number
564
* @param newColumn new column
565
*/
566
with(newLineNumber?: number, newColumn?: number): Position;
567
/**
568
* Derive a new position from this position.
569
*
570
* @param deltaLineNumber line number delta
571
* @param deltaColumn column delta
572
*/
573
delta(deltaLineNumber?: number, deltaColumn?: number): Position;
574
/**
575
* Test if this position equals other position
576
*/
577
equals(other: IPosition): boolean;
578
/**
579
* Test if position `a` equals position `b`
580
*/
581
static equals(a: IPosition | null, b: IPosition | null): boolean;
582
/**
583
* Test if this position is before other position.
584
* If the two positions are equal, the result will be false.
585
*/
586
isBefore(other: IPosition): boolean;
587
/**
588
* Test if position `a` is before position `b`.
589
* If the two positions are equal, the result will be false.
590
*/
591
static isBefore(a: IPosition, b: IPosition): boolean;
592
/**
593
* Test if this position is before other position.
594
* If the two positions are equal, the result will be true.
595
*/
596
isBeforeOrEqual(other: IPosition): boolean;
597
/**
598
* Test if position `a` is before position `b`.
599
* If the two positions are equal, the result will be true.
600
*/
601
static isBeforeOrEqual(a: IPosition, b: IPosition): boolean;
602
/**
603
* A function that compares positions, useful for sorting
604
*/
605
static compare(a: IPosition, b: IPosition): number;
606
/**
607
* Clone this position.
608
*/
609
clone(): Position;
610
/**
611
* Convert to a human-readable representation.
612
*/
613
toString(): string;
614
/**
615
* Create a `Position` from an `IPosition`.
616
*/
617
static lift(pos: IPosition): Position;
618
/**
619
* Test if `obj` is an `IPosition`.
620
*/
621
static isIPosition(obj: any): obj is IPosition;
622
toJSON(): IPosition;
623
}
624
625
/**
626
* A range in the editor. This interface is suitable for serialization.
627
*/
628
export interface IRange {
629
/**
630
* Line number on which the range starts (starts at 1).
631
*/
632
readonly startLineNumber: number;
633
/**
634
* Column on which the range starts in line `startLineNumber` (starts at 1).
635
*/
636
readonly startColumn: number;
637
/**
638
* Line number on which the range ends.
639
*/
640
readonly endLineNumber: number;
641
/**
642
* Column on which the range ends in line `endLineNumber`.
643
*/
644
readonly endColumn: number;
645
}
646
647
/**
648
* A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)
649
*/
650
export class Range {
651
/**
652
* Line number on which the range starts (starts at 1).
653
*/
654
readonly startLineNumber: number;
655
/**
656
* Column on which the range starts in line `startLineNumber` (starts at 1).
657
*/
658
readonly startColumn: number;
659
/**
660
* Line number on which the range ends.
661
*/
662
readonly endLineNumber: number;
663
/**
664
* Column on which the range ends in line `endLineNumber`.
665
*/
666
readonly endColumn: number;
667
constructor(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number);
668
/**
669
* Test if this range is empty.
670
*/
671
isEmpty(): boolean;
672
/**
673
* Test if `range` is empty.
674
*/
675
static isEmpty(range: IRange): boolean;
676
/**
677
* Test if position is in this range. If the position is at the edges, will return true.
678
*/
679
containsPosition(position: IPosition): boolean;
680
/**
681
* Test if `position` is in `range`. If the position is at the edges, will return true.
682
*/
683
static containsPosition(range: IRange, position: IPosition): boolean;
684
/**
685
* Test if range is in this range. If the range is equal to this range, will return true.
686
*/
687
containsRange(range: IRange): boolean;
688
/**
689
* Test if `otherRange` is in `range`. If the ranges are equal, will return true.
690
*/
691
static containsRange(range: IRange, otherRange: IRange): boolean;
692
/**
693
* Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.
694
*/
695
strictContainsRange(range: IRange): boolean;
696
/**
697
* Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false.
698
*/
699
static strictContainsRange(range: IRange, otherRange: IRange): boolean;
700
/**
701
* A reunion of the two ranges.
702
* The smallest position will be used as the start point, and the largest one as the end point.
703
*/
704
plusRange(range: IRange): Range;
705
/**
706
* A reunion of the two ranges.
707
* The smallest position will be used as the start point, and the largest one as the end point.
708
*/
709
static plusRange(a: IRange, b: IRange): Range;
710
/**
711
* A intersection of the two ranges.
712
*/
713
intersectRanges(range: IRange): Range | null;
714
/**
715
* A intersection of the two ranges.
716
*/
717
static intersectRanges(a: IRange, b: IRange): Range | null;
718
/**
719
* Test if this range equals other.
720
*/
721
equalsRange(other: IRange | null | undefined): boolean;
722
/**
723
* Test if range `a` equals `b`.
724
*/
725
static equalsRange(a: IRange | null | undefined, b: IRange | null | undefined): boolean;
726
/**
727
* Return the end position (which will be after or equal to the start position)
728
*/
729
getEndPosition(): Position;
730
/**
731
* Return the end position (which will be after or equal to the start position)
732
*/
733
static getEndPosition(range: IRange): Position;
734
/**
735
* Return the start position (which will be before or equal to the end position)
736
*/
737
getStartPosition(): Position;
738
/**
739
* Return the start position (which will be before or equal to the end position)
740
*/
741
static getStartPosition(range: IRange): Position;
742
/**
743
* Transform to a user presentable string representation.
744
*/
745
toString(): string;
746
/**
747
* Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.
748
*/
749
setEndPosition(endLineNumber: number, endColumn: number): Range;
750
/**
751
* Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.
752
*/
753
setStartPosition(startLineNumber: number, startColumn: number): Range;
754
/**
755
* Create a new empty range using this range's start position.
756
*/
757
collapseToStart(): Range;
758
/**
759
* Create a new empty range using this range's start position.
760
*/
761
static collapseToStart(range: IRange): Range;
762
/**
763
* Create a new empty range using this range's end position.
764
*/
765
collapseToEnd(): Range;
766
/**
767
* Create a new empty range using this range's end position.
768
*/
769
static collapseToEnd(range: IRange): Range;
770
/**
771
* Moves the range by the given amount of lines.
772
*/
773
delta(lineCount: number): Range;
774
isSingleLine(): boolean;
775
static fromPositions(start: IPosition, end?: IPosition): Range;
776
/**
777
* Create a `Range` from an `IRange`.
778
*/
779
static lift(range: undefined | null): null;
780
static lift(range: IRange): Range;
781
static lift(range: IRange | undefined | null): Range | null;
782
/**
783
* Test if `obj` is an `IRange`.
784
*/
785
static isIRange(obj: any): obj is IRange;
786
/**
787
* Test if the two ranges are touching in any way.
788
*/
789
static areIntersectingOrTouching(a: IRange, b: IRange): boolean;
790
/**
791
* Test if the two ranges are intersecting. If the ranges are touching it returns true.
792
*/
793
static areIntersecting(a: IRange, b: IRange): boolean;
794
/**
795
* Test if the two ranges are intersecting, but not touching at all.
796
*/
797
static areOnlyIntersecting(a: IRange, b: IRange): boolean;
798
/**
799
* A function that compares ranges, useful for sorting ranges
800
* It will first compare ranges on the startPosition and then on the endPosition
801
*/
802
static compareRangesUsingStarts(a: IRange | null | undefined, b: IRange | null | undefined): number;
803
/**
804
* A function that compares ranges, useful for sorting ranges
805
* It will first compare ranges on the endPosition and then on the startPosition
806
*/
807
static compareRangesUsingEnds(a: IRange, b: IRange): number;
808
/**
809
* Test if the range spans multiple lines.
810
*/
811
static spansMultipleLines(range: IRange): boolean;
812
toJSON(): IRange;
813
}
814
815
/**
816
* A selection in the editor.
817
* The selection is a range that has an orientation.
818
*/
819
export interface ISelection {
820
/**
821
* The line number on which the selection has started.
822
*/
823
readonly selectionStartLineNumber: number;
824
/**
825
* The column on `selectionStartLineNumber` where the selection has started.
826
*/
827
readonly selectionStartColumn: number;
828
/**
829
* The line number on which the selection has ended.
830
*/
831
readonly positionLineNumber: number;
832
/**
833
* The column on `positionLineNumber` where the selection has ended.
834
*/
835
readonly positionColumn: number;
836
}
837
838
/**
839
* A selection in the editor.
840
* The selection is a range that has an orientation.
841
*/
842
export class Selection extends Range {
843
/**
844
* The line number on which the selection has started.
845
*/
846
readonly selectionStartLineNumber: number;
847
/**
848
* The column on `selectionStartLineNumber` where the selection has started.
849
*/
850
readonly selectionStartColumn: number;
851
/**
852
* The line number on which the selection has ended.
853
*/
854
readonly positionLineNumber: number;
855
/**
856
* The column on `positionLineNumber` where the selection has ended.
857
*/
858
readonly positionColumn: number;
859
constructor(selectionStartLineNumber: number, selectionStartColumn: number, positionLineNumber: number, positionColumn: number);
860
/**
861
* Transform to a human-readable representation.
862
*/
863
toString(): string;
864
/**
865
* Test if equals other selection.
866
*/
867
equalsSelection(other: ISelection): boolean;
868
/**
869
* Test if the two selections are equal.
870
*/
871
static selectionsEqual(a: ISelection, b: ISelection): boolean;
872
/**
873
* Get directions (LTR or RTL).
874
*/
875
getDirection(): SelectionDirection;
876
/**
877
* Create a new selection with a different `positionLineNumber` and `positionColumn`.
878
*/
879
setEndPosition(endLineNumber: number, endColumn: number): Selection;
880
/**
881
* Get the position at `positionLineNumber` and `positionColumn`.
882
*/
883
getPosition(): Position;
884
/**
885
* Get the position at the start of the selection.
886
*/
887
getSelectionStart(): Position;
888
/**
889
* Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`.
890
*/
891
setStartPosition(startLineNumber: number, startColumn: number): Selection;
892
/**
893
* Create a `Selection` from one or two positions
894
*/
895
static fromPositions(start: IPosition, end?: IPosition): Selection;
896
/**
897
* Creates a `Selection` from a range, given a direction.
898
*/
899
static fromRange(range: Range, direction: SelectionDirection): Selection;
900
/**
901
* Create a `Selection` from an `ISelection`.
902
*/
903
static liftSelection(sel: ISelection): Selection;
904
/**
905
* `a` equals `b`.
906
*/
907
static selectionsArrEqual(a: ISelection[], b: ISelection[]): boolean;
908
/**
909
* Test if `obj` is an `ISelection`.
910
*/
911
static isISelection(obj: any): obj is ISelection;
912
/**
913
* Create with a direction.
914
*/
915
static createWithDirection(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number, direction: SelectionDirection): Selection;
916
}
917
918
/**
919
* The direction of a selection.
920
*/
921
export enum SelectionDirection {
922
/**
923
* The selection starts above where it ends.
924
*/
925
LTR = 0,
926
/**
927
* The selection starts below where it ends.
928
*/
929
RTL = 1
930
}
931
932
export class Token {
933
readonly offset: number;
934
readonly type: string;
935
readonly language: string;
936
_tokenBrand: void;
937
constructor(offset: number, type: string, language: string);
938
toString(): string;
939
}
940
}
941
942
declare namespace monaco.editor {
943
944
/**
945
* Create a new editor under `domElement`.
946
* `domElement` should be empty (not contain other dom nodes).
947
* The editor will read the size of `domElement`.
948
*/
949
export function create(domElement: HTMLElement, options?: IStandaloneEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneCodeEditor;
950
951
/**
952
* Emitted when an editor is created.
953
* Creating a diff editor might cause this listener to be invoked with the two editors.
954
* @event
955
*/
956
export function onDidCreateEditor(listener: (codeEditor: ICodeEditor) => void): IDisposable;
957
958
/**
959
* Emitted when an diff editor is created.
960
* @event
961
*/
962
export function onDidCreateDiffEditor(listener: (diffEditor: IDiffEditor) => void): IDisposable;
963
964
/**
965
* Get all the created editors.
966
*/
967
export function getEditors(): readonly ICodeEditor[];
968
969
/**
970
* Get all the created diff editors.
971
*/
972
export function getDiffEditors(): readonly IDiffEditor[];
973
974
/**
975
* Create a new diff editor under `domElement`.
976
* `domElement` should be empty (not contain other dom nodes).
977
* The editor will read the size of `domElement`.
978
*/
979
export function createDiffEditor(domElement: HTMLElement, options?: IStandaloneDiffEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneDiffEditor;
980
981
export function createMultiFileDiffEditor(domElement: HTMLElement, override?: IEditorOverrideServices): any;
982
983
/**
984
* Description of a command contribution
985
*/
986
export interface ICommandDescriptor {
987
/**
988
* An unique identifier of the contributed command.
989
*/
990
id: string;
991
/**
992
* Callback that will be executed when the command is triggered.
993
*/
994
run: ICommandHandler;
995
}
996
997
/**
998
* Add a command.
999
*/
1000
export function addCommand(descriptor: ICommandDescriptor): IDisposable;
1001
1002
/**
1003
* Add an action to all editors.
1004
*/
1005
export function addEditorAction(descriptor: IActionDescriptor): IDisposable;
1006
1007
/**
1008
* A keybinding rule.
1009
*/
1010
export interface IKeybindingRule {
1011
keybinding: number;
1012
command?: string | null;
1013
commandArgs?: any;
1014
when?: string | null;
1015
}
1016
1017
/**
1018
* Add a keybinding rule.
1019
*/
1020
export function addKeybindingRule(rule: IKeybindingRule): IDisposable;
1021
1022
/**
1023
* Add keybinding rules.
1024
*/
1025
export function addKeybindingRules(rules: IKeybindingRule[]): IDisposable;
1026
1027
/**
1028
* Create a new editor model.
1029
* You can specify the language that should be set for this model or let the language be inferred from the `uri`.
1030
*/
1031
export function createModel(value: string, language?: string, uri?: Uri): ITextModel;
1032
1033
/**
1034
* Change the language for a model.
1035
*/
1036
export function setModelLanguage(model: ITextModel, mimeTypeOrLanguageId: string): void;
1037
1038
/**
1039
* Set the markers for a model.
1040
*/
1041
export function setModelMarkers(model: ITextModel, owner: string, markers: IMarkerData[]): void;
1042
1043
/**
1044
* Remove all markers of an owner.
1045
*/
1046
export function removeAllMarkers(owner: string): void;
1047
1048
/**
1049
* Get markers for owner and/or resource
1050
*
1051
* @returns list of markers
1052
*/
1053
export function getModelMarkers(filter: {
1054
owner?: string;
1055
resource?: Uri;
1056
take?: number;
1057
}): IMarker[];
1058
1059
/**
1060
* Emitted when markers change for a model.
1061
* @event
1062
*/
1063
export function onDidChangeMarkers(listener: (e: readonly Uri[]) => void): IDisposable;
1064
1065
/**
1066
* Get the model that has `uri` if it exists.
1067
*/
1068
export function getModel(uri: Uri): ITextModel | null;
1069
1070
/**
1071
* Get all the created models.
1072
*/
1073
export function getModels(): ITextModel[];
1074
1075
/**
1076
* Emitted when a model is created.
1077
* @event
1078
*/
1079
export function onDidCreateModel(listener: (model: ITextModel) => void): IDisposable;
1080
1081
/**
1082
* Emitted right before a model is disposed.
1083
* @event
1084
*/
1085
export function onWillDisposeModel(listener: (model: ITextModel) => void): IDisposable;
1086
1087
/**
1088
* Emitted when a different language is set to a model.
1089
* @event
1090
*/
1091
export function onDidChangeModelLanguage(listener: (e: {
1092
readonly model: ITextModel;
1093
readonly oldLanguage: string;
1094
}) => void): IDisposable;
1095
1096
/**
1097
* Create a new web worker that has model syncing capabilities built in.
1098
* Specify an AMD module to load that will `create` an object that will be proxied.
1099
*/
1100
export function createWebWorker<T extends object>(opts: IInternalWebWorkerOptions): MonacoWebWorker<T>;
1101
1102
/**
1103
* Colorize the contents of `domNode` using attribute `data-lang`.
1104
*/
1105
export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): Promise<void>;
1106
1107
/**
1108
* Colorize `text` using language `languageId`.
1109
*/
1110
export function colorize(text: string, languageId: string, options: IColorizerOptions): Promise<string>;
1111
1112
/**
1113
* Colorize a line in a model.
1114
*/
1115
export function colorizeModelLine(model: ITextModel, lineNumber: number, tabSize?: number): string;
1116
1117
/**
1118
* Tokenize `text` using language `languageId`
1119
*/
1120
export function tokenize(text: string, languageId: string): Token[][];
1121
1122
/**
1123
* Define a new theme or update an existing theme.
1124
*/
1125
export function defineTheme(themeName: string, themeData: IStandaloneThemeData): void;
1126
1127
/**
1128
* Switches to a theme.
1129
*/
1130
export function setTheme(themeName: string): void;
1131
1132
/**
1133
* Clears all cached font measurements and triggers re-measurement.
1134
*/
1135
export function remeasureFonts(): void;
1136
1137
/**
1138
* Register a command.
1139
*/
1140
export function registerCommand(id: string, handler: (accessor: any, ...args: any[]) => void): IDisposable;
1141
1142
export interface ILinkOpener {
1143
open(resource: Uri): boolean | Promise<boolean>;
1144
}
1145
1146
/**
1147
* Registers a handler that is called when a link is opened in any editor. The handler callback should return `true` if the link was handled and `false` otherwise.
1148
* The handler that was registered last will be called first when a link is opened.
1149
*
1150
* Returns a disposable that can unregister the opener again.
1151
*/
1152
export function registerLinkOpener(opener: ILinkOpener): IDisposable;
1153
1154
/**
1155
* Represents an object that can handle editor open operations (e.g. when "go to definition" is called
1156
* with a resource other than the current model).
1157
*/
1158
export interface ICodeEditorOpener {
1159
/**
1160
* Callback that is invoked when a resource other than the current model should be opened (e.g. when "go to definition" is called).
1161
* The callback should return `true` if the request was handled and `false` otherwise.
1162
* @param source The code editor instance that initiated the request.
1163
* @param resource The Uri of the resource that should be opened.
1164
* @param selectionOrPosition An optional position or selection inside the model corresponding to `resource` that can be used to set the cursor.
1165
*/
1166
openCodeEditor(source: ICodeEditor, resource: Uri, selectionOrPosition?: IRange | IPosition): boolean | Promise<boolean>;
1167
}
1168
1169
/**
1170
* Registers a handler that is called when a resource other than the current model should be opened in the editor (e.g. "go to definition").
1171
* The handler callback should return `true` if the request was handled and `false` otherwise.
1172
*
1173
* Returns a disposable that can unregister the opener again.
1174
*
1175
* If no handler is registered the default behavior is to do nothing for models other than the currently attached one.
1176
*/
1177
export function registerEditorOpener(opener: ICodeEditorOpener): IDisposable;
1178
1179
export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black' | 'hc-light';
1180
1181
export interface IStandaloneThemeData {
1182
base: BuiltinTheme;
1183
inherit: boolean;
1184
rules: ITokenThemeRule[];
1185
encodedTokensColors?: string[];
1186
colors: IColors;
1187
}
1188
1189
export type IColors = {
1190
[colorId: string]: string;
1191
};
1192
1193
export interface ITokenThemeRule {
1194
token: string;
1195
foreground?: string;
1196
background?: string;
1197
fontStyle?: string;
1198
}
1199
1200
/**
1201
* A web worker that can provide a proxy to an arbitrary file.
1202
*/
1203
export interface MonacoWebWorker<T> {
1204
/**
1205
* Terminate the web worker, thus invalidating the returned proxy.
1206
*/
1207
dispose(): void;
1208
/**
1209
* Get a proxy to the arbitrary loaded code.
1210
*/
1211
getProxy(): Promise<T>;
1212
/**
1213
* Synchronize (send) the models at `resources` to the web worker,
1214
* making them available in the monaco.worker.getMirrorModels().
1215
*/
1216
withSyncedResources(resources: Uri[]): Promise<T>;
1217
}
1218
1219
export interface IInternalWebWorkerOptions {
1220
/**
1221
* The worker.
1222
*/
1223
worker: Worker | Promise<Worker>;
1224
/**
1225
* An object that can be used by the web worker to make calls back to the main thread.
1226
*/
1227
host?: any;
1228
/**
1229
* Keep idle models.
1230
* Defaults to false, which means that idle models will stop syncing after a while.
1231
*/
1232
keepIdleModels?: boolean;
1233
}
1234
1235
/**
1236
* Description of an action contribution
1237
*/
1238
export interface IActionDescriptor {
1239
/**
1240
* An unique identifier of the contributed action.
1241
*/
1242
id: string;
1243
/**
1244
* A label of the action that will be presented to the user.
1245
*/
1246
label: string;
1247
/**
1248
* Precondition rule. The value should be a [context key expression](https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts).
1249
*/
1250
precondition?: string;
1251
/**
1252
* An array of keybindings for the action.
1253
*/
1254
keybindings?: number[];
1255
/**
1256
* The keybinding rule (condition on top of precondition).
1257
*/
1258
keybindingContext?: string;
1259
/**
1260
* Control if the action should show up in the context menu and where.
1261
* The context menu of the editor has these default:
1262
* navigation - The navigation group comes first in all cases.
1263
* 1_modification - This group comes next and contains commands that modify your code.
1264
* 9_cutcopypaste - The last default group with the basic editing commands.
1265
* You can also create your own group.
1266
* Defaults to null (don't show in context menu).
1267
*/
1268
contextMenuGroupId?: string;
1269
/**
1270
* Control the order in the context menu group.
1271
*/
1272
contextMenuOrder?: number;
1273
/**
1274
* Method that will be executed when the action is triggered.
1275
* @param editor The editor instance is passed in as a convenience
1276
*/
1277
run(editor: ICodeEditor, ...args: any[]): void | Promise<void>;
1278
}
1279
1280
/**
1281
* Options which apply for all editors.
1282
*/
1283
export interface IGlobalEditorOptions {
1284
/**
1285
* The number of spaces a tab is equal to.
1286
* This setting is overridden based on the file contents when `detectIndentation` is on.
1287
* Defaults to 4.
1288
*/
1289
tabSize?: number;
1290
/**
1291
* Insert spaces when pressing `Tab`.
1292
* This setting is overridden based on the file contents when `detectIndentation` is on.
1293
* Defaults to true.
1294
*/
1295
insertSpaces?: boolean;
1296
/**
1297
* Controls whether `tabSize` and `insertSpaces` will be automatically detected when a file is opened based on the file contents.
1298
* Defaults to true.
1299
*/
1300
detectIndentation?: boolean;
1301
/**
1302
* Remove trailing auto inserted whitespace.
1303
* Defaults to true.
1304
*/
1305
trimAutoWhitespace?: boolean;
1306
/**
1307
* Special handling for large files to disable certain memory intensive features.
1308
* Defaults to true.
1309
*/
1310
largeFileOptimizations?: boolean;
1311
/**
1312
* Controls whether completions should be computed based on words in the document.
1313
* Defaults to true.
1314
*/
1315
wordBasedSuggestions?: 'off' | 'currentDocument' | 'matchingDocuments' | 'allDocuments';
1316
/**
1317
* Controls whether word based completions should be included from opened documents of the same language or any language.
1318
*/
1319
wordBasedSuggestionsOnlySameLanguage?: boolean;
1320
/**
1321
* Controls whether the semanticHighlighting is shown for the languages that support it.
1322
* true: semanticHighlighting is enabled for all themes
1323
* false: semanticHighlighting is disabled for all themes
1324
* 'configuredByTheme': semanticHighlighting is controlled by the current color theme's semanticHighlighting setting.
1325
* Defaults to 'byTheme'.
1326
*/
1327
'semanticHighlighting.enabled'?: true | false | 'configuredByTheme';
1328
/**
1329
* Keep peek editors open even when double-clicking their content or when hitting `Escape`.
1330
* Defaults to false.
1331
*/
1332
stablePeek?: boolean;
1333
/**
1334
* Lines above this length will not be tokenized for performance reasons.
1335
* Defaults to 20000.
1336
*/
1337
maxTokenizationLineLength?: number;
1338
/**
1339
* Theme to be used for rendering.
1340
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light'.
1341
* You can create custom themes via `monaco.editor.defineTheme`.
1342
* To switch a theme, use `monaco.editor.setTheme`.
1343
* **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false.
1344
*/
1345
theme?: string;
1346
/**
1347
* If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme.
1348
* Defaults to true.
1349
*/
1350
autoDetectHighContrast?: boolean;
1351
}
1352
1353
/**
1354
* The options to create an editor.
1355
*/
1356
export interface IStandaloneEditorConstructionOptions extends IEditorConstructionOptions, IGlobalEditorOptions {
1357
/**
1358
* The initial model associated with this code editor.
1359
*/
1360
model?: ITextModel | null;
1361
/**
1362
* The initial value of the auto created model in the editor.
1363
* To not automatically create a model, use `model: null`.
1364
*/
1365
value?: string;
1366
/**
1367
* The initial language of the auto created model in the editor.
1368
* To not automatically create a model, use `model: null`.
1369
*/
1370
language?: string;
1371
/**
1372
* Initial theme to be used for rendering.
1373
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light.
1374
* You can create custom themes via `monaco.editor.defineTheme`.
1375
* To switch a theme, use `monaco.editor.setTheme`.
1376
* **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false.
1377
*/
1378
theme?: string;
1379
/**
1380
* If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme.
1381
* Defaults to true.
1382
*/
1383
autoDetectHighContrast?: boolean;
1384
/**
1385
* An URL to open when Ctrl+H (Windows and Linux) or Cmd+H (OSX) is pressed in
1386
* the accessibility help dialog in the editor.
1387
*
1388
* Defaults to "https://go.microsoft.com/fwlink/?linkid=852450"
1389
*/
1390
accessibilityHelpUrl?: string;
1391
/**
1392
* Container element to use for ARIA messages.
1393
* Defaults to document.body.
1394
*/
1395
ariaContainerElement?: HTMLElement;
1396
}
1397
1398
/**
1399
* The options to create a diff editor.
1400
*/
1401
export interface IStandaloneDiffEditorConstructionOptions extends IDiffEditorConstructionOptions {
1402
/**
1403
* Initial theme to be used for rendering.
1404
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black', 'hc-light.
1405
* You can create custom themes via `monaco.editor.defineTheme`.
1406
* To switch a theme, use `monaco.editor.setTheme`.
1407
* **NOTE**: The theme might be overwritten if the OS is in high contrast mode, unless `autoDetectHighContrast` is set to false.
1408
*/
1409
theme?: string;
1410
/**
1411
* If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme.
1412
* Defaults to true.
1413
*/
1414
autoDetectHighContrast?: boolean;
1415
}
1416
1417
export interface IStandaloneCodeEditor extends ICodeEditor {
1418
updateOptions(newOptions: IEditorOptions & IGlobalEditorOptions): void;
1419
addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null;
1420
createContextKey<T extends ContextKeyValue = ContextKeyValue>(key: string, defaultValue: T): IContextKey<T>;
1421
addAction(descriptor: IActionDescriptor): IDisposable;
1422
}
1423
1424
export interface IStandaloneDiffEditor extends IDiffEditor {
1425
addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null;
1426
createContextKey<T extends ContextKeyValue = ContextKeyValue>(key: string, defaultValue: T): IContextKey<T>;
1427
addAction(descriptor: IActionDescriptor): IDisposable;
1428
getOriginalEditor(): IStandaloneCodeEditor;
1429
getModifiedEditor(): IStandaloneCodeEditor;
1430
}
1431
export interface ICommandHandler {
1432
(...args: any[]): void;
1433
}
1434
export interface ILocalizedString {
1435
original: string;
1436
value: string;
1437
}
1438
export interface ICommandMetadata {
1439
readonly description: ILocalizedString | string;
1440
}
1441
1442
export interface IContextKey<T extends ContextKeyValue = ContextKeyValue> {
1443
set(value: T): void;
1444
reset(): void;
1445
get(): T | undefined;
1446
}
1447
1448
export type ContextKeyValue = null | undefined | boolean | number | string | Array<null | undefined | boolean | number | string> | Record<string, null | undefined | boolean | number | string>;
1449
1450
export interface IEditorOverrideServices {
1451
[index: string]: any;
1452
}
1453
1454
export interface IMarker {
1455
owner: string;
1456
resource: Uri;
1457
severity: MarkerSeverity;
1458
code?: string | {
1459
value: string;
1460
target: Uri;
1461
};
1462
message: string;
1463
source?: string;
1464
startLineNumber: number;
1465
startColumn: number;
1466
endLineNumber: number;
1467
endColumn: number;
1468
modelVersionId?: number;
1469
relatedInformation?: IRelatedInformation[];
1470
tags?: MarkerTag[];
1471
origin?: string | undefined;
1472
}
1473
1474
/**
1475
* A structure defining a problem/warning/etc.
1476
*/
1477
export interface IMarkerData {
1478
code?: string | {
1479
value: string;
1480
target: Uri;
1481
};
1482
severity: MarkerSeverity;
1483
message: string;
1484
source?: string;
1485
startLineNumber: number;
1486
startColumn: number;
1487
endLineNumber: number;
1488
endColumn: number;
1489
modelVersionId?: number;
1490
relatedInformation?: IRelatedInformation[];
1491
tags?: MarkerTag[];
1492
origin?: string | undefined;
1493
}
1494
1495
/**
1496
*
1497
*/
1498
export interface IRelatedInformation {
1499
resource: Uri;
1500
message: string;
1501
startLineNumber: number;
1502
startColumn: number;
1503
endLineNumber: number;
1504
endColumn: number;
1505
}
1506
1507
export interface IColorizerOptions {
1508
tabSize?: number;
1509
}
1510
1511
export interface IColorizerElementOptions extends IColorizerOptions {
1512
theme?: string;
1513
mimeType?: string;
1514
}
1515
1516
export enum ScrollbarVisibility {
1517
Auto = 1,
1518
Hidden = 2,
1519
Visible = 3
1520
}
1521
1522
export interface ThemeColor {
1523
id: string;
1524
}
1525
1526
export interface ThemeIcon {
1527
readonly id: string;
1528
readonly color?: ThemeColor;
1529
}
1530
1531
/**
1532
* A single edit operation, that acts as a simple replace.
1533
* i.e. Replace text at `range` with `text` in model.
1534
*/
1535
export interface ISingleEditOperation {
1536
/**
1537
* The range to replace. This can be empty to emulate a simple insert.
1538
*/
1539
range: IRange;
1540
/**
1541
* The text to replace with. This can be null to emulate a simple delete.
1542
*/
1543
text: string | null;
1544
/**
1545
* This indicates that this operation has "insert" semantics.
1546
* i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved.
1547
*/
1548
forceMoveMarkers?: boolean;
1549
}
1550
1551
/**
1552
* Word inside a model.
1553
*/
1554
export interface IWordAtPosition {
1555
/**
1556
* The word.
1557
*/
1558
readonly word: string;
1559
/**
1560
* The column where the word starts.
1561
*/
1562
readonly startColumn: number;
1563
/**
1564
* The column where the word ends.
1565
*/
1566
readonly endColumn: number;
1567
}
1568
1569
/**
1570
* Vertical Lane in the overview ruler of the editor.
1571
*/
1572
export enum OverviewRulerLane {
1573
Left = 1,
1574
Center = 2,
1575
Right = 4,
1576
Full = 7
1577
}
1578
1579
/**
1580
* Vertical Lane in the glyph margin of the editor.
1581
*/
1582
export enum GlyphMarginLane {
1583
Left = 1,
1584
Center = 2,
1585
Right = 3
1586
}
1587
1588
export interface IGlyphMarginLanesModel {
1589
/**
1590
* The number of lanes that should be rendered in the editor.
1591
*/
1592
readonly requiredLanes: number;
1593
/**
1594
* Gets the lanes that should be rendered starting at a given line number.
1595
*/
1596
getLanesAtLine(lineNumber: number): GlyphMarginLane[];
1597
/**
1598
* Resets the model and ensures it can contain at least `maxLine` lines.
1599
*/
1600
reset(maxLine: number): void;
1601
/**
1602
* Registers that a lane should be visible at the Range in the model.
1603
* @param persist - if true, notes that the lane should always be visible,
1604
* even on lines where there's no specific request for that lane.
1605
*/
1606
push(lane: GlyphMarginLane, range: Range, persist?: boolean): void;
1607
}
1608
1609
/**
1610
* Position in the minimap to render the decoration.
1611
*/
1612
export enum MinimapPosition {
1613
Inline = 1,
1614
Gutter = 2
1615
}
1616
1617
/**
1618
* Section header style.
1619
*/
1620
export enum MinimapSectionHeaderStyle {
1621
Normal = 1,
1622
Underlined = 2
1623
}
1624
1625
export interface IDecorationOptions {
1626
/**
1627
* CSS color to render.
1628
* e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
1629
*/
1630
color: string | ThemeColor | undefined;
1631
/**
1632
* CSS color to render.
1633
* e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
1634
*/
1635
darkColor?: string | ThemeColor;
1636
}
1637
1638
export interface IModelDecorationGlyphMarginOptions {
1639
/**
1640
* The position in the glyph margin.
1641
*/
1642
position: GlyphMarginLane;
1643
/**
1644
* Whether the glyph margin lane in {@link position} should be rendered even
1645
* outside of this decoration's range.
1646
*/
1647
persistLane?: boolean;
1648
}
1649
1650
/**
1651
* Options for rendering a model decoration in the overview ruler.
1652
*/
1653
export interface IModelDecorationOverviewRulerOptions extends IDecorationOptions {
1654
/**
1655
* The position in the overview ruler.
1656
*/
1657
position: OverviewRulerLane;
1658
}
1659
1660
/**
1661
* Options for rendering a model decoration in the minimap.
1662
*/
1663
export interface IModelDecorationMinimapOptions extends IDecorationOptions {
1664
/**
1665
* The position in the minimap.
1666
*/
1667
position: MinimapPosition;
1668
/**
1669
* If the decoration is for a section header, which header style.
1670
*/
1671
sectionHeaderStyle?: MinimapSectionHeaderStyle | null;
1672
/**
1673
* If the decoration is for a section header, the header text.
1674
*/
1675
sectionHeaderText?: string | null;
1676
}
1677
1678
/**
1679
* Options for a model decoration.
1680
*/
1681
export interface IModelDecorationOptions {
1682
/**
1683
* Customize the growing behavior of the decoration when typing at the edges of the decoration.
1684
* Defaults to TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges
1685
*/
1686
stickiness?: TrackedRangeStickiness;
1687
/**
1688
* CSS class name describing the decoration.
1689
*/
1690
className?: string | null;
1691
/**
1692
* Indicates whether the decoration should span across the entire line when it continues onto the next line.
1693
*/
1694
shouldFillLineOnLineBreak?: boolean | null;
1695
blockClassName?: string | null;
1696
/**
1697
* Indicates if this block should be rendered after the last line.
1698
* In this case, the range must be empty and set to the last line.
1699
*/
1700
blockIsAfterEnd?: boolean | null;
1701
blockDoesNotCollapse?: boolean | null;
1702
blockPadding?: [top: number, right: number, bottom: number, left: number] | null;
1703
/**
1704
* Message to be rendered when hovering over the glyph margin decoration.
1705
*/
1706
glyphMarginHoverMessage?: IMarkdownString | IMarkdownString[] | null;
1707
/**
1708
* Array of MarkdownString to render as the decoration message.
1709
*/
1710
hoverMessage?: IMarkdownString | IMarkdownString[] | null;
1711
/**
1712
* Array of MarkdownString to render as the line number message.
1713
*/
1714
lineNumberHoverMessage?: IMarkdownString | IMarkdownString[] | null;
1715
/**
1716
* Should the decoration expand to encompass a whole line.
1717
*/
1718
isWholeLine?: boolean;
1719
/**
1720
* Always render the decoration (even when the range it encompasses is collapsed).
1721
*/
1722
showIfCollapsed?: boolean;
1723
/**
1724
* Specifies the stack order of a decoration.
1725
* A decoration with greater stack order is always in front of a decoration with
1726
* a lower stack order when the decorations are on the same line.
1727
*/
1728
zIndex?: number;
1729
/**
1730
* If set, render this decoration in the overview ruler.
1731
*/
1732
overviewRuler?: IModelDecorationOverviewRulerOptions | null;
1733
/**
1734
* If set, render this decoration in the minimap.
1735
*/
1736
minimap?: IModelDecorationMinimapOptions | null;
1737
/**
1738
* If set, the decoration will be rendered in the glyph margin with this CSS class name.
1739
*/
1740
glyphMarginClassName?: string | null;
1741
/**
1742
* If set and the decoration has {@link glyphMarginClassName} set, render this decoration
1743
* with the specified {@link IModelDecorationGlyphMarginOptions} in the glyph margin.
1744
*/
1745
glyphMargin?: IModelDecorationGlyphMarginOptions | null;
1746
/**
1747
* If set, the decoration will override the line height of the lines it spans. Maximum value is 300px.
1748
*/
1749
lineHeight?: number | null;
1750
/**
1751
* Font family
1752
*/
1753
fontFamily?: string | null;
1754
/**
1755
* Font size
1756
*/
1757
fontSize?: string | null;
1758
/**
1759
* Font weight
1760
*/
1761
fontWeight?: string | null;
1762
/**
1763
* Font style
1764
*/
1765
fontStyle?: string | null;
1766
/**
1767
* If set, the decoration will be rendered in the lines decorations with this CSS class name.
1768
*/
1769
linesDecorationsClassName?: string | null;
1770
/**
1771
* Controls the tooltip text of the line decoration.
1772
*/
1773
linesDecorationsTooltip?: string | null;
1774
/**
1775
* If set, the decoration will be rendered on the line number.
1776
*/
1777
lineNumberClassName?: string | null;
1778
/**
1779
* 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.
1780
*/
1781
firstLineDecorationClassName?: string | null;
1782
/**
1783
* If set, the decoration will be rendered in the margin (covering its full width) with this CSS class name.
1784
*/
1785
marginClassName?: string | null;
1786
/**
1787
* If set, the decoration will be rendered inline with the text with this CSS class name.
1788
* Please use this only for CSS rules that must impact the text. For example, use `className`
1789
* to have a background color decoration.
1790
*/
1791
inlineClassName?: string | null;
1792
/**
1793
* If there is an `inlineClassName` which affects letter spacing.
1794
*/
1795
inlineClassNameAffectsLetterSpacing?: boolean;
1796
/**
1797
* If set, the decoration will be rendered before the text with this CSS class name.
1798
*/
1799
beforeContentClassName?: string | null;
1800
/**
1801
* If set, the decoration will be rendered after the text with this CSS class name.
1802
*/
1803
afterContentClassName?: string | null;
1804
/**
1805
* If set, text will be injected in the view after the range.
1806
*/
1807
after?: InjectedTextOptions | null;
1808
/**
1809
* If set, text will be injected in the view before the range.
1810
*/
1811
before?: InjectedTextOptions | null;
1812
/**
1813
* The text direction of the decoration.
1814
*/
1815
textDirection?: TextDirection | null;
1816
}
1817
1818
/**
1819
* Text Direction for a decoration.
1820
*/
1821
export enum TextDirection {
1822
LTR = 0,
1823
RTL = 1
1824
}
1825
1826
/**
1827
* Configures text that is injected into the view without changing the underlying document.
1828
*/
1829
export interface InjectedTextOptions {
1830
/**
1831
* Sets the text to inject. Must be a single line.
1832
*/
1833
readonly content: string;
1834
/**
1835
* If set, the decoration will be rendered inline with the text with this CSS class name.
1836
*/
1837
readonly inlineClassName?: string | null;
1838
/**
1839
* If there is an `inlineClassName` which affects letter spacing.
1840
*/
1841
readonly inlineClassNameAffectsLetterSpacing?: boolean;
1842
/**
1843
* This field allows to attach data to this injected text.
1844
* The data can be read when injected texts at a given position are queried.
1845
*/
1846
readonly attachedData?: unknown;
1847
/**
1848
* Configures cursor stops around injected text.
1849
* Defaults to {@link InjectedTextCursorStops.Both}.
1850
*/
1851
readonly cursorStops?: InjectedTextCursorStops | null;
1852
}
1853
1854
export enum InjectedTextCursorStops {
1855
Both = 0,
1856
Right = 1,
1857
Left = 2,
1858
None = 3
1859
}
1860
1861
/**
1862
* New model decorations.
1863
*/
1864
export interface IModelDeltaDecoration {
1865
/**
1866
* Range that this decoration covers.
1867
*/
1868
range: IRange;
1869
/**
1870
* Options associated with this decoration.
1871
*/
1872
options: IModelDecorationOptions;
1873
}
1874
1875
/**
1876
* A decoration in the model.
1877
*/
1878
export interface IModelDecoration {
1879
/**
1880
* Identifier for a decoration.
1881
*/
1882
readonly id: string;
1883
/**
1884
* Identifier for a decoration's owner.
1885
*/
1886
readonly ownerId: number;
1887
/**
1888
* Range that this decoration covers.
1889
*/
1890
readonly range: Range;
1891
/**
1892
* Options associated with this decoration.
1893
*/
1894
readonly options: IModelDecorationOptions;
1895
}
1896
1897
/**
1898
* End of line character preference.
1899
*/
1900
export enum EndOfLinePreference {
1901
/**
1902
* Use the end of line character identified in the text buffer.
1903
*/
1904
TextDefined = 0,
1905
/**
1906
* Use line feed (\n) as the end of line character.
1907
*/
1908
LF = 1,
1909
/**
1910
* Use carriage return and line feed (\r\n) as the end of line character.
1911
*/
1912
CRLF = 2
1913
}
1914
1915
/**
1916
* The default end of line to use when instantiating models.
1917
*/
1918
export enum DefaultEndOfLine {
1919
/**
1920
* Use line feed (\n) as the end of line character.
1921
*/
1922
LF = 1,
1923
/**
1924
* Use carriage return and line feed (\r\n) as the end of line character.
1925
*/
1926
CRLF = 2
1927
}
1928
1929
/**
1930
* End of line character preference.
1931
*/
1932
export enum EndOfLineSequence {
1933
/**
1934
* Use line feed (\n) as the end of line character.
1935
*/
1936
LF = 0,
1937
/**
1938
* Use carriage return and line feed (\r\n) as the end of line character.
1939
*/
1940
CRLF = 1
1941
}
1942
1943
/**
1944
* A single edit operation, that has an identifier.
1945
*/
1946
export interface IIdentifiedSingleEditOperation extends ISingleEditOperation {
1947
}
1948
1949
export interface IValidEditOperation {
1950
/**
1951
* The range to replace. This can be empty to emulate a simple insert.
1952
*/
1953
range: Range;
1954
/**
1955
* The text to replace with. This can be empty to emulate a simple delete.
1956
*/
1957
text: string;
1958
}
1959
1960
/**
1961
* A callback that can compute the cursor state after applying a series of edit operations.
1962
*/
1963
export interface ICursorStateComputer {
1964
/**
1965
* A callback that can compute the resulting cursors state after some edit operations have been executed.
1966
*/
1967
(inverseEditOperations: IValidEditOperation[]): Selection[] | null;
1968
}
1969
1970
export class TextModelResolvedOptions {
1971
_textModelResolvedOptionsBrand: void;
1972
readonly tabSize: number;
1973
readonly indentSize: number;
1974
readonly insertSpaces: boolean;
1975
readonly defaultEOL: DefaultEndOfLine;
1976
readonly trimAutoWhitespace: boolean;
1977
readonly bracketPairColorizationOptions: BracketPairColorizationOptions;
1978
get originalIndentSize(): number | 'tabSize';
1979
}
1980
1981
export interface BracketPairColorizationOptions {
1982
enabled: boolean;
1983
independentColorPoolPerBracketType: boolean;
1984
}
1985
1986
export interface ITextModelUpdateOptions {
1987
tabSize?: number;
1988
indentSize?: number | 'tabSize';
1989
insertSpaces?: boolean;
1990
trimAutoWhitespace?: boolean;
1991
bracketColorizationOptions?: BracketPairColorizationOptions;
1992
}
1993
1994
export class FindMatch {
1995
_findMatchBrand: void;
1996
readonly range: Range;
1997
readonly matches: string[] | null;
1998
}
1999
2000
/**
2001
* Describes the behavior of decorations when typing/editing near their edges.
2002
* Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior`
2003
*/
2004
export enum TrackedRangeStickiness {
2005
AlwaysGrowsWhenTypingAtEdges = 0,
2006
NeverGrowsWhenTypingAtEdges = 1,
2007
GrowsOnlyWhenTypingBefore = 2,
2008
GrowsOnlyWhenTypingAfter = 3
2009
}
2010
2011
/**
2012
* Text snapshot that works like an iterator.
2013
* Will try to return chunks of roughly ~64KB size.
2014
* Will return null when finished.
2015
*/
2016
export interface ITextSnapshot {
2017
read(): string | null;
2018
}
2019
2020
/**
2021
* A model.
2022
*/
2023
export interface ITextModel {
2024
/**
2025
* Gets the resource associated with this editor model.
2026
*/
2027
readonly uri: Uri;
2028
/**
2029
* A unique identifier associated with this model.
2030
*/
2031
readonly id: string;
2032
/**
2033
* Get the resolved options for this model.
2034
*/
2035
getOptions(): TextModelResolvedOptions;
2036
/**
2037
* Get the current version id of the model.
2038
* Anytime a change happens to the model (even undo/redo),
2039
* the version id is incremented.
2040
*/
2041
getVersionId(): number;
2042
/**
2043
* Get the alternative version id of the model.
2044
* This alternative version id is not always incremented,
2045
* it will return the same values in the case of undo-redo.
2046
*/
2047
getAlternativeVersionId(): number;
2048
/**
2049
* Replace the entire text buffer value contained in this model.
2050
*/
2051
setValue(newValue: string | ITextSnapshot): void;
2052
/**
2053
* Get the text stored in this model.
2054
* @param eol The end of line character preference. Defaults to `EndOfLinePreference.TextDefined`.
2055
* @param preserverBOM Preserve a BOM character if it was detected when the model was constructed.
2056
* @return The text.
2057
*/
2058
getValue(eol?: EndOfLinePreference, preserveBOM?: boolean): string;
2059
/**
2060
* Get the text stored in this model.
2061
* @param preserverBOM Preserve a BOM character if it was detected when the model was constructed.
2062
* @return The text snapshot (it is safe to consume it asynchronously).
2063
*/
2064
createSnapshot(preserveBOM?: boolean): ITextSnapshot;
2065
/**
2066
* Get the length of the text stored in this model.
2067
*/
2068
getValueLength(eol?: EndOfLinePreference, preserveBOM?: boolean): number;
2069
/**
2070
* Get the text in a certain range.
2071
* @param range The range describing what text to get.
2072
* @param eol The end of line character preference. This will only be used for multiline ranges. Defaults to `EndOfLinePreference.TextDefined`.
2073
* @return The text.
2074
*/
2075
getValueInRange(range: IRange, eol?: EndOfLinePreference): string;
2076
/**
2077
* Get the length of text in a certain range.
2078
* @param range The range describing what text length to get.
2079
* @return The text length.
2080
*/
2081
getValueLengthInRange(range: IRange, eol?: EndOfLinePreference): number;
2082
/**
2083
* Get the character count of text in a certain range.
2084
* @param range The range describing what text length to get.
2085
*/
2086
getCharacterCountInRange(range: IRange, eol?: EndOfLinePreference): number;
2087
/**
2088
* Get the number of lines in the model.
2089
*/
2090
getLineCount(): number;
2091
/**
2092
* Get the text for a certain line.
2093
*/
2094
getLineContent(lineNumber: number): string;
2095
/**
2096
* Get the text length for a certain line.
2097
*/
2098
getLineLength(lineNumber: number): number;
2099
/**
2100
* Get the text for all lines.
2101
*/
2102
getLinesContent(): string[];
2103
/**
2104
* Get the end of line sequence predominantly used in the text buffer.
2105
* @return EOL char sequence (e.g.: '\n' or '\r\n').
2106
*/
2107
getEOL(): string;
2108
/**
2109
* Get the end of line sequence predominantly used in the text buffer.
2110
*/
2111
getEndOfLineSequence(): EndOfLineSequence;
2112
/**
2113
* Get the minimum legal column for line at `lineNumber`
2114
*/
2115
getLineMinColumn(lineNumber: number): number;
2116
/**
2117
* Get the maximum legal column for line at `lineNumber`
2118
*/
2119
getLineMaxColumn(lineNumber: number): number;
2120
/**
2121
* Returns the column before the first non whitespace character for line at `lineNumber`.
2122
* Returns 0 if line is empty or contains only whitespace.
2123
*/
2124
getLineFirstNonWhitespaceColumn(lineNumber: number): number;
2125
/**
2126
* Returns the column after the last non whitespace character for line at `lineNumber`.
2127
* Returns 0 if line is empty or contains only whitespace.
2128
*/
2129
getLineLastNonWhitespaceColumn(lineNumber: number): number;
2130
/**
2131
* Create a valid position.
2132
*/
2133
validatePosition(position: IPosition): Position;
2134
/**
2135
* Advances the given position by the given offset (negative offsets are also accepted)
2136
* and returns it as a new valid position.
2137
*
2138
* If the offset and position are such that their combination goes beyond the beginning or
2139
* end of the model, throws an exception.
2140
*
2141
* If the offset is such that the new position would be in the middle of a multi-byte
2142
* line terminator, throws an exception.
2143
*/
2144
modifyPosition(position: IPosition, offset: number): Position;
2145
/**
2146
* Create a valid range.
2147
*/
2148
validateRange(range: IRange): Range;
2149
/**
2150
* Verifies the range is valid.
2151
*/
2152
isValidRange(range: IRange): boolean;
2153
/**
2154
* Converts the position to a zero-based offset.
2155
*
2156
* The position will be [adjusted](#TextDocument.validatePosition).
2157
*
2158
* @param position A position.
2159
* @return A valid zero-based offset.
2160
*/
2161
getOffsetAt(position: IPosition): number;
2162
/**
2163
* Converts a zero-based offset to a position.
2164
*
2165
* @param offset A zero-based offset.
2166
* @return A valid [position](#Position).
2167
*/
2168
getPositionAt(offset: number): Position;
2169
/**
2170
* Get a range covering the entire model.
2171
*/
2172
getFullModelRange(): Range;
2173
/**
2174
* Returns if the model was disposed or not.
2175
*/
2176
isDisposed(): boolean;
2177
/**
2178
* Search the model.
2179
* @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
2180
* @param searchOnlyEditableRange Limit the searching to only search inside the editable range of the model.
2181
* @param isRegex Used to indicate that `searchString` is a regular expression.
2182
* @param matchCase Force the matching to match lower/upper case exactly.
2183
* @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
2184
* @param captureMatches The result will contain the captured groups.
2185
* @param limitResultCount Limit the number of results
2186
* @return The ranges where the matches are. It is empty if not matches have been found.
2187
*/
2188
findMatches(searchString: string, searchOnlyEditableRange: boolean, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount?: number): FindMatch[];
2189
/**
2190
* Search the model.
2191
* @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
2192
* @param searchScope Limit the searching to only search inside these ranges.
2193
* @param isRegex Used to indicate that `searchString` is a regular expression.
2194
* @param matchCase Force the matching to match lower/upper case exactly.
2195
* @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
2196
* @param captureMatches The result will contain the captured groups.
2197
* @param limitResultCount Limit the number of results
2198
* @return The ranges where the matches are. It is empty if no matches have been found.
2199
*/
2200
findMatches(searchString: string, searchScope: IRange | IRange[], isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean, limitResultCount?: number): FindMatch[];
2201
/**
2202
* Search the model for the next match. Loops to the beginning of the model if needed.
2203
* @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
2204
* @param searchStart Start the searching at the specified position.
2205
* @param isRegex Used to indicate that `searchString` is a regular expression.
2206
* @param matchCase Force the matching to match lower/upper case exactly.
2207
* @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
2208
* @param captureMatches The result will contain the captured groups.
2209
* @return The range where the next match is. It is null if no next match has been found.
2210
*/
2211
findNextMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch | null;
2212
/**
2213
* Search the model for the previous match. Loops to the end of the model if needed.
2214
* @param searchString The string used to search. If it is a regular expression, set `isRegex` to true.
2215
* @param searchStart Start the searching at the specified position.
2216
* @param isRegex Used to indicate that `searchString` is a regular expression.
2217
* @param matchCase Force the matching to match lower/upper case exactly.
2218
* @param wordSeparators Force the matching to match entire words only. Pass null otherwise.
2219
* @param captureMatches The result will contain the captured groups.
2220
* @return The range where the previous match is. It is null if no previous match has been found.
2221
*/
2222
findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, captureMatches: boolean): FindMatch | null;
2223
/**
2224
* Get the language associated with this model.
2225
*/
2226
getLanguageId(): string;
2227
/**
2228
* Get the word under or besides `position`.
2229
* @param position The position to look for a word.
2230
* @return The word under or besides `position`. Might be null.
2231
*/
2232
getWordAtPosition(position: IPosition): IWordAtPosition | null;
2233
/**
2234
* Get the word under or besides `position` trimmed to `position`.column
2235
* @param position The position to look for a word.
2236
* @return The word under or besides `position`. Will never be null.
2237
*/
2238
getWordUntilPosition(position: IPosition): IWordAtPosition;
2239
/**
2240
* Perform a minimum amount of operations, in order to transform the decorations
2241
* identified by `oldDecorations` to the decorations described by `newDecorations`
2242
* and returns the new identifiers associated with the resulting decorations.
2243
*
2244
* @param oldDecorations Array containing previous decorations identifiers.
2245
* @param newDecorations Array describing what decorations should result after the call.
2246
* @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.
2247
* @return An array containing the new decorations identifiers.
2248
*/
2249
deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[], ownerId?: number): string[];
2250
/**
2251
* Get the options associated with a decoration.
2252
* @param id The decoration id.
2253
* @return The decoration options or null if the decoration was not found.
2254
*/
2255
getDecorationOptions(id: string): IModelDecorationOptions | null;
2256
/**
2257
* Get the range associated with a decoration.
2258
* @param id The decoration id.
2259
* @return The decoration range or null if the decoration was not found.
2260
*/
2261
getDecorationRange(id: string): Range | null;
2262
/**
2263
* Gets all the decorations for the line `lineNumber` as an array.
2264
* @param lineNumber The line number
2265
* @param ownerId If set, it will ignore decorations belonging to other owners.
2266
* @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
2267
* @param filterFontDecorations If set, it will ignore font decorations.
2268
* @return An array with the decorations
2269
*/
2270
getLineDecorations(lineNumber: number, ownerId?: number, filterOutValidation?: boolean, filterFontDecorations?: boolean): IModelDecoration[];
2271
/**
2272
* Gets all the decorations for the lines between `startLineNumber` and `endLineNumber` as an array.
2273
* @param startLineNumber The start line number
2274
* @param endLineNumber The end line number
2275
* @param ownerId If set, it will ignore decorations belonging to other owners.
2276
* @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
2277
* @param filterFontDecorations If set, it will ignore font decorations.
2278
* @return An array with the decorations
2279
*/
2280
getLinesDecorations(startLineNumber: number, endLineNumber: number, ownerId?: number, filterOutValidation?: boolean, filterFontDecorations?: boolean): IModelDecoration[];
2281
/**
2282
* Gets all the decorations in a range as an array. Only `startLineNumber` and `endLineNumber` from `range` are used for filtering.
2283
* So for now it returns all the decorations on the same line as `range`.
2284
* @param range The range to search in
2285
* @param ownerId If set, it will ignore decorations belonging to other owners.
2286
* @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
2287
* @param filterFontDecorations If set, it will ignore font decorations.
2288
* @param onlyMinimapDecorations If set, it will return only decorations that render in the minimap.
2289
* @param onlyMarginDecorations If set, it will return only decorations that render in the glyph margin.
2290
* @return An array with the decorations
2291
*/
2292
getDecorationsInRange(range: IRange, ownerId?: number, filterOutValidation?: boolean, filterFontDecorations?: boolean, onlyMinimapDecorations?: boolean, onlyMarginDecorations?: boolean): IModelDecoration[];
2293
/**
2294
* Gets all the decorations as an array.
2295
* @param ownerId If set, it will ignore decorations belonging to other owners.
2296
* @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
2297
* @param filterFontDecorations If set, it will ignore font decorations.
2298
*/
2299
getAllDecorations(ownerId?: number, filterOutValidation?: boolean, filterFontDecorations?: boolean): IModelDecoration[];
2300
/**
2301
* Gets all decorations that render in the glyph margin as an array.
2302
* @param ownerId If set, it will ignore decorations belonging to other owners.
2303
*/
2304
getAllMarginDecorations(ownerId?: number): IModelDecoration[];
2305
/**
2306
* Gets all the decorations that should be rendered in the overview ruler as an array.
2307
* @param ownerId If set, it will ignore decorations belonging to other owners.
2308
* @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
2309
* @param filterFontDecorations If set, it will ignore font decorations.
2310
*/
2311
getOverviewRulerDecorations(ownerId?: number, filterOutValidation?: boolean, filterFontDecorations?: boolean): IModelDecoration[];
2312
/**
2313
* Gets all the decorations that contain injected text.
2314
* @param ownerId If set, it will ignore decorations belonging to other owners.
2315
*/
2316
getInjectedTextDecorations(ownerId?: number): IModelDecoration[];
2317
/**
2318
* Gets all the decorations that contain custom line heights.
2319
* @param ownerId If set, it will ignore decorations belonging to other owners.
2320
*/
2321
getCustomLineHeightsDecorations(ownerId?: number): IModelDecoration[];
2322
/**
2323
* Normalize a string containing whitespace according to indentation rules (converts to spaces or to tabs).
2324
*/
2325
normalizeIndentation(str: string): string;
2326
/**
2327
* Change the options of this model.
2328
*/
2329
updateOptions(newOpts: ITextModelUpdateOptions): void;
2330
/**
2331
* Detect the indentation options for this model from its content.
2332
*/
2333
detectIndentation(defaultInsertSpaces: boolean, defaultTabSize: number): void;
2334
/**
2335
* Close the current undo-redo element.
2336
* This offers a way to create an undo/redo stop point.
2337
*/
2338
pushStackElement(): void;
2339
/**
2340
* Open the current undo-redo element.
2341
* This offers a way to remove the current undo/redo stop point.
2342
*/
2343
popStackElement(): void;
2344
/**
2345
* Push edit operations, basically editing the model. This is the preferred way
2346
* of editing the model. The edit operations will land on the undo stack.
2347
* @param beforeCursorState The cursor state before the edit operations. This cursor state will be returned when `undo` or `redo` are invoked.
2348
* @param editOperations The edit operations.
2349
* @param cursorStateComputer A callback that can compute the resulting cursors state after the edit operations have been executed.
2350
* @return The cursor state returned by the `cursorStateComputer`.
2351
*/
2352
pushEditOperations(beforeCursorState: Selection[] | null, editOperations: IIdentifiedSingleEditOperation[], cursorStateComputer: ICursorStateComputer): Selection[] | null;
2353
/**
2354
* Change the end of line sequence. This is the preferred way of
2355
* changing the eol sequence. This will land on the undo stack.
2356
*/
2357
pushEOL(eol: EndOfLineSequence): void;
2358
/**
2359
* Edit the model without adding the edits to the undo stack.
2360
* This can have dire consequences on the undo stack! See @pushEditOperations for the preferred way.
2361
* @param operations The edit operations.
2362
* @return If desired, the inverse edit operations, that, when applied, will bring the model back to the previous state.
2363
*/
2364
applyEdits(operations: readonly IIdentifiedSingleEditOperation[]): void;
2365
applyEdits(operations: readonly IIdentifiedSingleEditOperation[], computeUndoEdits: false): void;
2366
applyEdits(operations: readonly IIdentifiedSingleEditOperation[], computeUndoEdits: true): IValidEditOperation[];
2367
/**
2368
* Change the end of line sequence without recording in the undo stack.
2369
* This can have dire consequences on the undo stack! See @pushEOL for the preferred way.
2370
*/
2371
setEOL(eol: EndOfLineSequence): void;
2372
/**
2373
* Undo edit operations until the previous undo/redo point.
2374
* The inverse edit operations will be pushed on the redo stack.
2375
*/
2376
undo(): void | Promise<void>;
2377
/**
2378
* Is there anything in the undo stack?
2379
*/
2380
canUndo(): boolean;
2381
/**
2382
* Redo edit operations until the next undo/redo point.
2383
* The inverse edit operations will be pushed on the undo stack.
2384
*/
2385
redo(): void | Promise<void>;
2386
/**
2387
* Is there anything in the redo stack?
2388
*/
2389
canRedo(): boolean;
2390
/**
2391
* An event emitted when the contents of the model have changed.
2392
* @event
2393
*/
2394
onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable;
2395
/**
2396
* An event emitted when decorations of the model have changed.
2397
* @event
2398
*/
2399
readonly onDidChangeDecorations: IEvent<IModelDecorationsChangedEvent>;
2400
/**
2401
* An event emitted when the model options have changed.
2402
* @event
2403
*/
2404
readonly onDidChangeOptions: IEvent<IModelOptionsChangedEvent>;
2405
/**
2406
* An event emitted when the language associated with the model has changed.
2407
* @event
2408
*/
2409
readonly onDidChangeLanguage: IEvent<IModelLanguageChangedEvent>;
2410
/**
2411
* An event emitted when the language configuration associated with the model has changed.
2412
* @event
2413
*/
2414
readonly onDidChangeLanguageConfiguration: IEvent<IModelLanguageConfigurationChangedEvent>;
2415
/**
2416
* An event emitted when the model has been attached to the first editor or detached from the last editor.
2417
* @event
2418
*/
2419
readonly onDidChangeAttached: IEvent<void>;
2420
/**
2421
* An event emitted right before disposing the model.
2422
* @event
2423
*/
2424
readonly onWillDispose: IEvent<void>;
2425
/**
2426
* Destroy this model.
2427
*/
2428
dispose(): void;
2429
/**
2430
* Returns if this model is attached to an editor or not.
2431
*/
2432
isAttachedToEditor(): boolean;
2433
}
2434
2435
export enum PositionAffinity {
2436
/**
2437
* Prefers the left most position.
2438
*/
2439
Left = 0,
2440
/**
2441
* Prefers the right most position.
2442
*/
2443
Right = 1,
2444
/**
2445
* No preference.
2446
*/
2447
None = 2,
2448
/**
2449
* If the given position is on injected text, prefers the position left of it.
2450
*/
2451
LeftOfInjectedText = 3,
2452
/**
2453
* If the given position is on injected text, prefers the position right of it.
2454
*/
2455
RightOfInjectedText = 4
2456
}
2457
2458
/**
2459
* A change
2460
*/
2461
export interface IChange {
2462
readonly originalStartLineNumber: number;
2463
readonly originalEndLineNumber: number;
2464
readonly modifiedStartLineNumber: number;
2465
readonly modifiedEndLineNumber: number;
2466
}
2467
2468
/**
2469
* A character level change.
2470
*/
2471
export interface ICharChange extends IChange {
2472
readonly originalStartColumn: number;
2473
readonly originalEndColumn: number;
2474
readonly modifiedStartColumn: number;
2475
readonly modifiedEndColumn: number;
2476
}
2477
2478
/**
2479
* A line change
2480
*/
2481
export interface ILineChange extends IChange {
2482
readonly charChanges: ICharChange[] | undefined;
2483
}
2484
export interface IDimension {
2485
width: number;
2486
height: number;
2487
}
2488
2489
/**
2490
* A builder and helper for edit operations for a command.
2491
*/
2492
export interface IEditOperationBuilder {
2493
/**
2494
* Add a new edit operation (a replace operation).
2495
* @param range The range to replace (delete). May be empty to represent a simple insert.
2496
* @param text The text to replace with. May be null to represent a simple delete.
2497
*/
2498
addEditOperation(range: IRange, text: string | null, forceMoveMarkers?: boolean): void;
2499
/**
2500
* Add a new edit operation (a replace operation).
2501
* The inverse edits will be accessible in `ICursorStateComputerData.getInverseEditOperations()`
2502
* @param range The range to replace (delete). May be empty to represent a simple insert.
2503
* @param text The text to replace with. May be null to represent a simple delete.
2504
*/
2505
addTrackedEditOperation(range: IRange, text: string | null, forceMoveMarkers?: boolean): void;
2506
/**
2507
* Track `selection` when applying edit operations.
2508
* A best effort will be made to not grow/expand the selection.
2509
* An empty selection will clamp to a nearby character.
2510
* @param selection The selection to track.
2511
* @param trackPreviousOnEmpty If set, and the selection is empty, indicates whether the selection
2512
* should clamp to the previous or the next character.
2513
* @return A unique identifier.
2514
*/
2515
trackSelection(selection: Selection, trackPreviousOnEmpty?: boolean): string;
2516
}
2517
2518
/**
2519
* A helper for computing cursor state after a command.
2520
*/
2521
export interface ICursorStateComputerData {
2522
/**
2523
* Get the inverse edit operations of the added edit operations.
2524
*/
2525
getInverseEditOperations(): IValidEditOperation[];
2526
/**
2527
* Get a previously tracked selection.
2528
* @param id The unique identifier returned by `trackSelection`.
2529
* @return The selection.
2530
*/
2531
getTrackedSelection(id: string): Selection;
2532
}
2533
2534
/**
2535
* A command that modifies text / cursor state on a model.
2536
*/
2537
export interface ICommand {
2538
/**
2539
* Get the edit operations needed to execute this command.
2540
* @param model The model the command will execute on.
2541
* @param builder A helper to collect the needed edit operations and to track selections.
2542
*/
2543
getEditOperations(model: ITextModel, builder: IEditOperationBuilder): void;
2544
/**
2545
* Compute the cursor state after the edit operations were applied.
2546
* @param model The model the command has executed on.
2547
* @param helper A helper to get inverse edit operations and to get previously tracked selections.
2548
* @return The cursor state after the command executed.
2549
*/
2550
computeCursorState(model: ITextModel, helper: ICursorStateComputerData): Selection;
2551
}
2552
2553
/**
2554
* A model for the diff editor.
2555
*/
2556
export interface IDiffEditorModel {
2557
/**
2558
* Original model.
2559
*/
2560
original: ITextModel;
2561
/**
2562
* Modified model.
2563
*/
2564
modified: ITextModel;
2565
}
2566
2567
export interface IDiffEditorViewModel extends IDisposable {
2568
readonly model: IDiffEditorModel;
2569
waitForDiff(): Promise<void>;
2570
}
2571
2572
/**
2573
* An event describing that an editor has had its model reset (i.e. `editor.setModel()`).
2574
*/
2575
export interface IModelChangedEvent {
2576
/**
2577
* The `uri` of the previous model or null.
2578
*/
2579
readonly oldModelUrl: Uri | null;
2580
/**
2581
* The `uri` of the new model or null.
2582
*/
2583
readonly newModelUrl: Uri | null;
2584
}
2585
2586
export interface IContentSizeChangedEvent {
2587
readonly contentWidth: number;
2588
readonly contentHeight: number;
2589
readonly contentWidthChanged: boolean;
2590
readonly contentHeightChanged: boolean;
2591
}
2592
2593
export interface INewScrollPosition {
2594
scrollLeft?: number;
2595
scrollTop?: number;
2596
}
2597
2598
export interface IEditorAction {
2599
readonly id: string;
2600
readonly label: string;
2601
readonly alias: string;
2602
readonly metadata: ICommandMetadata | undefined;
2603
isSupported(): boolean;
2604
run(args?: unknown): Promise<void>;
2605
}
2606
2607
export type IEditorModel = ITextModel | IDiffEditorModel | IDiffEditorViewModel;
2608
2609
/**
2610
* A (serializable) state of the cursors.
2611
*/
2612
export interface ICursorState {
2613
inSelectionMode: boolean;
2614
selectionStart: IPosition;
2615
position: IPosition;
2616
}
2617
2618
/**
2619
* A (serializable) state of the view.
2620
*/
2621
export interface IViewState {
2622
/** written by previous versions */
2623
scrollTop?: number;
2624
/** written by previous versions */
2625
scrollTopWithoutViewZones?: number;
2626
scrollLeft: number;
2627
firstPosition: IPosition;
2628
firstPositionDeltaTop: number;
2629
}
2630
2631
/**
2632
* A (serializable) state of the code editor.
2633
*/
2634
export interface ICodeEditorViewState {
2635
cursorState: ICursorState[];
2636
viewState: IViewState;
2637
contributionsState: {
2638
[id: string]: any;
2639
};
2640
}
2641
2642
/**
2643
* (Serializable) View state for the diff editor.
2644
*/
2645
export interface IDiffEditorViewState {
2646
original: ICodeEditorViewState | null;
2647
modified: ICodeEditorViewState | null;
2648
modelState?: unknown;
2649
}
2650
2651
/**
2652
* An editor view state.
2653
*/
2654
export type IEditorViewState = ICodeEditorViewState | IDiffEditorViewState;
2655
2656
export enum ScrollType {
2657
Smooth = 0,
2658
Immediate = 1
2659
}
2660
2661
/**
2662
* An editor.
2663
*/
2664
export interface IEditor {
2665
/**
2666
* An event emitted when the editor has been disposed.
2667
* @event
2668
*/
2669
onDidDispose(listener: () => void): IDisposable;
2670
/**
2671
* Dispose the editor.
2672
*/
2673
dispose(): void;
2674
/**
2675
* Get a unique id for this editor instance.
2676
*/
2677
getId(): string;
2678
/**
2679
* Get the editor type. Please see `EditorType`.
2680
* This is to avoid an instanceof check
2681
*/
2682
getEditorType(): string;
2683
/**
2684
* Update the editor's options after the editor has been created.
2685
*/
2686
updateOptions(newOptions: IEditorOptions): void;
2687
/**
2688
* Instructs the editor to remeasure its container. This method should
2689
* be called when the container of the editor gets resized.
2690
*
2691
* If a dimension is passed in, the passed in value will be used.
2692
*
2693
* By default, this will also render the editor immediately.
2694
* If you prefer to delay rendering to the next animation frame, use postponeRendering == true.
2695
*/
2696
layout(dimension?: IDimension, postponeRendering?: boolean): void;
2697
/**
2698
* Brings browser focus to the editor text
2699
*/
2700
focus(): void;
2701
/**
2702
* Returns true if the text inside this editor is focused (i.e. cursor is blinking).
2703
*/
2704
hasTextFocus(): boolean;
2705
/**
2706
* Returns all actions associated with this editor.
2707
*/
2708
getSupportedActions(): IEditorAction[];
2709
/**
2710
* Saves current view state of the editor in a serializable object.
2711
*/
2712
saveViewState(): IEditorViewState | null;
2713
/**
2714
* Restores the view state of the editor from a serializable object generated by `saveViewState`.
2715
*/
2716
restoreViewState(state: IEditorViewState | null): void;
2717
/**
2718
* Given a position, returns a column number that takes tab-widths into account.
2719
*/
2720
getVisibleColumnFromPosition(position: IPosition): number;
2721
/**
2722
* Returns the primary position of the cursor.
2723
*/
2724
getPosition(): Position | null;
2725
/**
2726
* Set the primary position of the cursor. This will remove any secondary cursors.
2727
* @param position New primary cursor's position
2728
* @param source Source of the call that caused the position
2729
*/
2730
setPosition(position: IPosition, source?: string): void;
2731
/**
2732
* Scroll vertically as necessary and reveal a line.
2733
*/
2734
revealLine(lineNumber: number, scrollType?: ScrollType): void;
2735
/**
2736
* Scroll vertically as necessary and reveal a line centered vertically.
2737
*/
2738
revealLineInCenter(lineNumber: number, scrollType?: ScrollType): void;
2739
/**
2740
* Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport.
2741
*/
2742
revealLineInCenterIfOutsideViewport(lineNumber: number, scrollType?: ScrollType): void;
2743
/**
2744
* Scroll vertically as necessary and reveal a line close to the top of the viewport,
2745
* optimized for viewing a code definition.
2746
*/
2747
revealLineNearTop(lineNumber: number, scrollType?: ScrollType): void;
2748
/**
2749
* Scroll vertically or horizontally as necessary and reveal a position.
2750
*/
2751
revealPosition(position: IPosition, scrollType?: ScrollType): void;
2752
/**
2753
* Scroll vertically or horizontally as necessary and reveal a position centered vertically.
2754
*/
2755
revealPositionInCenter(position: IPosition, scrollType?: ScrollType): void;
2756
/**
2757
* Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport.
2758
*/
2759
revealPositionInCenterIfOutsideViewport(position: IPosition, scrollType?: ScrollType): void;
2760
/**
2761
* Scroll vertically or horizontally as necessary and reveal a position close to the top of the viewport,
2762
* optimized for viewing a code definition.
2763
*/
2764
revealPositionNearTop(position: IPosition, scrollType?: ScrollType): void;
2765
/**
2766
* Returns the primary selection of the editor.
2767
*/
2768
getSelection(): Selection | null;
2769
/**
2770
* Returns all the selections of the editor.
2771
*/
2772
getSelections(): Selection[] | null;
2773
/**
2774
* Set the primary selection of the editor. This will remove any secondary cursors.
2775
* @param selection The new selection
2776
* @param source Source of the call that caused the selection
2777
*/
2778
setSelection(selection: IRange, source?: string): void;
2779
/**
2780
* Set the primary selection of the editor. This will remove any secondary cursors.
2781
* @param selection The new selection
2782
* @param source Source of the call that caused the selection
2783
*/
2784
setSelection(selection: Range, source?: string): void;
2785
/**
2786
* Set the primary selection of the editor. This will remove any secondary cursors.
2787
* @param selection The new selection
2788
* @param source Source of the call that caused the selection
2789
*/
2790
setSelection(selection: ISelection, source?: string): void;
2791
/**
2792
* Set the primary selection of the editor. This will remove any secondary cursors.
2793
* @param selection The new selection
2794
* @param source Source of the call that caused the selection
2795
*/
2796
setSelection(selection: Selection, source?: string): void;
2797
/**
2798
* Set the selections for all the cursors of the editor.
2799
* Cursors will be removed or added, as necessary.
2800
* @param selections The new selection
2801
* @param source Source of the call that caused the selection
2802
*/
2803
setSelections(selections: readonly ISelection[], source?: string): void;
2804
/**
2805
* Scroll vertically as necessary and reveal lines.
2806
*/
2807
revealLines(startLineNumber: number, endLineNumber: number, scrollType?: ScrollType): void;
2808
/**
2809
* Scroll vertically as necessary and reveal lines centered vertically.
2810
*/
2811
revealLinesInCenter(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void;
2812
/**
2813
* Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport.
2814
*/
2815
revealLinesInCenterIfOutsideViewport(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void;
2816
/**
2817
* Scroll vertically as necessary and reveal lines close to the top of the viewport,
2818
* optimized for viewing a code definition.
2819
*/
2820
revealLinesNearTop(lineNumber: number, endLineNumber: number, scrollType?: ScrollType): void;
2821
/**
2822
* Scroll vertically or horizontally as necessary and reveal a range.
2823
*/
2824
revealRange(range: IRange, scrollType?: ScrollType): void;
2825
/**
2826
* Scroll vertically or horizontally as necessary and reveal a range centered vertically.
2827
*/
2828
revealRangeInCenter(range: IRange, scrollType?: ScrollType): void;
2829
/**
2830
* Scroll vertically or horizontally as necessary and reveal a range at the top of the viewport.
2831
*/
2832
revealRangeAtTop(range: IRange, scrollType?: ScrollType): void;
2833
/**
2834
* Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.
2835
*/
2836
revealRangeInCenterIfOutsideViewport(range: IRange, scrollType?: ScrollType): void;
2837
/**
2838
* Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport,
2839
* optimized for viewing a code definition.
2840
*/
2841
revealRangeNearTop(range: IRange, scrollType?: ScrollType): void;
2842
/**
2843
* Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport,
2844
* optimized for viewing a code definition. Only if it lies outside the viewport.
2845
*/
2846
revealRangeNearTopIfOutsideViewport(range: IRange, scrollType?: ScrollType): void;
2847
/**
2848
* Directly trigger a handler or an editor action.
2849
* @param source The source of the call.
2850
* @param handlerId The id of the handler or the id of a contribution.
2851
* @param payload Extra data to be sent to the handler.
2852
*/
2853
trigger(source: string | null | undefined, handlerId: string, payload: any): void;
2854
/**
2855
* Gets the current model attached to this editor.
2856
*/
2857
getModel(): IEditorModel | null;
2858
/**
2859
* Sets the current model attached to this editor.
2860
* If the previous model was created by the editor via the value key in the options
2861
* literal object, it will be destroyed. Otherwise, if the previous model was set
2862
* via setModel, or the model key in the options literal object, the previous model
2863
* will not be destroyed.
2864
* It is safe to call setModel(null) to simply detach the current model from the editor.
2865
*/
2866
setModel(model: IEditorModel | null): void;
2867
/**
2868
* Create a collection of decorations. All decorations added through this collection
2869
* will get the ownerId of the editor (meaning they will not show up in other editors).
2870
* These decorations will be automatically cleared when the editor's model changes.
2871
*/
2872
createDecorationsCollection(decorations?: IModelDeltaDecoration[]): IEditorDecorationsCollection;
2873
}
2874
2875
/**
2876
* A collection of decorations
2877
*/
2878
export interface IEditorDecorationsCollection {
2879
/**
2880
* An event emitted when decorations change in the editor,
2881
* but the change is not caused by us setting or clearing the collection.
2882
*/
2883
onDidChange: IEvent<IModelDecorationsChangedEvent>;
2884
/**
2885
* Get the decorations count.
2886
*/
2887
length: number;
2888
/**
2889
* Get the range for a decoration.
2890
*/
2891
getRange(index: number): Range | null;
2892
/**
2893
* Get all ranges for decorations.
2894
*/
2895
getRanges(): Range[];
2896
/**
2897
* Determine if a decoration is in this collection.
2898
*/
2899
has(decoration: IModelDecoration): boolean;
2900
/**
2901
* Replace all previous decorations with `newDecorations`.
2902
*/
2903
set(newDecorations: readonly IModelDeltaDecoration[]): string[];
2904
/**
2905
* Append `newDecorations` to this collection.
2906
*/
2907
append(newDecorations: readonly IModelDeltaDecoration[]): string[];
2908
/**
2909
* Remove all previous decorations.
2910
*/
2911
clear(): void;
2912
}
2913
2914
/**
2915
* An editor contribution that gets created every time a new editor gets created and gets disposed when the editor gets disposed.
2916
*/
2917
export interface IEditorContribution {
2918
/**
2919
* Dispose this contribution.
2920
*/
2921
dispose(): void;
2922
/**
2923
* Store view state.
2924
*/
2925
saveViewState?(): any;
2926
/**
2927
* Restore view state.
2928
*/
2929
restoreViewState?(state: any): void;
2930
}
2931
2932
/**
2933
* The type of the `IEditor`.
2934
*/
2935
export const EditorType: {
2936
ICodeEditor: string;
2937
IDiffEditor: string;
2938
};
2939
2940
/**
2941
* An event describing that the current language associated with a model has changed.
2942
*/
2943
export interface IModelLanguageChangedEvent {
2944
/**
2945
* Previous language
2946
*/
2947
readonly oldLanguage: string;
2948
/**
2949
* New language
2950
*/
2951
readonly newLanguage: string;
2952
/**
2953
* Source of the call that caused the event.
2954
*/
2955
readonly source: string;
2956
}
2957
2958
/**
2959
* An event describing that the language configuration associated with a model has changed.
2960
*/
2961
export interface IModelLanguageConfigurationChangedEvent {
2962
}
2963
2964
/**
2965
* An event describing a change in the text of a model.
2966
*/
2967
export interface IModelContentChangedEvent {
2968
/**
2969
* The changes are ordered from the end of the document to the beginning, so they should be safe to apply in sequence.
2970
*/
2971
readonly changes: IModelContentChange[];
2972
/**
2973
* The (new) end-of-line character.
2974
*/
2975
readonly eol: string;
2976
/**
2977
* The new version id the model has transitioned to.
2978
*/
2979
readonly versionId: number;
2980
/**
2981
* Flag that indicates that this event was generated while undoing.
2982
*/
2983
readonly isUndoing: boolean;
2984
/**
2985
* Flag that indicates that this event was generated while redoing.
2986
*/
2987
readonly isRedoing: boolean;
2988
/**
2989
* Flag that indicates that all decorations were lost with this edit.
2990
* The model has been reset to a new value.
2991
*/
2992
readonly isFlush: boolean;
2993
/**
2994
* Flag that indicates that this event describes an eol change.
2995
*/
2996
readonly isEolChange: boolean;
2997
/**
2998
* The sum of these lengths equals changes.length.
2999
* The length of this array must equal the length of detailedReasons.
3000
*/
3001
readonly detailedReasonsChangeLengths: number[];
3002
}
3003
3004
export interface ISerializedModelContentChangedEvent {
3005
/**
3006
* The changes are ordered from the end of the document to the beginning, so they should be safe to apply in sequence.
3007
*/
3008
readonly changes: IModelContentChange[];
3009
/**
3010
* The (new) end-of-line character.
3011
*/
3012
readonly eol: string;
3013
/**
3014
* The new version id the model has transitioned to.
3015
*/
3016
readonly versionId: number;
3017
/**
3018
* Flag that indicates that this event was generated while undoing.
3019
*/
3020
readonly isUndoing: boolean;
3021
/**
3022
* Flag that indicates that this event was generated while redoing.
3023
*/
3024
readonly isRedoing: boolean;
3025
/**
3026
* Flag that indicates that all decorations were lost with this edit.
3027
* The model has been reset to a new value.
3028
*/
3029
readonly isFlush: boolean;
3030
/**
3031
* Flag that indicates that this event describes an eol change.
3032
*/
3033
readonly isEolChange: boolean;
3034
}
3035
3036
/**
3037
* An event describing that model decorations have changed.
3038
*/
3039
export interface IModelDecorationsChangedEvent {
3040
readonly affectsMinimap: boolean;
3041
readonly affectsOverviewRuler: boolean;
3042
readonly affectsGlyphMargin: boolean;
3043
readonly affectsLineNumber: boolean;
3044
}
3045
3046
export interface IModelOptionsChangedEvent {
3047
readonly tabSize: boolean;
3048
readonly indentSize: boolean;
3049
readonly insertSpaces: boolean;
3050
readonly trimAutoWhitespace: boolean;
3051
}
3052
3053
export interface IModelContentChange {
3054
/**
3055
* The old range that got replaced.
3056
*/
3057
readonly range: IRange;
3058
/**
3059
* The offset of the range that got replaced.
3060
*/
3061
readonly rangeOffset: number;
3062
/**
3063
* The length of the range that got replaced.
3064
*/
3065
readonly rangeLength: number;
3066
/**
3067
* The new text for the range.
3068
*/
3069
readonly text: string;
3070
}
3071
3072
/**
3073
* Describes the reason the cursor has changed its position.
3074
*/
3075
export enum CursorChangeReason {
3076
/**
3077
* Unknown or not set.
3078
*/
3079
NotSet = 0,
3080
/**
3081
* A `model.setValue()` was called.
3082
*/
3083
ContentFlush = 1,
3084
/**
3085
* The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers.
3086
*/
3087
RecoverFromMarkers = 2,
3088
/**
3089
* There was an explicit user gesture.
3090
*/
3091
Explicit = 3,
3092
/**
3093
* There was a Paste.
3094
*/
3095
Paste = 4,
3096
/**
3097
* There was an Undo.
3098
*/
3099
Undo = 5,
3100
/**
3101
* There was a Redo.
3102
*/
3103
Redo = 6
3104
}
3105
3106
/**
3107
* An event describing that the cursor position has changed.
3108
*/
3109
export interface ICursorPositionChangedEvent {
3110
/**
3111
* Primary cursor's position.
3112
*/
3113
readonly position: Position;
3114
/**
3115
* Secondary cursors' position.
3116
*/
3117
readonly secondaryPositions: Position[];
3118
/**
3119
* Reason.
3120
*/
3121
readonly reason: CursorChangeReason;
3122
/**
3123
* Source of the call that caused the event.
3124
*/
3125
readonly source: string;
3126
}
3127
3128
/**
3129
* An event describing that the cursor selection has changed.
3130
*/
3131
export interface ICursorSelectionChangedEvent {
3132
/**
3133
* The primary selection.
3134
*/
3135
readonly selection: Selection;
3136
/**
3137
* The secondary selections.
3138
*/
3139
readonly secondarySelections: Selection[];
3140
/**
3141
* The model version id.
3142
*/
3143
readonly modelVersionId: number;
3144
/**
3145
* The old selections.
3146
*/
3147
readonly oldSelections: Selection[] | null;
3148
/**
3149
* The model version id the that `oldSelections` refer to.
3150
*/
3151
readonly oldModelVersionId: number;
3152
/**
3153
* Source of the call that caused the event.
3154
*/
3155
readonly source: string;
3156
/**
3157
* Reason.
3158
*/
3159
readonly reason: CursorChangeReason;
3160
}
3161
3162
export enum AccessibilitySupport {
3163
/**
3164
* This should be the browser case where it is not known if a screen reader is attached or no.
3165
*/
3166
Unknown = 0,
3167
Disabled = 1,
3168
Enabled = 2
3169
}
3170
3171
/**
3172
* Configuration options for auto closing quotes and brackets
3173
*/
3174
export type EditorAutoClosingStrategy = 'always' | 'languageDefined' | 'beforeWhitespace' | 'never';
3175
3176
/**
3177
* Configuration options for auto wrapping quotes and brackets
3178
*/
3179
export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never';
3180
3181
/**
3182
* Configuration options for typing over closing quotes or brackets
3183
*/
3184
export type EditorAutoClosingEditStrategy = 'always' | 'auto' | 'never';
3185
3186
/**
3187
* Configuration options for auto indentation in the editor
3188
*/
3189
export enum EditorAutoIndentStrategy {
3190
None = 0,
3191
Keep = 1,
3192
Brackets = 2,
3193
Advanced = 3,
3194
Full = 4
3195
}
3196
3197
/**
3198
* Configuration options for the editor.
3199
*/
3200
export interface IEditorOptions {
3201
/**
3202
* This editor is used inside a diff editor.
3203
*/
3204
inDiffEditor?: boolean;
3205
/**
3206
* This editor is allowed to use variable line heights.
3207
*/
3208
allowVariableLineHeights?: boolean;
3209
/**
3210
* This editor is allowed to use variable font-sizes and font-families
3211
*/
3212
allowVariableFonts?: boolean;
3213
/**
3214
* This editor is allowed to use variable font-sizes and font-families in accessibility mode
3215
*/
3216
allowVariableFontsInAccessibilityMode?: boolean;
3217
/**
3218
* The aria label for the editor's textarea (when it is focused).
3219
*/
3220
ariaLabel?: string;
3221
/**
3222
* Whether the aria-required attribute should be set on the editors textarea.
3223
*/
3224
ariaRequired?: boolean;
3225
/**
3226
* Control whether a screen reader announces inline suggestion content immediately.
3227
*/
3228
screenReaderAnnounceInlineSuggestion?: boolean;
3229
/**
3230
* The `tabindex` property of the editor's textarea
3231
*/
3232
tabIndex?: number;
3233
/**
3234
* Render vertical lines at the specified columns.
3235
* Defaults to empty array.
3236
*/
3237
rulers?: (number | IRulerOption)[];
3238
/**
3239
* Locales used for segmenting lines into words when doing word related navigations or operations.
3240
*
3241
* Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.).
3242
* Defaults to empty array
3243
*/
3244
wordSegmenterLocales?: string | string[];
3245
/**
3246
* A string containing the word separators used when doing word navigation.
3247
* Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?
3248
*/
3249
wordSeparators?: string;
3250
/**
3251
* Enable Linux primary clipboard.
3252
* Defaults to true.
3253
*/
3254
selectionClipboard?: boolean;
3255
/**
3256
* Control the rendering of line numbers.
3257
* If it is a function, it will be invoked when rendering a line number and the return value will be rendered.
3258
* Otherwise, if it is a truthy, line numbers will be rendered normally (equivalent of using an identity function).
3259
* Otherwise, line numbers will not be rendered.
3260
* Defaults to `on`.
3261
*/
3262
lineNumbers?: LineNumbersType;
3263
/**
3264
* Controls the minimal number of visible leading and trailing lines surrounding the cursor.
3265
* Defaults to 0.
3266
*/
3267
cursorSurroundingLines?: number;
3268
/**
3269
* Controls when `cursorSurroundingLines` should be enforced
3270
* Defaults to `default`, `cursorSurroundingLines` is not enforced when cursor position is changed
3271
* by mouse.
3272
*/
3273
cursorSurroundingLinesStyle?: 'default' | 'all';
3274
/**
3275
* Render last line number when the file ends with a newline.
3276
* Defaults to 'on' for Windows and macOS and 'dimmed' for Linux.
3277
*/
3278
renderFinalNewline?: 'on' | 'off' | 'dimmed';
3279
/**
3280
* Remove unusual line terminators like LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS).
3281
* Defaults to 'prompt'.
3282
*/
3283
unusualLineTerminators?: 'auto' | 'off' | 'prompt';
3284
/**
3285
* Should the corresponding line be selected when clicking on the line number?
3286
* Defaults to true.
3287
*/
3288
selectOnLineNumbers?: boolean;
3289
/**
3290
* Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits.
3291
* Defaults to 5.
3292
*/
3293
lineNumbersMinChars?: number;
3294
/**
3295
* Enable the rendering of the glyph margin.
3296
* Defaults to true in vscode and to false in monaco-editor.
3297
*/
3298
glyphMargin?: boolean;
3299
/**
3300
* The width reserved for line decorations (in px).
3301
* Line decorations are placed between line numbers and the editor content.
3302
* You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch.
3303
* Defaults to 10.
3304
*/
3305
lineDecorationsWidth?: number | string;
3306
/**
3307
* When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle.
3308
* This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport.
3309
* Defaults to 30 (px).
3310
*/
3311
revealHorizontalRightPadding?: number;
3312
/**
3313
* Render the editor selection with rounded borders.
3314
* Defaults to true.
3315
*/
3316
roundedSelection?: boolean;
3317
/**
3318
* Class name to be added to the editor.
3319
*/
3320
extraEditorClassName?: string;
3321
/**
3322
* Should the editor be read only. See also `domReadOnly`.
3323
* Defaults to false.
3324
*/
3325
readOnly?: boolean;
3326
/**
3327
* The message to display when the editor is readonly.
3328
*/
3329
readOnlyMessage?: IMarkdownString;
3330
/**
3331
* Should the textarea used for input use the DOM `readonly` attribute.
3332
* Defaults to false.
3333
*/
3334
domReadOnly?: boolean;
3335
/**
3336
* Enable linked editing.
3337
* Defaults to false.
3338
*/
3339
linkedEditing?: boolean;
3340
/**
3341
* deprecated, use linkedEditing instead
3342
*/
3343
renameOnType?: boolean;
3344
/**
3345
* Should the editor render validation decorations.
3346
* Defaults to editable.
3347
*/
3348
renderValidationDecorations?: 'editable' | 'on' | 'off';
3349
/**
3350
* Control the behavior and rendering of the scrollbars.
3351
*/
3352
scrollbar?: IEditorScrollbarOptions;
3353
/**
3354
* Control the behavior of sticky scroll options
3355
*/
3356
stickyScroll?: IEditorStickyScrollOptions;
3357
/**
3358
* Control the behavior and rendering of the minimap.
3359
*/
3360
minimap?: IEditorMinimapOptions;
3361
/**
3362
* Control the behavior of the find widget.
3363
*/
3364
find?: IEditorFindOptions;
3365
/**
3366
* Display overflow widgets as `fixed`.
3367
* Defaults to `false`.
3368
*/
3369
fixedOverflowWidgets?: boolean;
3370
/**
3371
* Allow content widgets and overflow widgets to overflow the editor viewport.
3372
* Defaults to `true`.
3373
*/
3374
allowOverflow?: boolean;
3375
/**
3376
* The number of vertical lanes the overview ruler should render.
3377
* Defaults to 3.
3378
*/
3379
overviewRulerLanes?: number;
3380
/**
3381
* Controls if a border should be drawn around the overview ruler.
3382
* Defaults to `true`.
3383
*/
3384
overviewRulerBorder?: boolean;
3385
/**
3386
* Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'.
3387
* Defaults to 'blink'.
3388
*/
3389
cursorBlinking?: 'blink' | 'smooth' | 'phase' | 'expand' | 'solid';
3390
/**
3391
* Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl.
3392
* Defaults to false.
3393
*/
3394
mouseWheelZoom?: boolean;
3395
/**
3396
* Control the mouse pointer style, either 'text' or 'default' or 'copy'
3397
* Defaults to 'text'
3398
*/
3399
mouseStyle?: 'text' | 'default' | 'copy';
3400
/**
3401
* Enable smooth caret animation.
3402
* Defaults to 'off'.
3403
*/
3404
cursorSmoothCaretAnimation?: 'off' | 'explicit' | 'on';
3405
/**
3406
* Control the cursor style in insert mode.
3407
* Defaults to 'line'.
3408
*/
3409
cursorStyle?: 'line' | 'block' | 'underline' | 'line-thin' | 'block-outline' | 'underline-thin';
3410
/**
3411
* Control the cursor style in overtype mode.
3412
* Defaults to 'block'.
3413
*/
3414
overtypeCursorStyle?: 'line' | 'block' | 'underline' | 'line-thin' | 'block-outline' | 'underline-thin';
3415
/**
3416
* Controls whether paste in overtype mode should overwrite or insert.
3417
*/
3418
overtypeOnPaste?: boolean;
3419
/**
3420
* Control the width of the cursor when cursorStyle is set to 'line'
3421
*/
3422
cursorWidth?: number;
3423
/**
3424
* Control the height of the cursor when cursorStyle is set to 'line'
3425
*/
3426
cursorHeight?: number;
3427
/**
3428
* Enable font ligatures.
3429
* Defaults to false.
3430
*/
3431
fontLigatures?: boolean | string;
3432
/**
3433
* Enable font variations.
3434
* Defaults to false.
3435
*/
3436
fontVariations?: boolean | string;
3437
/**
3438
* Controls whether to use default color decorations or not using the default document color provider
3439
*/
3440
defaultColorDecorators?: 'auto' | 'always' | 'never';
3441
/**
3442
* Disable the use of `transform: translate3d(0px, 0px, 0px)` for the editor margin and lines layers.
3443
* The usage of `transform: translate3d(0px, 0px, 0px)` acts as a hint for browsers to create an extra layer.
3444
* Defaults to false.
3445
*/
3446
disableLayerHinting?: boolean;
3447
/**
3448
* Disable the optimizations for monospace fonts.
3449
* Defaults to false.
3450
*/
3451
disableMonospaceOptimizations?: boolean;
3452
/**
3453
* Should the cursor be hidden in the overview ruler.
3454
* Defaults to false.
3455
*/
3456
hideCursorInOverviewRuler?: boolean;
3457
/**
3458
* Enable that scrolling can go one screen size after the last line.
3459
* Defaults to true.
3460
*/
3461
scrollBeyondLastLine?: boolean;
3462
/**
3463
* Scroll editor on middle click
3464
*/
3465
scrollOnMiddleClick?: boolean;
3466
/**
3467
* Enable that scrolling can go beyond the last column by a number of columns.
3468
* Defaults to 5.
3469
*/
3470
scrollBeyondLastColumn?: number;
3471
/**
3472
* Enable that the editor animates scrolling to a position.
3473
* Defaults to false.
3474
*/
3475
smoothScrolling?: boolean;
3476
/**
3477
* Enable that the editor will install a ResizeObserver to check if its container dom node size has changed.
3478
* Defaults to false.
3479
*/
3480
automaticLayout?: boolean;
3481
/**
3482
* Control the wrapping of the editor.
3483
* When `wordWrap` = "off", the lines will never wrap.
3484
* When `wordWrap` = "on", the lines will wrap at the viewport width.
3485
* When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
3486
* When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
3487
* Defaults to "off".
3488
*/
3489
wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded';
3490
/**
3491
* Override the `wordWrap` setting.
3492
*/
3493
wordWrapOverride1?: 'off' | 'on' | 'inherit';
3494
/**
3495
* Override the `wordWrapOverride1` setting.
3496
*/
3497
wordWrapOverride2?: 'off' | 'on' | 'inherit';
3498
/**
3499
* Control the wrapping of the editor.
3500
* When `wordWrap` = "off", the lines will never wrap.
3501
* When `wordWrap` = "on", the lines will wrap at the viewport width.
3502
* When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
3503
* When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
3504
* Defaults to 80.
3505
*/
3506
wordWrapColumn?: number;
3507
/**
3508
* Control indentation of wrapped lines. Can be: 'none', 'same', 'indent' or 'deepIndent'.
3509
* Defaults to 'same' in vscode and to 'none' in monaco-editor.
3510
*/
3511
wrappingIndent?: 'none' | 'same' | 'indent' | 'deepIndent';
3512
/**
3513
* Controls the wrapping strategy to use.
3514
* Defaults to 'simple'.
3515
*/
3516
wrappingStrategy?: 'simple' | 'advanced';
3517
/**
3518
* Create a softwrap on every quoted "\n" literal.
3519
* Defaults to false.
3520
*/
3521
wrapOnEscapedLineFeeds?: boolean;
3522
/**
3523
* Configure word wrapping characters. A break will be introduced before these characters.
3524
*/
3525
wordWrapBreakBeforeCharacters?: string;
3526
/**
3527
* Configure word wrapping characters. A break will be introduced after these characters.
3528
*/
3529
wordWrapBreakAfterCharacters?: string;
3530
/**
3531
* Sets whether line breaks appear wherever the text would otherwise overflow its content box.
3532
* When wordBreak = 'normal', Use the default line break rule.
3533
* When wordBreak = 'keepAll', Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal.
3534
*/
3535
wordBreak?: 'normal' | 'keepAll';
3536
/**
3537
* Performance guard: Stop rendering a line after x characters.
3538
* Defaults to 10000.
3539
* Use -1 to never stop rendering
3540
*/
3541
stopRenderingLineAfter?: number;
3542
/**
3543
* Configure the editor's hover.
3544
*/
3545
hover?: IEditorHoverOptions;
3546
/**
3547
* Enable detecting links and making them clickable.
3548
* Defaults to true.
3549
*/
3550
links?: boolean;
3551
/**
3552
* Enable inline color decorators and color picker rendering.
3553
*/
3554
colorDecorators?: boolean;
3555
/**
3556
* Controls what is the condition to spawn a color picker from a color dectorator
3557
*/
3558
colorDecoratorsActivatedOn?: 'clickAndHover' | 'click' | 'hover';
3559
/**
3560
* Controls the max number of color decorators that can be rendered in an editor at once.
3561
*/
3562
colorDecoratorsLimit?: number;
3563
/**
3564
* Control the behaviour of comments in the editor.
3565
*/
3566
comments?: IEditorCommentsOptions;
3567
/**
3568
* Enable custom contextmenu.
3569
* Defaults to true.
3570
*/
3571
contextmenu?: boolean;
3572
/**
3573
* A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.
3574
* Defaults to 1.
3575
*/
3576
mouseWheelScrollSensitivity?: number;
3577
/**
3578
* FastScrolling mulitplier speed when pressing `Alt`
3579
* Defaults to 5.
3580
*/
3581
fastScrollSensitivity?: number;
3582
/**
3583
* Enable that the editor scrolls only the predominant axis. Prevents horizontal drift when scrolling vertically on a trackpad.
3584
* Defaults to true.
3585
*/
3586
scrollPredominantAxis?: boolean;
3587
/**
3588
* Make scrolling inertial - mostly useful with touchpad on linux.
3589
*/
3590
inertialScroll?: boolean;
3591
/**
3592
* Enable that the selection with the mouse and keys is doing column selection.
3593
* Defaults to false.
3594
*/
3595
columnSelection?: boolean;
3596
/**
3597
* The modifier to be used to add multiple cursors with the mouse.
3598
* Defaults to 'alt'
3599
*/
3600
multiCursorModifier?: 'ctrlCmd' | 'alt';
3601
/**
3602
* Merge overlapping selections.
3603
* Defaults to true
3604
*/
3605
multiCursorMergeOverlapping?: boolean;
3606
/**
3607
* Configure the behaviour when pasting a text with the line count equal to the cursor count.
3608
* Defaults to 'spread'.
3609
*/
3610
multiCursorPaste?: 'spread' | 'full';
3611
/**
3612
* Controls the max number of text cursors that can be in an active editor at once.
3613
*/
3614
multiCursorLimit?: number;
3615
/**
3616
* Configure the editor's accessibility support.
3617
* Defaults to 'auto'. It is best to leave this to 'auto'.
3618
*/
3619
accessibilitySupport?: 'auto' | 'off' | 'on';
3620
/**
3621
* Controls the number of lines in the editor that can be read out by a screen reader
3622
*/
3623
accessibilityPageSize?: number;
3624
/**
3625
* Suggest options.
3626
*/
3627
suggest?: ISuggestOptions;
3628
inlineSuggest?: IInlineSuggestOptions;
3629
/**
3630
* Smart select options.
3631
*/
3632
smartSelect?: ISmartSelectOptions;
3633
/**
3634
*
3635
*/
3636
gotoLocation?: IGotoLocationOptions;
3637
/**
3638
* Enable quick suggestions (shadow suggestions)
3639
* Defaults to true.
3640
*/
3641
quickSuggestions?: boolean | IQuickSuggestionsOptions;
3642
/**
3643
* Quick suggestions show delay (in ms)
3644
* Defaults to 10 (ms)
3645
*/
3646
quickSuggestionsDelay?: number;
3647
/**
3648
* Controls the spacing around the editor.
3649
*/
3650
padding?: IEditorPaddingOptions;
3651
/**
3652
* Parameter hint options.
3653
*/
3654
parameterHints?: IEditorParameterHintOptions;
3655
/**
3656
* Options for auto closing brackets.
3657
* Defaults to language defined behavior.
3658
*/
3659
autoClosingBrackets?: EditorAutoClosingStrategy;
3660
/**
3661
* Options for auto closing comments.
3662
* Defaults to language defined behavior.
3663
*/
3664
autoClosingComments?: EditorAutoClosingStrategy;
3665
/**
3666
* Options for auto closing quotes.
3667
* Defaults to language defined behavior.
3668
*/
3669
autoClosingQuotes?: EditorAutoClosingStrategy;
3670
/**
3671
* Options for pressing backspace near quotes or bracket pairs.
3672
*/
3673
autoClosingDelete?: EditorAutoClosingEditStrategy;
3674
/**
3675
* Options for typing over closing quotes or brackets.
3676
*/
3677
autoClosingOvertype?: EditorAutoClosingEditStrategy;
3678
/**
3679
* Options for auto surrounding.
3680
* Defaults to always allowing auto surrounding.
3681
*/
3682
autoSurround?: EditorAutoSurroundStrategy;
3683
/**
3684
* Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.
3685
* Defaults to advanced.
3686
*/
3687
autoIndent?: 'none' | 'keep' | 'brackets' | 'advanced' | 'full';
3688
/**
3689
* Boolean which controls whether to autoindent on paste
3690
*/
3691
autoIndentOnPaste?: boolean;
3692
/**
3693
* Boolean which controls whether to autoindent on paste within a string when autoIndentOnPaste is enabled.
3694
*/
3695
autoIndentOnPasteWithinString?: boolean;
3696
/**
3697
* Emulate selection behaviour of tab characters when using spaces for indentation.
3698
* This means selection will stick to tab stops.
3699
*/
3700
stickyTabStops?: boolean;
3701
/**
3702
* Enable format on type.
3703
* Defaults to false.
3704
*/
3705
formatOnType?: boolean;
3706
/**
3707
* Enable format on paste.
3708
* Defaults to false.
3709
*/
3710
formatOnPaste?: boolean;
3711
/**
3712
* Controls if the editor should allow to move selections via drag and drop.
3713
* Defaults to false.
3714
*/
3715
dragAndDrop?: boolean;
3716
/**
3717
* Enable the suggestion box to pop-up on trigger characters.
3718
* Defaults to true.
3719
*/
3720
suggestOnTriggerCharacters?: boolean;
3721
/**
3722
* Accept suggestions on ENTER.
3723
* Defaults to 'on'.
3724
*/
3725
acceptSuggestionOnEnter?: 'on' | 'smart' | 'off';
3726
/**
3727
* Accept suggestions on provider defined characters.
3728
* Defaults to true.
3729
*/
3730
acceptSuggestionOnCommitCharacter?: boolean;
3731
/**
3732
* Enable snippet suggestions. Default to 'true'.
3733
*/
3734
snippetSuggestions?: 'top' | 'bottom' | 'inline' | 'none';
3735
/**
3736
* Copying without a selection copies the current line.
3737
*/
3738
emptySelectionClipboard?: boolean;
3739
/**
3740
* Syntax highlighting is copied.
3741
*/
3742
copyWithSyntaxHighlighting?: boolean;
3743
/**
3744
* The history mode for suggestions.
3745
*/
3746
suggestSelection?: 'first' | 'recentlyUsed' | 'recentlyUsedByPrefix';
3747
/**
3748
* The font size for the suggest widget.
3749
* Defaults to the editor font size.
3750
*/
3751
suggestFontSize?: number;
3752
/**
3753
* The line height for the suggest widget.
3754
* Defaults to the editor line height.
3755
*/
3756
suggestLineHeight?: number;
3757
/**
3758
* Enable tab completion.
3759
*/
3760
tabCompletion?: 'on' | 'off' | 'onlySnippets';
3761
/**
3762
* Enable selection highlight.
3763
* Defaults to true.
3764
*/
3765
selectionHighlight?: boolean;
3766
/**
3767
* Enable selection highlight for multiline selections.
3768
* Defaults to false.
3769
*/
3770
selectionHighlightMultiline?: boolean;
3771
/**
3772
* Maximum length (in characters) for selection highlights.
3773
* Set to 0 to have an unlimited length.
3774
*/
3775
selectionHighlightMaxLength?: number;
3776
/**
3777
* Enable semantic occurrences highlight.
3778
* Defaults to 'singleFile'.
3779
* 'off' disables occurrence highlighting
3780
* 'singleFile' triggers occurrence highlighting in the current document
3781
* 'multiFile' triggers occurrence highlighting across valid open documents
3782
*/
3783
occurrencesHighlight?: 'off' | 'singleFile' | 'multiFile';
3784
/**
3785
* Controls delay for occurrences highlighting
3786
* Defaults to 250.
3787
* Minimum value is 0
3788
* Maximum value is 2000
3789
*/
3790
occurrencesHighlightDelay?: number;
3791
/**
3792
* Show code lens
3793
* Defaults to true.
3794
*/
3795
codeLens?: boolean;
3796
/**
3797
* Code lens font family. Defaults to editor font family.
3798
*/
3799
codeLensFontFamily?: string;
3800
/**
3801
* Code lens font size. Default to 90% of the editor font size
3802
*/
3803
codeLensFontSize?: number;
3804
/**
3805
* Control the behavior and rendering of the code action lightbulb.
3806
*/
3807
lightbulb?: IEditorLightbulbOptions;
3808
/**
3809
* Timeout for running code actions on save.
3810
*/
3811
codeActionsOnSaveTimeout?: number;
3812
/**
3813
* Enable code folding.
3814
* Defaults to true.
3815
*/
3816
folding?: boolean;
3817
/**
3818
* Selects the folding strategy. 'auto' uses the strategies contributed for the current document, 'indentation' uses the indentation based folding strategy.
3819
* Defaults to 'auto'.
3820
*/
3821
foldingStrategy?: 'auto' | 'indentation';
3822
/**
3823
* Enable highlight for folded regions.
3824
* Defaults to true.
3825
*/
3826
foldingHighlight?: boolean;
3827
/**
3828
* Auto fold imports folding regions.
3829
* Defaults to true.
3830
*/
3831
foldingImportsByDefault?: boolean;
3832
/**
3833
* Maximum number of foldable regions.
3834
* Defaults to 5000.
3835
*/
3836
foldingMaximumRegions?: number;
3837
/**
3838
* Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter.
3839
* Defaults to 'mouseover'.
3840
*/
3841
showFoldingControls?: 'always' | 'never' | 'mouseover';
3842
/**
3843
* Controls whether clicking on the empty content after a folded line will unfold the line.
3844
* Defaults to false.
3845
*/
3846
unfoldOnClickAfterEndOfLine?: boolean;
3847
/**
3848
* Enable highlighting of matching brackets.
3849
* Defaults to 'always'.
3850
*/
3851
matchBrackets?: 'never' | 'near' | 'always';
3852
/**
3853
* Enable experimental rendering using WebGPU.
3854
* Defaults to 'off'.
3855
*/
3856
experimentalGpuAcceleration?: 'on' | 'off';
3857
/**
3858
* Enable experimental whitespace rendering.
3859
* Defaults to 'svg'.
3860
*/
3861
experimentalWhitespaceRendering?: 'svg' | 'font' | 'off';
3862
/**
3863
* Enable rendering of whitespace.
3864
* Defaults to 'selection'.
3865
*/
3866
renderWhitespace?: 'none' | 'boundary' | 'selection' | 'trailing' | 'all';
3867
/**
3868
* Enable rendering of control characters.
3869
* Defaults to true.
3870
*/
3871
renderControlCharacters?: boolean;
3872
/**
3873
* Enable rendering of current line highlight.
3874
* Defaults to all.
3875
*/
3876
renderLineHighlight?: 'none' | 'gutter' | 'line' | 'all';
3877
/**
3878
* Control if the current line highlight should be rendered only the editor is focused.
3879
* Defaults to false.
3880
*/
3881
renderLineHighlightOnlyWhenFocus?: boolean;
3882
/**
3883
* Inserting and deleting whitespace follows tab stops.
3884
*/
3885
useTabStops?: boolean;
3886
/**
3887
* Controls whether the editor should automatically remove indentation whitespace when joining lines with Delete.
3888
* Defaults to false.
3889
*/
3890
trimWhitespaceOnDelete?: boolean;
3891
/**
3892
* The font family
3893
*/
3894
fontFamily?: string;
3895
/**
3896
* The font weight
3897
*/
3898
fontWeight?: string;
3899
/**
3900
* The font size
3901
*/
3902
fontSize?: number;
3903
/**
3904
* The line height
3905
*/
3906
lineHeight?: number;
3907
/**
3908
* The letter spacing
3909
*/
3910
letterSpacing?: number;
3911
/**
3912
* Controls fading out of unused variables.
3913
*/
3914
showUnused?: boolean;
3915
/**
3916
* Controls whether to focus the inline editor in the peek widget by default.
3917
* Defaults to false.
3918
*/
3919
peekWidgetDefaultFocus?: 'tree' | 'editor';
3920
/**
3921
* Sets a placeholder for the editor.
3922
* If set, the placeholder is shown if the editor is empty.
3923
*/
3924
placeholder?: string | undefined;
3925
/**
3926
* Controls whether the definition link opens element in the peek widget.
3927
* Defaults to false.
3928
*/
3929
definitionLinkOpensInPeek?: boolean;
3930
/**
3931
* Controls strikethrough deprecated variables.
3932
*/
3933
showDeprecated?: boolean;
3934
/**
3935
* Controls whether suggestions allow matches in the middle of the word instead of only at the beginning
3936
*/
3937
matchOnWordStartOnly?: boolean;
3938
/**
3939
* Control the behavior and rendering of the inline hints.
3940
*/
3941
inlayHints?: IEditorInlayHintsOptions;
3942
/**
3943
* Control if the editor should use shadow DOM.
3944
*/
3945
useShadowDOM?: boolean;
3946
/**
3947
* Controls the behavior of editor guides.
3948
*/
3949
guides?: IGuidesOptions;
3950
/**
3951
* Controls the behavior of the unicode highlight feature
3952
* (by default, ambiguous and invisible characters are highlighted).
3953
*/
3954
unicodeHighlight?: IUnicodeHighlightOptions;
3955
/**
3956
* Configures bracket pair colorization (disabled by default).
3957
*/
3958
bracketPairColorization?: IBracketPairColorizationOptions;
3959
/**
3960
* Controls dropping into the editor from an external source.
3961
*
3962
* When enabled, this shows a preview of the drop location and triggers an `onDropIntoEditor` event.
3963
*/
3964
dropIntoEditor?: IDropIntoEditorOptions;
3965
/**
3966
* Sets whether the new experimental edit context should be used instead of the text area.
3967
*/
3968
editContext?: boolean;
3969
/**
3970
* Controls whether to render rich HTML screen reader content when the EditContext is enabled
3971
*/
3972
renderRichScreenReaderContent?: boolean;
3973
/**
3974
* Controls support for changing how content is pasted into the editor.
3975
*/
3976
pasteAs?: IPasteAsOptions;
3977
/**
3978
* Controls whether the editor / terminal receives tabs or defers them to the workbench for navigation.
3979
*/
3980
tabFocusMode?: boolean;
3981
/**
3982
* Controls whether the accessibility hint should be provided to screen reader users when an inline completion is shown.
3983
*/
3984
inlineCompletionsAccessibilityVerbose?: boolean;
3985
}
3986
3987
export interface IDiffEditorBaseOptions {
3988
/**
3989
* Allow the user to resize the diff editor split view.
3990
* Defaults to true.
3991
*/
3992
enableSplitViewResizing?: boolean;
3993
/**
3994
* The default ratio when rendering side-by-side editors.
3995
* Must be a number between 0 and 1, min sizes apply.
3996
* Defaults to 0.5
3997
*/
3998
splitViewDefaultRatio?: number;
3999
/**
4000
* Render the differences in two side-by-side editors.
4001
* Defaults to true.
4002
*/
4003
renderSideBySide?: boolean;
4004
/**
4005
* When `renderSideBySide` is enabled, `useInlineViewWhenSpaceIsLimited` is set,
4006
* and the diff editor has a width less than `renderSideBySideInlineBreakpoint`, the inline view is used.
4007
*/
4008
renderSideBySideInlineBreakpoint?: number | undefined;
4009
/**
4010
* When `renderSideBySide` is enabled, `useInlineViewWhenSpaceIsLimited` is set,
4011
* and the diff editor has a width less than `renderSideBySideInlineBreakpoint`, the inline view is used.
4012
*/
4013
useInlineViewWhenSpaceIsLimited?: boolean;
4014
/**
4015
* If set, the diff editor is optimized for small views.
4016
* Defaults to `false`.
4017
*/
4018
compactMode?: boolean;
4019
/**
4020
* Timeout in milliseconds after which diff computation is cancelled.
4021
* Defaults to 5000.
4022
*/
4023
maxComputationTime?: number;
4024
/**
4025
* Maximum supported file size in MB.
4026
* Defaults to 50.
4027
*/
4028
maxFileSize?: number;
4029
/**
4030
* Compute the diff by ignoring leading/trailing whitespace
4031
* Defaults to true.
4032
*/
4033
ignoreTrimWhitespace?: boolean;
4034
/**
4035
* Render +/- indicators for added/deleted changes.
4036
* Defaults to true.
4037
*/
4038
renderIndicators?: boolean;
4039
/**
4040
* Shows icons in the glyph margin to revert changes.
4041
* Default to true.
4042
*/
4043
renderMarginRevertIcon?: boolean;
4044
/**
4045
* Indicates if the gutter menu should be rendered.
4046
*/
4047
renderGutterMenu?: boolean;
4048
/**
4049
* Original model should be editable?
4050
* Defaults to false.
4051
*/
4052
originalEditable?: boolean;
4053
/**
4054
* Should the diff editor enable code lens?
4055
* Defaults to false.
4056
*/
4057
diffCodeLens?: boolean;
4058
/**
4059
* Is the diff editor should render overview ruler
4060
* Defaults to true
4061
*/
4062
renderOverviewRuler?: boolean;
4063
/**
4064
* Control the wrapping of the diff editor.
4065
*/
4066
diffWordWrap?: 'off' | 'on' | 'inherit';
4067
/**
4068
* Diff Algorithm
4069
*/
4070
diffAlgorithm?: 'legacy' | 'advanced';
4071
/**
4072
* Whether the diff editor aria label should be verbose.
4073
*/
4074
accessibilityVerbose?: boolean;
4075
experimental?: {
4076
/**
4077
* Defaults to false.
4078
*/
4079
showMoves?: boolean;
4080
showEmptyDecorations?: boolean;
4081
/**
4082
* Only applies when `renderSideBySide` is set to false.
4083
*/
4084
useTrueInlineView?: boolean;
4085
};
4086
/**
4087
* Is the diff editor inside another editor
4088
* Defaults to false
4089
*/
4090
isInEmbeddedEditor?: boolean;
4091
/**
4092
* If the diff editor should only show the difference review mode.
4093
*/
4094
onlyShowAccessibleDiffViewer?: boolean;
4095
hideUnchangedRegions?: {
4096
enabled?: boolean;
4097
revealLineCount?: number;
4098
minimumLineCount?: number;
4099
contextLineCount?: number;
4100
};
4101
}
4102
4103
/**
4104
* Configuration options for the diff editor.
4105
*/
4106
export interface IDiffEditorOptions extends IEditorOptions, IDiffEditorBaseOptions {
4107
}
4108
4109
/**
4110
* An event describing that the configuration of the editor has changed.
4111
*/
4112
export class ConfigurationChangedEvent {
4113
hasChanged(id: EditorOption): boolean;
4114
}
4115
4116
/**
4117
* All computed editor options.
4118
*/
4119
export interface IComputedEditorOptions {
4120
get<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T>;
4121
}
4122
4123
export interface IEditorOption<K extends EditorOption, V> {
4124
readonly id: K;
4125
readonly name: string;
4126
defaultValue: V;
4127
/**
4128
* Might modify `value`.
4129
*/
4130
applyUpdate(value: V | undefined, update: V): ApplyUpdateResult<V>;
4131
}
4132
4133
export class ApplyUpdateResult<T> {
4134
readonly newValue: T;
4135
readonly didChange: boolean;
4136
constructor(newValue: T, didChange: boolean);
4137
}
4138
4139
/**
4140
* Configuration options for editor comments
4141
*/
4142
export interface IEditorCommentsOptions {
4143
/**
4144
* Insert a space after the line comment token and inside the block comments tokens.
4145
* Defaults to true.
4146
*/
4147
insertSpace?: boolean;
4148
/**
4149
* Ignore empty lines when inserting line comments.
4150
* Defaults to true.
4151
*/
4152
ignoreEmptyLines?: boolean;
4153
}
4154
4155
/**
4156
* The kind of animation in which the editor's cursor should be rendered.
4157
*/
4158
export enum TextEditorCursorBlinkingStyle {
4159
/**
4160
* Hidden
4161
*/
4162
Hidden = 0,
4163
/**
4164
* Blinking
4165
*/
4166
Blink = 1,
4167
/**
4168
* Blinking with smooth fading
4169
*/
4170
Smooth = 2,
4171
/**
4172
* Blinking with prolonged filled state and smooth fading
4173
*/
4174
Phase = 3,
4175
/**
4176
* Expand collapse animation on the y axis
4177
*/
4178
Expand = 4,
4179
/**
4180
* No-Blinking
4181
*/
4182
Solid = 5
4183
}
4184
4185
/**
4186
* The style in which the editor's cursor should be rendered.
4187
*/
4188
export enum TextEditorCursorStyle {
4189
/**
4190
* As a vertical line (sitting between two characters).
4191
*/
4192
Line = 1,
4193
/**
4194
* As a block (sitting on top of a character).
4195
*/
4196
Block = 2,
4197
/**
4198
* As a horizontal line (sitting under a character).
4199
*/
4200
Underline = 3,
4201
/**
4202
* As a thin vertical line (sitting between two characters).
4203
*/
4204
LineThin = 4,
4205
/**
4206
* As an outlined block (sitting on top of a character).
4207
*/
4208
BlockOutline = 5,
4209
/**
4210
* As a thin horizontal line (sitting under a character).
4211
*/
4212
UnderlineThin = 6
4213
}
4214
4215
/**
4216
* Configuration options for editor find widget
4217
*/
4218
export interface IEditorFindOptions {
4219
/**
4220
* Controls whether the cursor should move to find matches while typing.
4221
*/
4222
cursorMoveOnType?: boolean;
4223
/**
4224
* Controls whether the find widget should search as you type.
4225
*/
4226
findOnType?: boolean;
4227
/**
4228
* Controls if we seed search string in the Find Widget with editor selection.
4229
*/
4230
seedSearchStringFromSelection?: 'never' | 'always' | 'selection';
4231
/**
4232
* Controls if Find in Selection flag is turned on in the editor.
4233
*/
4234
autoFindInSelection?: 'never' | 'always' | 'multiline';
4235
addExtraSpaceOnTop?: boolean;
4236
/**
4237
* Controls whether the search result and diff result automatically restarts from the beginning (or the end) when no further matches can be found
4238
*/
4239
loop?: boolean;
4240
}
4241
4242
export type GoToLocationValues = 'peek' | 'gotoAndPeek' | 'goto';
4243
4244
/**
4245
* Configuration options for go to location
4246
*/
4247
export interface IGotoLocationOptions {
4248
multiple?: GoToLocationValues;
4249
multipleDefinitions?: GoToLocationValues;
4250
multipleTypeDefinitions?: GoToLocationValues;
4251
multipleDeclarations?: GoToLocationValues;
4252
multipleImplementations?: GoToLocationValues;
4253
multipleReferences?: GoToLocationValues;
4254
multipleTests?: GoToLocationValues;
4255
alternativeDefinitionCommand?: string;
4256
alternativeTypeDefinitionCommand?: string;
4257
alternativeDeclarationCommand?: string;
4258
alternativeImplementationCommand?: string;
4259
alternativeReferenceCommand?: string;
4260
alternativeTestsCommand?: string;
4261
}
4262
4263
/**
4264
* Configuration options for editor hover
4265
*/
4266
export interface IEditorHoverOptions {
4267
/**
4268
* Enable the hover.
4269
* Defaults to true.
4270
*/
4271
enabled?: boolean;
4272
/**
4273
* Delay for showing the hover.
4274
* Defaults to 300.
4275
*/
4276
delay?: number;
4277
/**
4278
* Is the hover sticky such that it can be clicked and its contents selected?
4279
* Defaults to true.
4280
*/
4281
sticky?: boolean;
4282
/**
4283
* Controls how long the hover is visible after you hovered out of it.
4284
* Require sticky setting to be true.
4285
*/
4286
hidingDelay?: number;
4287
/**
4288
* Should the hover be shown above the line if possible?
4289
* Defaults to false.
4290
*/
4291
above?: boolean;
4292
}
4293
4294
/**
4295
* A description for the overview ruler position.
4296
*/
4297
export interface OverviewRulerPosition {
4298
/**
4299
* Width of the overview ruler
4300
*/
4301
readonly width: number;
4302
/**
4303
* Height of the overview ruler
4304
*/
4305
readonly height: number;
4306
/**
4307
* Top position for the overview ruler
4308
*/
4309
readonly top: number;
4310
/**
4311
* Right position for the overview ruler
4312
*/
4313
readonly right: number;
4314
}
4315
4316
export enum RenderMinimap {
4317
None = 0,
4318
Text = 1,
4319
Blocks = 2
4320
}
4321
4322
/**
4323
* The internal layout details of the editor.
4324
*/
4325
export interface EditorLayoutInfo {
4326
/**
4327
* Full editor width.
4328
*/
4329
readonly width: number;
4330
/**
4331
* Full editor height.
4332
*/
4333
readonly height: number;
4334
/**
4335
* Left position for the glyph margin.
4336
*/
4337
readonly glyphMarginLeft: number;
4338
/**
4339
* The width of the glyph margin.
4340
*/
4341
readonly glyphMarginWidth: number;
4342
/**
4343
* The number of decoration lanes to render in the glyph margin.
4344
*/
4345
readonly glyphMarginDecorationLaneCount: number;
4346
/**
4347
* Left position for the line numbers.
4348
*/
4349
readonly lineNumbersLeft: number;
4350
/**
4351
* The width of the line numbers.
4352
*/
4353
readonly lineNumbersWidth: number;
4354
/**
4355
* Left position for the line decorations.
4356
*/
4357
readonly decorationsLeft: number;
4358
/**
4359
* The width of the line decorations.
4360
*/
4361
readonly decorationsWidth: number;
4362
/**
4363
* Left position for the content (actual text)
4364
*/
4365
readonly contentLeft: number;
4366
/**
4367
* The width of the content (actual text)
4368
*/
4369
readonly contentWidth: number;
4370
/**
4371
* Layout information for the minimap
4372
*/
4373
readonly minimap: EditorMinimapLayoutInfo;
4374
/**
4375
* The number of columns (of typical characters) fitting on a viewport line.
4376
*/
4377
readonly viewportColumn: number;
4378
readonly isWordWrapMinified: boolean;
4379
readonly isViewportWrapping: boolean;
4380
readonly wrappingColumn: number;
4381
/**
4382
* The width of the vertical scrollbar.
4383
*/
4384
readonly verticalScrollbarWidth: number;
4385
/**
4386
* The height of the horizontal scrollbar.
4387
*/
4388
readonly horizontalScrollbarHeight: number;
4389
/**
4390
* The position of the overview ruler.
4391
*/
4392
readonly overviewRuler: OverviewRulerPosition;
4393
}
4394
4395
/**
4396
* The internal layout details of the editor.
4397
*/
4398
export interface EditorMinimapLayoutInfo {
4399
readonly renderMinimap: RenderMinimap;
4400
readonly minimapLeft: number;
4401
readonly minimapWidth: number;
4402
readonly minimapHeightIsEditorHeight: boolean;
4403
readonly minimapIsSampling: boolean;
4404
readonly minimapScale: number;
4405
readonly minimapLineHeight: number;
4406
readonly minimapCanvasInnerWidth: number;
4407
readonly minimapCanvasInnerHeight: number;
4408
readonly minimapCanvasOuterWidth: number;
4409
readonly minimapCanvasOuterHeight: number;
4410
}
4411
4412
export enum ShowLightbulbIconMode {
4413
Off = 'off',
4414
OnCode = 'onCode',
4415
On = 'on'
4416
}
4417
4418
/**
4419
* Configuration options for editor lightbulb
4420
*/
4421
export interface IEditorLightbulbOptions {
4422
/**
4423
* Enable the lightbulb code action.
4424
* The three possible values are `off`, `on` and `onCode` and the default is `onCode`.
4425
* `off` disables the code action menu.
4426
* `on` shows the code action menu on code and on empty lines.
4427
* `onCode` shows the code action menu on code only.
4428
*/
4429
enabled?: ShowLightbulbIconMode;
4430
}
4431
4432
export interface IEditorStickyScrollOptions {
4433
/**
4434
* Enable the sticky scroll
4435
*/
4436
enabled?: boolean;
4437
/**
4438
* Maximum number of sticky lines to show
4439
*/
4440
maxLineCount?: number;
4441
/**
4442
* Model to choose for sticky scroll by default
4443
*/
4444
defaultModel?: 'outlineModel' | 'foldingProviderModel' | 'indentationModel';
4445
/**
4446
* Define whether to scroll sticky scroll with editor horizontal scrollbae
4447
*/
4448
scrollWithEditor?: boolean;
4449
}
4450
4451
/**
4452
* Configuration options for editor inlayHints
4453
*/
4454
export interface IEditorInlayHintsOptions {
4455
/**
4456
* Enable the inline hints.
4457
* Defaults to true.
4458
*/
4459
enabled?: 'on' | 'off' | 'offUnlessPressed' | 'onUnlessPressed';
4460
/**
4461
* Font size of inline hints.
4462
* Default to 90% of the editor font size.
4463
*/
4464
fontSize?: number;
4465
/**
4466
* Font family of inline hints.
4467
* Defaults to editor font family.
4468
*/
4469
fontFamily?: string;
4470
/**
4471
* Enables the padding around the inlay hint.
4472
* Defaults to false.
4473
*/
4474
padding?: boolean;
4475
/**
4476
* Maximum length for inlay hints per line
4477
* Set to 0 to have an unlimited length.
4478
*/
4479
maximumLength?: number;
4480
}
4481
4482
/**
4483
* Configuration options for editor minimap
4484
*/
4485
export interface IEditorMinimapOptions {
4486
/**
4487
* Enable the rendering of the minimap.
4488
* Defaults to true.
4489
*/
4490
enabled?: boolean;
4491
/**
4492
* Control the rendering of minimap.
4493
*/
4494
autohide?: 'none' | 'mouseover' | 'scroll';
4495
/**
4496
* Control the side of the minimap in editor.
4497
* Defaults to 'right'.
4498
*/
4499
side?: 'right' | 'left';
4500
/**
4501
* Control the minimap rendering mode.
4502
* Defaults to 'actual'.
4503
*/
4504
size?: 'proportional' | 'fill' | 'fit';
4505
/**
4506
* Control the rendering of the minimap slider.
4507
* Defaults to 'mouseover'.
4508
*/
4509
showSlider?: 'always' | 'mouseover';
4510
/**
4511
* Render the actual text on a line (as opposed to color blocks).
4512
* Defaults to true.
4513
*/
4514
renderCharacters?: boolean;
4515
/**
4516
* Limit the width of the minimap to render at most a certain number of columns.
4517
* Defaults to 120.
4518
*/
4519
maxColumn?: number;
4520
/**
4521
* Relative size of the font in the minimap. Defaults to 1.
4522
*/
4523
scale?: number;
4524
/**
4525
* Whether to show named regions as section headers. Defaults to true.
4526
*/
4527
showRegionSectionHeaders?: boolean;
4528
/**
4529
* Whether to show MARK: comments as section headers. Defaults to true.
4530
*/
4531
showMarkSectionHeaders?: boolean;
4532
/**
4533
* When specified, is used to create a custom section header parser regexp.
4534
* Must contain a match group named 'label' (written as (?<label>.+)) that encapsulates the section header.
4535
* Optionally can include another match group named 'separator'.
4536
* To match multi-line headers like:
4537
* // ==========
4538
* // My Section
4539
* // ==========
4540
* Use a pattern like: ^={3,}\n^\/\/ *(?<label>[^\n]*?)\n^={3,}$
4541
*/
4542
markSectionHeaderRegex?: string;
4543
/**
4544
* Font size of section headers. Defaults to 9.
4545
*/
4546
sectionHeaderFontSize?: number;
4547
/**
4548
* Spacing between the section header characters (in CSS px). Defaults to 1.
4549
*/
4550
sectionHeaderLetterSpacing?: number;
4551
}
4552
4553
/**
4554
* Configuration options for editor padding
4555
*/
4556
export interface IEditorPaddingOptions {
4557
/**
4558
* Spacing between top edge of editor and first line.
4559
*/
4560
top?: number;
4561
/**
4562
* Spacing between bottom edge of editor and last line.
4563
*/
4564
bottom?: number;
4565
}
4566
4567
/**
4568
* Configuration options for parameter hints
4569
*/
4570
export interface IEditorParameterHintOptions {
4571
/**
4572
* Enable parameter hints.
4573
* Defaults to true.
4574
*/
4575
enabled?: boolean;
4576
/**
4577
* Enable cycling of parameter hints.
4578
* Defaults to false.
4579
*/
4580
cycle?: boolean;
4581
}
4582
4583
export type QuickSuggestionsValue = 'on' | 'inline' | 'off';
4584
4585
/**
4586
* Configuration options for quick suggestions
4587
*/
4588
export interface IQuickSuggestionsOptions {
4589
other?: boolean | QuickSuggestionsValue;
4590
comments?: boolean | QuickSuggestionsValue;
4591
strings?: boolean | QuickSuggestionsValue;
4592
}
4593
4594
export interface InternalQuickSuggestionsOptions {
4595
readonly other: QuickSuggestionsValue;
4596
readonly comments: QuickSuggestionsValue;
4597
readonly strings: QuickSuggestionsValue;
4598
}
4599
4600
export type LineNumbersType = 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string);
4601
4602
export enum RenderLineNumbersType {
4603
Off = 0,
4604
On = 1,
4605
Relative = 2,
4606
Interval = 3,
4607
Custom = 4
4608
}
4609
4610
export interface InternalEditorRenderLineNumbersOptions {
4611
readonly renderType: RenderLineNumbersType;
4612
readonly renderFn: ((lineNumber: number) => string) | null;
4613
}
4614
4615
export interface IRulerOption {
4616
readonly column: number;
4617
readonly color: string | null;
4618
}
4619
4620
/**
4621
* Configuration options for editor scrollbars
4622
*/
4623
export interface IEditorScrollbarOptions {
4624
/**
4625
* The size of arrows (if displayed).
4626
* Defaults to 11.
4627
* **NOTE**: This option cannot be updated using `updateOptions()`
4628
*/
4629
arrowSize?: number;
4630
/**
4631
* Render vertical scrollbar.
4632
* Defaults to 'auto'.
4633
*/
4634
vertical?: 'auto' | 'visible' | 'hidden';
4635
/**
4636
* Render horizontal scrollbar.
4637
* Defaults to 'auto'.
4638
*/
4639
horizontal?: 'auto' | 'visible' | 'hidden';
4640
/**
4641
* Cast horizontal and vertical shadows when the content is scrolled.
4642
* Defaults to true.
4643
* **NOTE**: This option cannot be updated using `updateOptions()`
4644
*/
4645
useShadows?: boolean;
4646
/**
4647
* Render arrows at the top and bottom of the vertical scrollbar.
4648
* Defaults to false.
4649
* **NOTE**: This option cannot be updated using `updateOptions()`
4650
*/
4651
verticalHasArrows?: boolean;
4652
/**
4653
* Render arrows at the left and right of the horizontal scrollbar.
4654
* Defaults to false.
4655
* **NOTE**: This option cannot be updated using `updateOptions()`
4656
*/
4657
horizontalHasArrows?: boolean;
4658
/**
4659
* Listen to mouse wheel events and react to them by scrolling.
4660
* Defaults to true.
4661
*/
4662
handleMouseWheel?: boolean;
4663
/**
4664
* Always consume mouse wheel events (always call preventDefault() and stopPropagation() on the browser events).
4665
* Defaults to true.
4666
* **NOTE**: This option cannot be updated using `updateOptions()`
4667
*/
4668
alwaysConsumeMouseWheel?: boolean;
4669
/**
4670
* Height in pixels for the horizontal scrollbar.
4671
* Defaults to 12 (px).
4672
*/
4673
horizontalScrollbarSize?: number;
4674
/**
4675
* Width in pixels for the vertical scrollbar.
4676
* Defaults to 14 (px).
4677
*/
4678
verticalScrollbarSize?: number;
4679
/**
4680
* Width in pixels for the vertical slider.
4681
* Defaults to `verticalScrollbarSize`.
4682
* **NOTE**: This option cannot be updated using `updateOptions()`
4683
*/
4684
verticalSliderSize?: number;
4685
/**
4686
* Height in pixels for the horizontal slider.
4687
* Defaults to `horizontalScrollbarSize`.
4688
* **NOTE**: This option cannot be updated using `updateOptions()`
4689
*/
4690
horizontalSliderSize?: number;
4691
/**
4692
* Scroll gutter clicks move by page vs jump to position.
4693
* Defaults to false.
4694
*/
4695
scrollByPage?: boolean;
4696
/**
4697
* When set, the horizontal scrollbar will not increase content height.
4698
* Defaults to false.
4699
*/
4700
ignoreHorizontalScrollbarInContentHeight?: boolean;
4701
}
4702
4703
export interface InternalEditorScrollbarOptions {
4704
readonly arrowSize: number;
4705
readonly vertical: ScrollbarVisibility;
4706
readonly horizontal: ScrollbarVisibility;
4707
readonly useShadows: boolean;
4708
readonly verticalHasArrows: boolean;
4709
readonly horizontalHasArrows: boolean;
4710
readonly handleMouseWheel: boolean;
4711
readonly alwaysConsumeMouseWheel: boolean;
4712
readonly horizontalScrollbarSize: number;
4713
readonly horizontalSliderSize: number;
4714
readonly verticalScrollbarSize: number;
4715
readonly verticalSliderSize: number;
4716
readonly scrollByPage: boolean;
4717
readonly ignoreHorizontalScrollbarInContentHeight: boolean;
4718
}
4719
4720
export type InUntrustedWorkspace = 'inUntrustedWorkspace';
4721
4722
/**
4723
* Configuration options for unicode highlighting.
4724
*/
4725
export interface IUnicodeHighlightOptions {
4726
/**
4727
* Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII.
4728
*/
4729
nonBasicASCII?: boolean | InUntrustedWorkspace;
4730
/**
4731
* Controls whether characters that just reserve space or have no width at all are highlighted.
4732
*/
4733
invisibleCharacters?: boolean;
4734
/**
4735
* Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.
4736
*/
4737
ambiguousCharacters?: boolean;
4738
/**
4739
* Controls whether characters in comments should also be subject to unicode highlighting.
4740
*/
4741
includeComments?: boolean | InUntrustedWorkspace;
4742
/**
4743
* Controls whether characters in strings should also be subject to unicode highlighting.
4744
*/
4745
includeStrings?: boolean | InUntrustedWorkspace;
4746
/**
4747
* Defines allowed characters that are not being highlighted.
4748
*/
4749
allowedCharacters?: Record<string, true>;
4750
/**
4751
* Unicode characters that are common in allowed locales are not being highlighted.
4752
*/
4753
allowedLocales?: Record<string | '_os' | '_vscode', true>;
4754
}
4755
4756
export interface IInlineSuggestOptions {
4757
/**
4758
* Enable or disable the rendering of automatic inline completions.
4759
*/
4760
enabled?: boolean;
4761
/**
4762
* Configures the mode.
4763
* Use `prefix` to only show ghost text if the text to replace is a prefix of the suggestion text.
4764
* Use `subword` to only show ghost text if the replace text is a subword of the suggestion text.
4765
* Use `subwordSmart` to only show ghost text if the replace text is a subword of the suggestion text, but the subword must start after the cursor position.
4766
* Defaults to `prefix`.
4767
*/
4768
mode?: 'prefix' | 'subword' | 'subwordSmart';
4769
showToolbar?: 'always' | 'onHover' | 'never';
4770
syntaxHighlightingEnabled?: boolean;
4771
suppressSuggestions?: boolean;
4772
minShowDelay?: number;
4773
/**
4774
* Does not clear active inline suggestions when the editor loses focus.
4775
*/
4776
keepOnBlur?: boolean;
4777
/**
4778
* Font family for inline suggestions.
4779
*/
4780
fontFamily?: string | 'default';
4781
}
4782
4783
type RequiredRecursive<T> = {
4784
[P in keyof T]-?: T[P] extends object | undefined ? RequiredRecursive<T[P]> : T[P];
4785
};
4786
4787
export interface IBracketPairColorizationOptions {
4788
/**
4789
* Enable or disable bracket pair colorization.
4790
*/
4791
enabled?: boolean;
4792
/**
4793
* Use independent color pool per bracket type.
4794
*/
4795
independentColorPoolPerBracketType?: boolean;
4796
}
4797
4798
export interface IGuidesOptions {
4799
/**
4800
* Enable rendering of bracket pair guides.
4801
* Defaults to false.
4802
*/
4803
bracketPairs?: boolean | 'active';
4804
/**
4805
* Enable rendering of vertical bracket pair guides.
4806
* Defaults to 'active'.
4807
*/
4808
bracketPairsHorizontal?: boolean | 'active';
4809
/**
4810
* Enable highlighting of the active bracket pair.
4811
* Defaults to true.
4812
*/
4813
highlightActiveBracketPair?: boolean;
4814
/**
4815
* Enable rendering of indent guides.
4816
* Defaults to true.
4817
*/
4818
indentation?: boolean;
4819
/**
4820
* Enable highlighting of the active indent guide.
4821
* Defaults to true.
4822
*/
4823
highlightActiveIndentation?: boolean | 'always';
4824
}
4825
4826
/**
4827
* Configuration options for editor suggest widget
4828
*/
4829
export interface ISuggestOptions {
4830
/**
4831
* Overwrite word ends on accept. Default to false.
4832
*/
4833
insertMode?: 'insert' | 'replace';
4834
/**
4835
* Enable graceful matching. Defaults to true.
4836
*/
4837
filterGraceful?: boolean;
4838
/**
4839
* Prevent quick suggestions when a snippet is active. Defaults to true.
4840
*/
4841
snippetsPreventQuickSuggestions?: boolean;
4842
/**
4843
* Favors words that appear close to the cursor.
4844
*/
4845
localityBonus?: boolean;
4846
/**
4847
* Enable using global storage for remembering suggestions.
4848
*/
4849
shareSuggestSelections?: boolean;
4850
/**
4851
* Select suggestions when triggered via quick suggest or trigger characters
4852
*/
4853
selectionMode?: 'always' | 'never' | 'whenTriggerCharacter' | 'whenQuickSuggestion';
4854
/**
4855
* Enable or disable icons in suggestions. Defaults to true.
4856
*/
4857
showIcons?: boolean;
4858
/**
4859
* Enable or disable the suggest status bar.
4860
*/
4861
showStatusBar?: boolean;
4862
/**
4863
* Enable or disable the rendering of the suggestion preview.
4864
*/
4865
preview?: boolean;
4866
/**
4867
* Configures the mode of the preview.
4868
*/
4869
previewMode?: 'prefix' | 'subword' | 'subwordSmart';
4870
/**
4871
* Show details inline with the label. Defaults to true.
4872
*/
4873
showInlineDetails?: boolean;
4874
/**
4875
* Show method-suggestions.
4876
*/
4877
showMethods?: boolean;
4878
/**
4879
* Show function-suggestions.
4880
*/
4881
showFunctions?: boolean;
4882
/**
4883
* Show constructor-suggestions.
4884
*/
4885
showConstructors?: boolean;
4886
/**
4887
* Show deprecated-suggestions.
4888
*/
4889
showDeprecated?: boolean;
4890
/**
4891
* Controls whether suggestions allow matches in the middle of the word instead of only at the beginning
4892
*/
4893
matchOnWordStartOnly?: boolean;
4894
/**
4895
* Show field-suggestions.
4896
*/
4897
showFields?: boolean;
4898
/**
4899
* Show variable-suggestions.
4900
*/
4901
showVariables?: boolean;
4902
/**
4903
* Show class-suggestions.
4904
*/
4905
showClasses?: boolean;
4906
/**
4907
* Show struct-suggestions.
4908
*/
4909
showStructs?: boolean;
4910
/**
4911
* Show interface-suggestions.
4912
*/
4913
showInterfaces?: boolean;
4914
/**
4915
* Show module-suggestions.
4916
*/
4917
showModules?: boolean;
4918
/**
4919
* Show property-suggestions.
4920
*/
4921
showProperties?: boolean;
4922
/**
4923
* Show event-suggestions.
4924
*/
4925
showEvents?: boolean;
4926
/**
4927
* Show operator-suggestions.
4928
*/
4929
showOperators?: boolean;
4930
/**
4931
* Show unit-suggestions.
4932
*/
4933
showUnits?: boolean;
4934
/**
4935
* Show value-suggestions.
4936
*/
4937
showValues?: boolean;
4938
/**
4939
* Show constant-suggestions.
4940
*/
4941
showConstants?: boolean;
4942
/**
4943
* Show enum-suggestions.
4944
*/
4945
showEnums?: boolean;
4946
/**
4947
* Show enumMember-suggestions.
4948
*/
4949
showEnumMembers?: boolean;
4950
/**
4951
* Show keyword-suggestions.
4952
*/
4953
showKeywords?: boolean;
4954
/**
4955
* Show text-suggestions.
4956
*/
4957
showWords?: boolean;
4958
/**
4959
* Show color-suggestions.
4960
*/
4961
showColors?: boolean;
4962
/**
4963
* Show file-suggestions.
4964
*/
4965
showFiles?: boolean;
4966
/**
4967
* Show reference-suggestions.
4968
*/
4969
showReferences?: boolean;
4970
/**
4971
* Show folder-suggestions.
4972
*/
4973
showFolders?: boolean;
4974
/**
4975
* Show typeParameter-suggestions.
4976
*/
4977
showTypeParameters?: boolean;
4978
/**
4979
* Show issue-suggestions.
4980
*/
4981
showIssues?: boolean;
4982
/**
4983
* Show user-suggestions.
4984
*/
4985
showUsers?: boolean;
4986
/**
4987
* Show snippet-suggestions.
4988
*/
4989
showSnippets?: boolean;
4990
}
4991
4992
export interface ISmartSelectOptions {
4993
selectLeadingAndTrailingWhitespace?: boolean;
4994
selectSubwords?: boolean;
4995
}
4996
4997
/**
4998
* Describes how to indent wrapped lines.
4999
*/
5000
export enum WrappingIndent {
5001
/**
5002
* No indentation => wrapped lines begin at column 1.
5003
*/
5004
None = 0,
5005
/**
5006
* Same => wrapped lines get the same indentation as the parent.
5007
*/
5008
Same = 1,
5009
/**
5010
* Indent => wrapped lines get +1 indentation toward the parent.
5011
*/
5012
Indent = 2,
5013
/**
5014
* DeepIndent => wrapped lines get +2 indentation toward the parent.
5015
*/
5016
DeepIndent = 3
5017
}
5018
5019
export interface EditorWrappingInfo {
5020
readonly isDominatedByLongLines: boolean;
5021
readonly isWordWrapMinified: boolean;
5022
readonly isViewportWrapping: boolean;
5023
readonly wrappingColumn: number;
5024
}
5025
5026
/**
5027
* Configuration options for editor drop into behavior
5028
*/
5029
export interface IDropIntoEditorOptions {
5030
/**
5031
* Enable dropping into editor.
5032
* Defaults to true.
5033
*/
5034
enabled?: boolean;
5035
/**
5036
* Controls if a widget is shown after a drop.
5037
* Defaults to 'afterDrop'.
5038
*/
5039
showDropSelector?: 'afterDrop' | 'never';
5040
}
5041
5042
/**
5043
* Configuration options for editor pasting as into behavior
5044
*/
5045
export interface IPasteAsOptions {
5046
/**
5047
* Enable paste as functionality in editors.
5048
* Defaults to true.
5049
*/
5050
enabled?: boolean;
5051
/**
5052
* Controls if a widget is shown after a drop.
5053
* Defaults to 'afterPaste'.
5054
*/
5055
showPasteSelector?: 'afterPaste' | 'never';
5056
}
5057
5058
export enum EditorOption {
5059
acceptSuggestionOnCommitCharacter = 0,
5060
acceptSuggestionOnEnter = 1,
5061
accessibilitySupport = 2,
5062
accessibilityPageSize = 3,
5063
allowOverflow = 4,
5064
allowVariableLineHeights = 5,
5065
allowVariableFonts = 6,
5066
allowVariableFontsInAccessibilityMode = 7,
5067
ariaLabel = 8,
5068
ariaRequired = 9,
5069
autoClosingBrackets = 10,
5070
autoClosingComments = 11,
5071
screenReaderAnnounceInlineSuggestion = 12,
5072
autoClosingDelete = 13,
5073
autoClosingOvertype = 14,
5074
autoClosingQuotes = 15,
5075
autoIndent = 16,
5076
autoIndentOnPaste = 17,
5077
autoIndentOnPasteWithinString = 18,
5078
automaticLayout = 19,
5079
autoSurround = 20,
5080
bracketPairColorization = 21,
5081
guides = 22,
5082
codeLens = 23,
5083
codeLensFontFamily = 24,
5084
codeLensFontSize = 25,
5085
colorDecorators = 26,
5086
colorDecoratorsLimit = 27,
5087
columnSelection = 28,
5088
comments = 29,
5089
contextmenu = 30,
5090
copyWithSyntaxHighlighting = 31,
5091
cursorBlinking = 32,
5092
cursorSmoothCaretAnimation = 33,
5093
cursorStyle = 34,
5094
cursorSurroundingLines = 35,
5095
cursorSurroundingLinesStyle = 36,
5096
cursorWidth = 37,
5097
cursorHeight = 38,
5098
disableLayerHinting = 39,
5099
disableMonospaceOptimizations = 40,
5100
domReadOnly = 41,
5101
dragAndDrop = 42,
5102
dropIntoEditor = 43,
5103
editContext = 44,
5104
emptySelectionClipboard = 45,
5105
experimentalGpuAcceleration = 46,
5106
experimentalWhitespaceRendering = 47,
5107
extraEditorClassName = 48,
5108
fastScrollSensitivity = 49,
5109
find = 50,
5110
fixedOverflowWidgets = 51,
5111
folding = 52,
5112
foldingStrategy = 53,
5113
foldingHighlight = 54,
5114
foldingImportsByDefault = 55,
5115
foldingMaximumRegions = 56,
5116
unfoldOnClickAfterEndOfLine = 57,
5117
fontFamily = 58,
5118
fontInfo = 59,
5119
fontLigatures = 60,
5120
fontSize = 61,
5121
fontWeight = 62,
5122
fontVariations = 63,
5123
formatOnPaste = 64,
5124
formatOnType = 65,
5125
glyphMargin = 66,
5126
gotoLocation = 67,
5127
hideCursorInOverviewRuler = 68,
5128
hover = 69,
5129
inDiffEditor = 70,
5130
inlineSuggest = 71,
5131
letterSpacing = 72,
5132
lightbulb = 73,
5133
lineDecorationsWidth = 74,
5134
lineHeight = 75,
5135
lineNumbers = 76,
5136
lineNumbersMinChars = 77,
5137
linkedEditing = 78,
5138
links = 79,
5139
matchBrackets = 80,
5140
minimap = 81,
5141
mouseStyle = 82,
5142
mouseWheelScrollSensitivity = 83,
5143
mouseWheelZoom = 84,
5144
multiCursorMergeOverlapping = 85,
5145
multiCursorModifier = 86,
5146
multiCursorPaste = 87,
5147
multiCursorLimit = 88,
5148
occurrencesHighlight = 89,
5149
occurrencesHighlightDelay = 90,
5150
overtypeCursorStyle = 91,
5151
overtypeOnPaste = 92,
5152
overviewRulerBorder = 93,
5153
overviewRulerLanes = 94,
5154
padding = 95,
5155
pasteAs = 96,
5156
parameterHints = 97,
5157
peekWidgetDefaultFocus = 98,
5158
placeholder = 99,
5159
definitionLinkOpensInPeek = 100,
5160
quickSuggestions = 101,
5161
quickSuggestionsDelay = 102,
5162
readOnly = 103,
5163
readOnlyMessage = 104,
5164
renameOnType = 105,
5165
renderRichScreenReaderContent = 106,
5166
renderControlCharacters = 107,
5167
renderFinalNewline = 108,
5168
renderLineHighlight = 109,
5169
renderLineHighlightOnlyWhenFocus = 110,
5170
renderValidationDecorations = 111,
5171
renderWhitespace = 112,
5172
revealHorizontalRightPadding = 113,
5173
roundedSelection = 114,
5174
rulers = 115,
5175
scrollbar = 116,
5176
scrollBeyondLastColumn = 117,
5177
scrollBeyondLastLine = 118,
5178
scrollPredominantAxis = 119,
5179
selectionClipboard = 120,
5180
selectionHighlight = 121,
5181
selectionHighlightMaxLength = 122,
5182
selectionHighlightMultiline = 123,
5183
selectOnLineNumbers = 124,
5184
showFoldingControls = 125,
5185
showUnused = 126,
5186
snippetSuggestions = 127,
5187
smartSelect = 128,
5188
smoothScrolling = 129,
5189
stickyScroll = 130,
5190
stickyTabStops = 131,
5191
stopRenderingLineAfter = 132,
5192
suggest = 133,
5193
suggestFontSize = 134,
5194
suggestLineHeight = 135,
5195
suggestOnTriggerCharacters = 136,
5196
suggestSelection = 137,
5197
tabCompletion = 138,
5198
tabIndex = 139,
5199
trimWhitespaceOnDelete = 140,
5200
unicodeHighlighting = 141,
5201
unusualLineTerminators = 142,
5202
useShadowDOM = 143,
5203
useTabStops = 144,
5204
wordBreak = 145,
5205
wordSegmenterLocales = 146,
5206
wordSeparators = 147,
5207
wordWrap = 148,
5208
wordWrapBreakAfterCharacters = 149,
5209
wordWrapBreakBeforeCharacters = 150,
5210
wordWrapColumn = 151,
5211
wordWrapOverride1 = 152,
5212
wordWrapOverride2 = 153,
5213
wrappingIndent = 154,
5214
wrappingStrategy = 155,
5215
showDeprecated = 156,
5216
inertialScroll = 157,
5217
inlayHints = 158,
5218
wrapOnEscapedLineFeeds = 159,
5219
effectiveCursorStyle = 160,
5220
editorClassName = 161,
5221
pixelRatio = 162,
5222
tabFocusMode = 163,
5223
layoutInfo = 164,
5224
wrappingInfo = 165,
5225
defaultColorDecorators = 166,
5226
colorDecoratorsActivatedOn = 167,
5227
inlineCompletionsAccessibilityVerbose = 168,
5228
effectiveEditContext = 169,
5229
scrollOnMiddleClick = 170,
5230
effectiveAllowVariableFonts = 171
5231
}
5232
5233
export const EditorOptions: {
5234
acceptSuggestionOnCommitCharacter: IEditorOption<EditorOption.acceptSuggestionOnCommitCharacter, boolean>;
5235
acceptSuggestionOnEnter: IEditorOption<EditorOption.acceptSuggestionOnEnter, 'on' | 'off' | 'smart'>;
5236
accessibilitySupport: IEditorOption<EditorOption.accessibilitySupport, AccessibilitySupport>;
5237
accessibilityPageSize: IEditorOption<EditorOption.accessibilityPageSize, number>;
5238
allowOverflow: IEditorOption<EditorOption.allowOverflow, boolean>;
5239
allowVariableLineHeights: IEditorOption<EditorOption.allowVariableLineHeights, boolean>;
5240
allowVariableFonts: IEditorOption<EditorOption.allowVariableFonts, boolean>;
5241
allowVariableFontsInAccessibilityMode: IEditorOption<EditorOption.allowVariableFontsInAccessibilityMode, boolean>;
5242
ariaLabel: IEditorOption<EditorOption.ariaLabel, string>;
5243
ariaRequired: IEditorOption<EditorOption.ariaRequired, boolean>;
5244
screenReaderAnnounceInlineSuggestion: IEditorOption<EditorOption.screenReaderAnnounceInlineSuggestion, boolean>;
5245
autoClosingBrackets: IEditorOption<EditorOption.autoClosingBrackets, 'always' | 'never' | 'languageDefined' | 'beforeWhitespace'>;
5246
autoClosingComments: IEditorOption<EditorOption.autoClosingComments, 'always' | 'never' | 'languageDefined' | 'beforeWhitespace'>;
5247
autoClosingDelete: IEditorOption<EditorOption.autoClosingDelete, 'auto' | 'always' | 'never'>;
5248
autoClosingOvertype: IEditorOption<EditorOption.autoClosingOvertype, 'auto' | 'always' | 'never'>;
5249
autoClosingQuotes: IEditorOption<EditorOption.autoClosingQuotes, 'always' | 'never' | 'languageDefined' | 'beforeWhitespace'>;
5250
autoIndent: IEditorOption<EditorOption.autoIndent, EditorAutoIndentStrategy>;
5251
autoIndentOnPaste: IEditorOption<EditorOption.autoIndentOnPaste, boolean>;
5252
autoIndentOnPasteWithinString: IEditorOption<EditorOption.autoIndentOnPasteWithinString, boolean>;
5253
automaticLayout: IEditorOption<EditorOption.automaticLayout, boolean>;
5254
autoSurround: IEditorOption<EditorOption.autoSurround, 'never' | 'languageDefined' | 'quotes' | 'brackets'>;
5255
bracketPairColorization: IEditorOption<EditorOption.bracketPairColorization, Readonly<Required<IBracketPairColorizationOptions>>>;
5256
bracketPairGuides: IEditorOption<EditorOption.guides, Readonly<Required<IGuidesOptions>>>;
5257
stickyTabStops: IEditorOption<EditorOption.stickyTabStops, boolean>;
5258
codeLens: IEditorOption<EditorOption.codeLens, boolean>;
5259
codeLensFontFamily: IEditorOption<EditorOption.codeLensFontFamily, string>;
5260
codeLensFontSize: IEditorOption<EditorOption.codeLensFontSize, number>;
5261
colorDecorators: IEditorOption<EditorOption.colorDecorators, boolean>;
5262
colorDecoratorActivatedOn: IEditorOption<EditorOption.colorDecoratorsActivatedOn, 'hover' | 'clickAndHover' | 'click'>;
5263
colorDecoratorsLimit: IEditorOption<EditorOption.colorDecoratorsLimit, number>;
5264
columnSelection: IEditorOption<EditorOption.columnSelection, boolean>;
5265
comments: IEditorOption<EditorOption.comments, Readonly<Required<IEditorCommentsOptions>>>;
5266
contextmenu: IEditorOption<EditorOption.contextmenu, boolean>;
5267
copyWithSyntaxHighlighting: IEditorOption<EditorOption.copyWithSyntaxHighlighting, boolean>;
5268
cursorBlinking: IEditorOption<EditorOption.cursorBlinking, TextEditorCursorBlinkingStyle>;
5269
cursorSmoothCaretAnimation: IEditorOption<EditorOption.cursorSmoothCaretAnimation, 'on' | 'off' | 'explicit'>;
5270
cursorStyle: IEditorOption<EditorOption.cursorStyle, TextEditorCursorStyle>;
5271
overtypeCursorStyle: IEditorOption<EditorOption.overtypeCursorStyle, TextEditorCursorStyle>;
5272
cursorSurroundingLines: IEditorOption<EditorOption.cursorSurroundingLines, number>;
5273
cursorSurroundingLinesStyle: IEditorOption<EditorOption.cursorSurroundingLinesStyle, 'default' | 'all'>;
5274
cursorWidth: IEditorOption<EditorOption.cursorWidth, number>;
5275
cursorHeight: IEditorOption<EditorOption.cursorHeight, number>;
5276
disableLayerHinting: IEditorOption<EditorOption.disableLayerHinting, boolean>;
5277
disableMonospaceOptimizations: IEditorOption<EditorOption.disableMonospaceOptimizations, boolean>;
5278
domReadOnly: IEditorOption<EditorOption.domReadOnly, boolean>;
5279
dragAndDrop: IEditorOption<EditorOption.dragAndDrop, boolean>;
5280
emptySelectionClipboard: IEditorOption<EditorOption.emptySelectionClipboard, boolean>;
5281
dropIntoEditor: IEditorOption<EditorOption.dropIntoEditor, Readonly<Required<IDropIntoEditorOptions>>>;
5282
editContext: IEditorOption<EditorOption.editContext, boolean>;
5283
renderRichScreenReaderContent: IEditorOption<EditorOption.renderRichScreenReaderContent, boolean>;
5284
stickyScroll: IEditorOption<EditorOption.stickyScroll, Readonly<Required<IEditorStickyScrollOptions>>>;
5285
experimentalGpuAcceleration: IEditorOption<EditorOption.experimentalGpuAcceleration, 'on' | 'off'>;
5286
experimentalWhitespaceRendering: IEditorOption<EditorOption.experimentalWhitespaceRendering, 'off' | 'svg' | 'font'>;
5287
extraEditorClassName: IEditorOption<EditorOption.extraEditorClassName, string>;
5288
fastScrollSensitivity: IEditorOption<EditorOption.fastScrollSensitivity, number>;
5289
find: IEditorOption<EditorOption.find, Readonly<Required<IEditorFindOptions>>>;
5290
fixedOverflowWidgets: IEditorOption<EditorOption.fixedOverflowWidgets, boolean>;
5291
folding: IEditorOption<EditorOption.folding, boolean>;
5292
foldingStrategy: IEditorOption<EditorOption.foldingStrategy, 'auto' | 'indentation'>;
5293
foldingHighlight: IEditorOption<EditorOption.foldingHighlight, boolean>;
5294
foldingImportsByDefault: IEditorOption<EditorOption.foldingImportsByDefault, boolean>;
5295
foldingMaximumRegions: IEditorOption<EditorOption.foldingMaximumRegions, number>;
5296
unfoldOnClickAfterEndOfLine: IEditorOption<EditorOption.unfoldOnClickAfterEndOfLine, boolean>;
5297
fontFamily: IEditorOption<EditorOption.fontFamily, string>;
5298
fontInfo: IEditorOption<EditorOption.fontInfo, FontInfo>;
5299
fontLigatures2: IEditorOption<EditorOption.fontLigatures, string>;
5300
fontSize: IEditorOption<EditorOption.fontSize, number>;
5301
fontWeight: IEditorOption<EditorOption.fontWeight, string>;
5302
fontVariations: IEditorOption<EditorOption.fontVariations, string>;
5303
formatOnPaste: IEditorOption<EditorOption.formatOnPaste, boolean>;
5304
formatOnType: IEditorOption<EditorOption.formatOnType, boolean>;
5305
glyphMargin: IEditorOption<EditorOption.glyphMargin, boolean>;
5306
gotoLocation: IEditorOption<EditorOption.gotoLocation, Readonly<Required<IGotoLocationOptions>>>;
5307
hideCursorInOverviewRuler: IEditorOption<EditorOption.hideCursorInOverviewRuler, boolean>;
5308
hover: IEditorOption<EditorOption.hover, Readonly<Required<IEditorHoverOptions>>>;
5309
inDiffEditor: IEditorOption<EditorOption.inDiffEditor, boolean>;
5310
inertialScroll: IEditorOption<EditorOption.inertialScroll, boolean>;
5311
letterSpacing: IEditorOption<EditorOption.letterSpacing, number>;
5312
lightbulb: IEditorOption<EditorOption.lightbulb, Readonly<Required<IEditorLightbulbOptions>>>;
5313
lineDecorationsWidth: IEditorOption<EditorOption.lineDecorationsWidth, number>;
5314
lineHeight: IEditorOption<EditorOption.lineHeight, number>;
5315
lineNumbers: IEditorOption<EditorOption.lineNumbers, InternalEditorRenderLineNumbersOptions>;
5316
lineNumbersMinChars: IEditorOption<EditorOption.lineNumbersMinChars, number>;
5317
linkedEditing: IEditorOption<EditorOption.linkedEditing, boolean>;
5318
links: IEditorOption<EditorOption.links, boolean>;
5319
matchBrackets: IEditorOption<EditorOption.matchBrackets, 'always' | 'never' | 'near'>;
5320
minimap: IEditorOption<EditorOption.minimap, Readonly<Required<IEditorMinimapOptions>>>;
5321
mouseStyle: IEditorOption<EditorOption.mouseStyle, 'default' | 'text' | 'copy'>;
5322
mouseWheelScrollSensitivity: IEditorOption<EditorOption.mouseWheelScrollSensitivity, number>;
5323
mouseWheelZoom: IEditorOption<EditorOption.mouseWheelZoom, boolean>;
5324
multiCursorMergeOverlapping: IEditorOption<EditorOption.multiCursorMergeOverlapping, boolean>;
5325
multiCursorModifier: IEditorOption<EditorOption.multiCursorModifier, 'altKey' | 'metaKey' | 'ctrlKey'>;
5326
multiCursorPaste: IEditorOption<EditorOption.multiCursorPaste, 'spread' | 'full'>;
5327
multiCursorLimit: IEditorOption<EditorOption.multiCursorLimit, number>;
5328
occurrencesHighlight: IEditorOption<EditorOption.occurrencesHighlight, 'off' | 'singleFile' | 'multiFile'>;
5329
occurrencesHighlightDelay: IEditorOption<EditorOption.occurrencesHighlightDelay, number>;
5330
overtypeOnPaste: IEditorOption<EditorOption.overtypeOnPaste, boolean>;
5331
overviewRulerBorder: IEditorOption<EditorOption.overviewRulerBorder, boolean>;
5332
overviewRulerLanes: IEditorOption<EditorOption.overviewRulerLanes, number>;
5333
padding: IEditorOption<EditorOption.padding, Readonly<Required<IEditorPaddingOptions>>>;
5334
pasteAs: IEditorOption<EditorOption.pasteAs, Readonly<Required<IPasteAsOptions>>>;
5335
parameterHints: IEditorOption<EditorOption.parameterHints, Readonly<Required<IEditorParameterHintOptions>>>;
5336
peekWidgetDefaultFocus: IEditorOption<EditorOption.peekWidgetDefaultFocus, 'tree' | 'editor'>;
5337
placeholder: IEditorOption<EditorOption.placeholder, string>;
5338
definitionLinkOpensInPeek: IEditorOption<EditorOption.definitionLinkOpensInPeek, boolean>;
5339
quickSuggestions: IEditorOption<EditorOption.quickSuggestions, InternalQuickSuggestionsOptions>;
5340
quickSuggestionsDelay: IEditorOption<EditorOption.quickSuggestionsDelay, number>;
5341
readOnly: IEditorOption<EditorOption.readOnly, boolean>;
5342
readOnlyMessage: IEditorOption<EditorOption.readOnlyMessage, any>;
5343
renameOnType: IEditorOption<EditorOption.renameOnType, boolean>;
5344
renderControlCharacters: IEditorOption<EditorOption.renderControlCharacters, boolean>;
5345
renderFinalNewline: IEditorOption<EditorOption.renderFinalNewline, 'on' | 'off' | 'dimmed'>;
5346
renderLineHighlight: IEditorOption<EditorOption.renderLineHighlight, 'all' | 'line' | 'none' | 'gutter'>;
5347
renderLineHighlightOnlyWhenFocus: IEditorOption<EditorOption.renderLineHighlightOnlyWhenFocus, boolean>;
5348
renderValidationDecorations: IEditorOption<EditorOption.renderValidationDecorations, 'on' | 'off' | 'editable'>;
5349
renderWhitespace: IEditorOption<EditorOption.renderWhitespace, 'all' | 'none' | 'boundary' | 'selection' | 'trailing'>;
5350
revealHorizontalRightPadding: IEditorOption<EditorOption.revealHorizontalRightPadding, number>;
5351
roundedSelection: IEditorOption<EditorOption.roundedSelection, boolean>;
5352
rulers: IEditorOption<EditorOption.rulers, {}>;
5353
scrollbar: IEditorOption<EditorOption.scrollbar, InternalEditorScrollbarOptions>;
5354
scrollBeyondLastColumn: IEditorOption<EditorOption.scrollBeyondLastColumn, number>;
5355
scrollBeyondLastLine: IEditorOption<EditorOption.scrollBeyondLastLine, boolean>;
5356
scrollOnMiddleClick: IEditorOption<EditorOption.scrollOnMiddleClick, boolean>;
5357
scrollPredominantAxis: IEditorOption<EditorOption.scrollPredominantAxis, boolean>;
5358
selectionClipboard: IEditorOption<EditorOption.selectionClipboard, boolean>;
5359
selectionHighlight: IEditorOption<EditorOption.selectionHighlight, boolean>;
5360
selectionHighlightMaxLength: IEditorOption<EditorOption.selectionHighlightMaxLength, number>;
5361
selectionHighlightMultiline: IEditorOption<EditorOption.selectionHighlightMultiline, boolean>;
5362
selectOnLineNumbers: IEditorOption<EditorOption.selectOnLineNumbers, boolean>;
5363
showFoldingControls: IEditorOption<EditorOption.showFoldingControls, 'always' | 'never' | 'mouseover'>;
5364
showUnused: IEditorOption<EditorOption.showUnused, boolean>;
5365
showDeprecated: IEditorOption<EditorOption.showDeprecated, boolean>;
5366
inlayHints: IEditorOption<EditorOption.inlayHints, Readonly<Required<IEditorInlayHintsOptions>>>;
5367
snippetSuggestions: IEditorOption<EditorOption.snippetSuggestions, 'none' | 'top' | 'bottom' | 'inline'>;
5368
smartSelect: IEditorOption<EditorOption.smartSelect, Readonly<Required<ISmartSelectOptions>>>;
5369
smoothScrolling: IEditorOption<EditorOption.smoothScrolling, boolean>;
5370
stopRenderingLineAfter: IEditorOption<EditorOption.stopRenderingLineAfter, number>;
5371
suggest: IEditorOption<EditorOption.suggest, Readonly<Required<ISuggestOptions>>>;
5372
inlineSuggest: IEditorOption<EditorOption.inlineSuggest, Readonly<RequiredRecursive<IInlineSuggestOptions>>>;
5373
inlineCompletionsAccessibilityVerbose: IEditorOption<EditorOption.inlineCompletionsAccessibilityVerbose, boolean>;
5374
suggestFontSize: IEditorOption<EditorOption.suggestFontSize, number>;
5375
suggestLineHeight: IEditorOption<EditorOption.suggestLineHeight, number>;
5376
suggestOnTriggerCharacters: IEditorOption<EditorOption.suggestOnTriggerCharacters, boolean>;
5377
suggestSelection: IEditorOption<EditorOption.suggestSelection, 'first' | 'recentlyUsed' | 'recentlyUsedByPrefix'>;
5378
tabCompletion: IEditorOption<EditorOption.tabCompletion, 'on' | 'off' | 'onlySnippets'>;
5379
tabIndex: IEditorOption<EditorOption.tabIndex, number>;
5380
trimWhitespaceOnDelete: IEditorOption<EditorOption.trimWhitespaceOnDelete, boolean>;
5381
unicodeHighlight: IEditorOption<EditorOption.unicodeHighlighting, any>;
5382
unusualLineTerminators: IEditorOption<EditorOption.unusualLineTerminators, 'off' | 'auto' | 'prompt'>;
5383
useShadowDOM: IEditorOption<EditorOption.useShadowDOM, boolean>;
5384
useTabStops: IEditorOption<EditorOption.useTabStops, boolean>;
5385
wordBreak: IEditorOption<EditorOption.wordBreak, 'normal' | 'keepAll'>;
5386
wordSegmenterLocales: IEditorOption<EditorOption.wordSegmenterLocales, {}>;
5387
wordSeparators: IEditorOption<EditorOption.wordSeparators, string>;
5388
wordWrap: IEditorOption<EditorOption.wordWrap, 'wordWrapColumn' | 'on' | 'off' | 'bounded'>;
5389
wordWrapBreakAfterCharacters: IEditorOption<EditorOption.wordWrapBreakAfterCharacters, string>;
5390
wordWrapBreakBeforeCharacters: IEditorOption<EditorOption.wordWrapBreakBeforeCharacters, string>;
5391
wordWrapColumn: IEditorOption<EditorOption.wordWrapColumn, number>;
5392
wordWrapOverride1: IEditorOption<EditorOption.wordWrapOverride1, 'on' | 'off' | 'inherit'>;
5393
wordWrapOverride2: IEditorOption<EditorOption.wordWrapOverride2, 'on' | 'off' | 'inherit'>;
5394
wrapOnEscapedLineFeeds: IEditorOption<EditorOption.wrapOnEscapedLineFeeds, boolean>;
5395
effectiveCursorStyle: IEditorOption<EditorOption.effectiveCursorStyle, TextEditorCursorStyle>;
5396
editorClassName: IEditorOption<EditorOption.editorClassName, string>;
5397
defaultColorDecorators: IEditorOption<EditorOption.defaultColorDecorators, 'auto' | 'always' | 'never'>;
5398
pixelRatio: IEditorOption<EditorOption.pixelRatio, number>;
5399
tabFocusMode: IEditorOption<EditorOption.tabFocusMode, boolean>;
5400
layoutInfo: IEditorOption<EditorOption.layoutInfo, EditorLayoutInfo>;
5401
wrappingInfo: IEditorOption<EditorOption.wrappingInfo, EditorWrappingInfo>;
5402
wrappingIndent: IEditorOption<EditorOption.wrappingIndent, WrappingIndent>;
5403
wrappingStrategy: IEditorOption<EditorOption.wrappingStrategy, 'simple' | 'advanced'>;
5404
effectiveEditContextEnabled: IEditorOption<EditorOption.effectiveEditContext, boolean>;
5405
effectiveAllowVariableFonts: IEditorOption<EditorOption.effectiveAllowVariableFonts, boolean>;
5406
};
5407
5408
type EditorOptionsType = typeof EditorOptions;
5409
5410
type FindEditorOptionsKeyById<T extends EditorOption> = {
5411
[K in keyof EditorOptionsType]: EditorOptionsType[K]['id'] extends T ? K : never;
5412
}[keyof EditorOptionsType];
5413
5414
type ComputedEditorOptionValue<T extends IEditorOption<any, any>> = T extends IEditorOption<any, infer R> ? R : never;
5415
5416
export type FindComputedEditorOptionValueById<T extends EditorOption> = NonNullable<ComputedEditorOptionValue<EditorOptionsType[FindEditorOptionsKeyById<T>]>>;
5417
5418
export interface IEditorConstructionOptions extends IEditorOptions {
5419
/**
5420
* The initial editor dimension (to avoid measuring the container).
5421
*/
5422
dimension?: IDimension;
5423
/**
5424
* Place overflow widgets inside an external DOM node.
5425
* Defaults to an internal DOM node.
5426
*/
5427
overflowWidgetsDomNode?: HTMLElement;
5428
}
5429
5430
/**
5431
* A view zone is a full horizontal rectangle that 'pushes' text down.
5432
* The editor reserves space for view zones when rendering.
5433
*/
5434
export interface IViewZone {
5435
/**
5436
* The line number after which this zone should appear.
5437
* Use 0 to place a view zone before the first line number.
5438
*/
5439
afterLineNumber: number;
5440
/**
5441
* The column after which this zone should appear.
5442
* If not set, the maxLineColumn of `afterLineNumber` will be used.
5443
* This is relevant for wrapped lines.
5444
*/
5445
afterColumn?: number;
5446
/**
5447
* If the `afterColumn` has multiple view columns, the affinity specifies which one to use. Defaults to `none`.
5448
*/
5449
afterColumnAffinity?: PositionAffinity;
5450
/**
5451
* Render the zone even when its line is hidden.
5452
*/
5453
showInHiddenAreas?: boolean;
5454
/**
5455
* Tiebreaker that is used when multiple view zones want to be after the same line.
5456
* Defaults to `afterColumn` otherwise 10000;
5457
*/
5458
ordinal?: number;
5459
/**
5460
* Suppress mouse down events.
5461
* If set, the editor will attach a mouse down listener to the view zone and .preventDefault on it.
5462
* Defaults to false
5463
*/
5464
suppressMouseDown?: boolean;
5465
/**
5466
* The height in lines of the view zone.
5467
* If specified, `heightInPx` will be used instead of this.
5468
* If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen.
5469
*/
5470
heightInLines?: number;
5471
/**
5472
* The height in px of the view zone.
5473
* If this is set, the editor will give preference to it rather than `heightInLines` above.
5474
* If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen.
5475
*/
5476
heightInPx?: number;
5477
/**
5478
* The minimum width in px of the view zone.
5479
* If this is set, the editor will ensure that the scroll width is >= than this value.
5480
*/
5481
minWidthInPx?: number;
5482
/**
5483
* The dom node of the view zone
5484
*/
5485
domNode: HTMLElement;
5486
/**
5487
* An optional dom node for the view zone that will be placed in the margin area.
5488
*/
5489
marginDomNode?: HTMLElement | null;
5490
/**
5491
* Callback which gives the relative top of the view zone as it appears (taking scrolling into account).
5492
*/
5493
onDomNodeTop?: (top: number) => void;
5494
/**
5495
* Callback which gives the height in pixels of the view zone.
5496
*/
5497
onComputedHeight?: (height: number) => void;
5498
}
5499
5500
/**
5501
* An accessor that allows for zones to be added or removed.
5502
*/
5503
export interface IViewZoneChangeAccessor {
5504
/**
5505
* Create a new view zone.
5506
* @param zone Zone to create
5507
* @return A unique identifier to the view zone.
5508
*/
5509
addZone(zone: IViewZone): string;
5510
/**
5511
* Remove a zone
5512
* @param id A unique identifier to the view zone, as returned by the `addZone` call.
5513
*/
5514
removeZone(id: string): void;
5515
/**
5516
* Change a zone's position.
5517
* The editor will rescan the `afterLineNumber` and `afterColumn` properties of a view zone.
5518
*/
5519
layoutZone(id: string): void;
5520
}
5521
5522
/**
5523
* A positioning preference for rendering content widgets.
5524
*/
5525
export enum ContentWidgetPositionPreference {
5526
/**
5527
* Place the content widget exactly at a position
5528
*/
5529
EXACT = 0,
5530
/**
5531
* Place the content widget above a position
5532
*/
5533
ABOVE = 1,
5534
/**
5535
* Place the content widget below a position
5536
*/
5537
BELOW = 2
5538
}
5539
5540
/**
5541
* A position for rendering content widgets.
5542
*/
5543
export interface IContentWidgetPosition {
5544
/**
5545
* Desired position which serves as an anchor for placing the content widget.
5546
* The widget will be placed above, at, or below the specified position, based on the
5547
* provided preference. The widget will always touch this position.
5548
*
5549
* Given sufficient horizontal space, the widget will be placed to the right of the
5550
* passed in position. This can be tweaked by providing a `secondaryPosition`.
5551
*
5552
* @see preference
5553
* @see secondaryPosition
5554
*/
5555
position: IPosition | null;
5556
/**
5557
* Optionally, a secondary position can be provided to further define the placing of
5558
* the content widget. The secondary position must have the same line number as the
5559
* primary position. If possible, the widget will be placed such that it also touches
5560
* the secondary position.
5561
*/
5562
secondaryPosition?: IPosition | null;
5563
/**
5564
* Placement preference for position, in order of preference.
5565
*/
5566
preference: ContentWidgetPositionPreference[];
5567
/**
5568
* Placement preference when multiple view positions refer to the same (model) position.
5569
* This plays a role when injected text is involved.
5570
*/
5571
positionAffinity?: PositionAffinity;
5572
}
5573
5574
/**
5575
* A content widget renders inline with the text and can be easily placed 'near' an editor position.
5576
*/
5577
export interface IContentWidget {
5578
/**
5579
* Render this content widget in a location where it could overflow the editor's view dom node.
5580
*/
5581
allowEditorOverflow?: boolean;
5582
/**
5583
* Call preventDefault() on mousedown events that target the content widget.
5584
*/
5585
suppressMouseDown?: boolean;
5586
/**
5587
* Get a unique identifier of the content widget.
5588
*/
5589
getId(): string;
5590
/**
5591
* Get the dom node of the content widget.
5592
*/
5593
getDomNode(): HTMLElement;
5594
/**
5595
* Get the placement of the content widget.
5596
* If null is returned, the content widget will be placed off screen.
5597
*/
5598
getPosition(): IContentWidgetPosition | null;
5599
/**
5600
* Optional function that is invoked before rendering
5601
* the content widget. If a dimension is returned the editor will
5602
* attempt to use it.
5603
*/
5604
beforeRender?(): IDimension | null;
5605
/**
5606
* Optional function that is invoked after rendering the content
5607
* widget. Is being invoked with the selected position preference
5608
* or `null` if not rendered.
5609
*/
5610
afterRender?(position: ContentWidgetPositionPreference | null, coordinate: IContentWidgetRenderedCoordinate | null): void;
5611
}
5612
5613
/**
5614
* Coordinatees passed in {@link IContentWidget.afterRender}
5615
*/
5616
export interface IContentWidgetRenderedCoordinate {
5617
/**
5618
* Top position relative to the editor content.
5619
*/
5620
readonly top: number;
5621
/**
5622
* Left position relative to the editor content.
5623
*/
5624
readonly left: number;
5625
}
5626
5627
/**
5628
* A positioning preference for rendering overlay widgets.
5629
*/
5630
export enum OverlayWidgetPositionPreference {
5631
/**
5632
* Position the overlay widget in the top right corner
5633
*/
5634
TOP_RIGHT_CORNER = 0,
5635
/**
5636
* Position the overlay widget in the bottom right corner
5637
*/
5638
BOTTOM_RIGHT_CORNER = 1,
5639
/**
5640
* Position the overlay widget in the top center
5641
*/
5642
TOP_CENTER = 2
5643
}
5644
5645
/**
5646
* Represents editor-relative coordinates of an overlay widget.
5647
*/
5648
export interface IOverlayWidgetPositionCoordinates {
5649
/**
5650
* The top position for the overlay widget, relative to the editor.
5651
*/
5652
top: number;
5653
/**
5654
* The left position for the overlay widget, relative to the editor.
5655
*/
5656
left: number;
5657
}
5658
5659
/**
5660
* A position for rendering overlay widgets.
5661
*/
5662
export interface IOverlayWidgetPosition {
5663
/**
5664
* The position preference for the overlay widget.
5665
*/
5666
preference: OverlayWidgetPositionPreference | IOverlayWidgetPositionCoordinates | null;
5667
/**
5668
* When set, stacks with other overlay widgets with the same preference,
5669
* in an order determined by the ordinal value.
5670
*/
5671
stackOridinal?: number;
5672
}
5673
5674
/**
5675
* An overlay widgets renders on top of the text.
5676
*/
5677
export interface IOverlayWidget {
5678
/**
5679
* Event fired when the widget layout changes.
5680
*/
5681
onDidLayout?: IEvent<void>;
5682
/**
5683
* Render this overlay widget in a location where it could overflow the editor's view dom node.
5684
*/
5685
allowEditorOverflow?: boolean;
5686
/**
5687
* Get a unique identifier of the overlay widget.
5688
*/
5689
getId(): string;
5690
/**
5691
* Get the dom node of the overlay widget.
5692
*/
5693
getDomNode(): HTMLElement;
5694
/**
5695
* Get the placement of the overlay widget.
5696
* If null is returned, the overlay widget is responsible to place itself.
5697
*/
5698
getPosition(): IOverlayWidgetPosition | null;
5699
/**
5700
* The editor will ensure that the scroll width is >= than this value.
5701
*/
5702
getMinContentWidthInPx?(): number;
5703
}
5704
5705
/**
5706
* A glyph margin widget renders in the editor glyph margin.
5707
*/
5708
export interface IGlyphMarginWidget {
5709
/**
5710
* Get a unique identifier of the glyph widget.
5711
*/
5712
getId(): string;
5713
/**
5714
* Get the dom node of the glyph widget.
5715
*/
5716
getDomNode(): HTMLElement;
5717
/**
5718
* Get the placement of the glyph widget.
5719
*/
5720
getPosition(): IGlyphMarginWidgetPosition;
5721
}
5722
5723
/**
5724
* A position for rendering glyph margin widgets.
5725
*/
5726
export interface IGlyphMarginWidgetPosition {
5727
/**
5728
* The glyph margin lane where the widget should be shown.
5729
*/
5730
lane: GlyphMarginLane;
5731
/**
5732
* The priority order of the widget, used for determining which widget
5733
* to render when there are multiple.
5734
*/
5735
zIndex: number;
5736
/**
5737
* The editor range that this widget applies to.
5738
*/
5739
range: IRange;
5740
}
5741
5742
/**
5743
* Type of hit element with the mouse in the editor.
5744
*/
5745
export enum MouseTargetType {
5746
/**
5747
* Mouse is on top of an unknown element.
5748
*/
5749
UNKNOWN = 0,
5750
/**
5751
* Mouse is on top of the textarea used for input.
5752
*/
5753
TEXTAREA = 1,
5754
/**
5755
* Mouse is on top of the glyph margin
5756
*/
5757
GUTTER_GLYPH_MARGIN = 2,
5758
/**
5759
* Mouse is on top of the line numbers
5760
*/
5761
GUTTER_LINE_NUMBERS = 3,
5762
/**
5763
* Mouse is on top of the line decorations
5764
*/
5765
GUTTER_LINE_DECORATIONS = 4,
5766
/**
5767
* Mouse is on top of the whitespace left in the gutter by a view zone.
5768
*/
5769
GUTTER_VIEW_ZONE = 5,
5770
/**
5771
* Mouse is on top of text in the content.
5772
*/
5773
CONTENT_TEXT = 6,
5774
/**
5775
* Mouse is on top of empty space in the content (e.g. after line text or below last line)
5776
*/
5777
CONTENT_EMPTY = 7,
5778
/**
5779
* Mouse is on top of a view zone in the content.
5780
*/
5781
CONTENT_VIEW_ZONE = 8,
5782
/**
5783
* Mouse is on top of a content widget.
5784
*/
5785
CONTENT_WIDGET = 9,
5786
/**
5787
* Mouse is on top of the decorations overview ruler.
5788
*/
5789
OVERVIEW_RULER = 10,
5790
/**
5791
* Mouse is on top of a scrollbar.
5792
*/
5793
SCROLLBAR = 11,
5794
/**
5795
* Mouse is on top of an overlay widget.
5796
*/
5797
OVERLAY_WIDGET = 12,
5798
/**
5799
* Mouse is outside of the editor.
5800
*/
5801
OUTSIDE_EDITOR = 13
5802
}
5803
5804
export interface IBaseMouseTarget {
5805
/**
5806
* The target element
5807
*/
5808
readonly element: HTMLElement | null;
5809
/**
5810
* The 'approximate' editor position
5811
*/
5812
readonly position: Position | null;
5813
/**
5814
* Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line).
5815
*/
5816
readonly mouseColumn: number;
5817
/**
5818
* The 'approximate' editor range
5819
*/
5820
readonly range: Range | null;
5821
}
5822
5823
export interface IMouseTargetUnknown extends IBaseMouseTarget {
5824
readonly type: MouseTargetType.UNKNOWN;
5825
}
5826
5827
export interface IMouseTargetTextarea extends IBaseMouseTarget {
5828
readonly type: MouseTargetType.TEXTAREA;
5829
readonly position: null;
5830
readonly range: null;
5831
}
5832
5833
export interface IMouseTargetMarginData {
5834
readonly isAfterLines: boolean;
5835
readonly glyphMarginLeft: number;
5836
readonly glyphMarginWidth: number;
5837
readonly glyphMarginLane?: GlyphMarginLane;
5838
readonly lineNumbersWidth: number;
5839
readonly offsetX: number;
5840
}
5841
5842
export interface IMouseTargetMargin extends IBaseMouseTarget {
5843
readonly type: MouseTargetType.GUTTER_GLYPH_MARGIN | MouseTargetType.GUTTER_LINE_NUMBERS | MouseTargetType.GUTTER_LINE_DECORATIONS;
5844
readonly position: Position;
5845
readonly range: Range;
5846
readonly detail: IMouseTargetMarginData;
5847
}
5848
5849
export interface IMouseTargetViewZoneData {
5850
readonly viewZoneId: string;
5851
readonly positionBefore: Position | null;
5852
readonly positionAfter: Position | null;
5853
readonly position: Position;
5854
readonly afterLineNumber: number;
5855
}
5856
5857
export interface IMouseTargetViewZone extends IBaseMouseTarget {
5858
readonly type: MouseTargetType.GUTTER_VIEW_ZONE | MouseTargetType.CONTENT_VIEW_ZONE;
5859
readonly position: Position;
5860
readonly range: Range;
5861
readonly detail: IMouseTargetViewZoneData;
5862
}
5863
5864
export interface IMouseTargetContentTextData {
5865
readonly mightBeForeignElement: boolean;
5866
}
5867
5868
export interface IMouseTargetContentText extends IBaseMouseTarget {
5869
readonly type: MouseTargetType.CONTENT_TEXT;
5870
readonly position: Position;
5871
readonly range: Range;
5872
readonly detail: IMouseTargetContentTextData;
5873
}
5874
5875
export interface IMouseTargetContentEmptyData {
5876
readonly isAfterLines: boolean;
5877
readonly horizontalDistanceToText?: number;
5878
}
5879
5880
export interface IMouseTargetContentEmpty extends IBaseMouseTarget {
5881
readonly type: MouseTargetType.CONTENT_EMPTY;
5882
readonly position: Position;
5883
readonly range: Range;
5884
readonly detail: IMouseTargetContentEmptyData;
5885
}
5886
5887
export interface IMouseTargetContentWidget extends IBaseMouseTarget {
5888
readonly type: MouseTargetType.CONTENT_WIDGET;
5889
readonly position: null;
5890
readonly range: null;
5891
readonly detail: string;
5892
}
5893
5894
export interface IMouseTargetOverlayWidget extends IBaseMouseTarget {
5895
readonly type: MouseTargetType.OVERLAY_WIDGET;
5896
readonly position: null;
5897
readonly range: null;
5898
readonly detail: string;
5899
}
5900
5901
export interface IMouseTargetScrollbar extends IBaseMouseTarget {
5902
readonly type: MouseTargetType.SCROLLBAR;
5903
readonly position: Position;
5904
readonly range: Range;
5905
}
5906
5907
export interface IMouseTargetOverviewRuler extends IBaseMouseTarget {
5908
readonly type: MouseTargetType.OVERVIEW_RULER;
5909
}
5910
5911
export interface IMouseTargetOutsideEditor extends IBaseMouseTarget {
5912
readonly type: MouseTargetType.OUTSIDE_EDITOR;
5913
readonly outsidePosition: 'above' | 'below' | 'left' | 'right';
5914
readonly outsideDistance: number;
5915
}
5916
5917
/**
5918
* Target hit with the mouse in the editor.
5919
*/
5920
export type IMouseTarget = (IMouseTargetUnknown | IMouseTargetTextarea | IMouseTargetMargin | IMouseTargetViewZone | IMouseTargetContentText | IMouseTargetContentEmpty | IMouseTargetContentWidget | IMouseTargetOverlayWidget | IMouseTargetScrollbar | IMouseTargetOverviewRuler | IMouseTargetOutsideEditor);
5921
5922
/**
5923
* A mouse event originating from the editor.
5924
*/
5925
export interface IEditorMouseEvent {
5926
readonly event: IMouseEvent;
5927
readonly target: IMouseTarget;
5928
}
5929
5930
export interface IPartialEditorMouseEvent {
5931
readonly event: IMouseEvent;
5932
readonly target: IMouseTarget | null;
5933
}
5934
5935
/**
5936
* A paste event originating from the editor.
5937
*/
5938
export interface IPasteEvent {
5939
readonly range: Range;
5940
readonly languageId: string | null;
5941
readonly clipboardEvent?: ClipboardEvent;
5942
}
5943
5944
export interface IDiffEditorConstructionOptions extends IDiffEditorOptions, IEditorConstructionOptions {
5945
/**
5946
* Place overflow widgets inside an external DOM node.
5947
* Defaults to an internal DOM node.
5948
*/
5949
overflowWidgetsDomNode?: HTMLElement;
5950
/**
5951
* Aria label for original editor.
5952
*/
5953
originalAriaLabel?: string;
5954
/**
5955
* Aria label for modified editor.
5956
*/
5957
modifiedAriaLabel?: string;
5958
}
5959
5960
/**
5961
* A rich code editor.
5962
*/
5963
export interface ICodeEditor extends IEditor {
5964
/**
5965
* An event emitted when the content of the current model has changed.
5966
* @event
5967
*/
5968
readonly onDidChangeModelContent: IEvent<IModelContentChangedEvent>;
5969
/**
5970
* An event emitted when the language of the current model has changed.
5971
* @event
5972
*/
5973
readonly onDidChangeModelLanguage: IEvent<IModelLanguageChangedEvent>;
5974
/**
5975
* An event emitted when the language configuration of the current model has changed.
5976
* @event
5977
*/
5978
readonly onDidChangeModelLanguageConfiguration: IEvent<IModelLanguageConfigurationChangedEvent>;
5979
/**
5980
* An event emitted when the options of the current model has changed.
5981
* @event
5982
*/
5983
readonly onDidChangeModelOptions: IEvent<IModelOptionsChangedEvent>;
5984
/**
5985
* An event emitted when the configuration of the editor has changed. (e.g. `editor.updateOptions()`)
5986
* @event
5987
*/
5988
readonly onDidChangeConfiguration: IEvent<ConfigurationChangedEvent>;
5989
/**
5990
* An event emitted when the cursor position has changed.
5991
* @event
5992
*/
5993
readonly onDidChangeCursorPosition: IEvent<ICursorPositionChangedEvent>;
5994
/**
5995
* An event emitted when the cursor selection has changed.
5996
* @event
5997
*/
5998
readonly onDidChangeCursorSelection: IEvent<ICursorSelectionChangedEvent>;
5999
/**
6000
* An event emitted when the model of this editor is about to change (e.g. from `editor.setModel()`).
6001
* @event
6002
*/
6003
readonly onWillChangeModel: IEvent<IModelChangedEvent>;
6004
/**
6005
* An event emitted when the model of this editor has changed (e.g. `editor.setModel()`).
6006
* @event
6007
*/
6008
readonly onDidChangeModel: IEvent<IModelChangedEvent>;
6009
/**
6010
* An event emitted when the decorations of the current model have changed.
6011
* @event
6012
*/
6013
readonly onDidChangeModelDecorations: IEvent<IModelDecorationsChangedEvent>;
6014
/**
6015
* An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking).
6016
* @event
6017
*/
6018
readonly onDidFocusEditorText: IEvent<void>;
6019
/**
6020
* An event emitted when the text inside this editor lost focus (i.e. cursor stops blinking).
6021
* @event
6022
*/
6023
readonly onDidBlurEditorText: IEvent<void>;
6024
/**
6025
* An event emitted when the text inside this editor or an editor widget gained focus.
6026
* @event
6027
*/
6028
readonly onDidFocusEditorWidget: IEvent<void>;
6029
/**
6030
* An event emitted when the text inside this editor or an editor widget lost focus.
6031
* @event
6032
*/
6033
readonly onDidBlurEditorWidget: IEvent<void>;
6034
/**
6035
* Boolean indicating whether input is in composition
6036
*/
6037
readonly inComposition: boolean;
6038
/**
6039
* An event emitted after composition has started.
6040
*/
6041
readonly onDidCompositionStart: IEvent<void>;
6042
/**
6043
* An event emitted after composition has ended.
6044
*/
6045
readonly onDidCompositionEnd: IEvent<void>;
6046
/**
6047
* An event emitted when editing failed because the editor is read-only.
6048
* @event
6049
*/
6050
readonly onDidAttemptReadOnlyEdit: IEvent<void>;
6051
/**
6052
* An event emitted when users paste text in the editor.
6053
* @event
6054
*/
6055
readonly onDidPaste: IEvent<IPasteEvent>;
6056
/**
6057
* An event emitted on a "mouseup".
6058
* @event
6059
*/
6060
readonly onMouseUp: IEvent<IEditorMouseEvent>;
6061
/**
6062
* An event emitted on a "mousedown".
6063
* @event
6064
*/
6065
readonly onMouseDown: IEvent<IEditorMouseEvent>;
6066
/**
6067
* An event emitted on a "contextmenu".
6068
* @event
6069
*/
6070
readonly onContextMenu: IEvent<IEditorMouseEvent>;
6071
/**
6072
* An event emitted on a "mousemove".
6073
* @event
6074
*/
6075
readonly onMouseMove: IEvent<IEditorMouseEvent>;
6076
/**
6077
* An event emitted on a "mouseleave".
6078
* @event
6079
*/
6080
readonly onMouseLeave: IEvent<IPartialEditorMouseEvent>;
6081
/**
6082
* An event emitted on a "keyup".
6083
* @event
6084
*/
6085
readonly onKeyUp: IEvent<IKeyboardEvent>;
6086
/**
6087
* An event emitted on a "keydown".
6088
* @event
6089
*/
6090
readonly onKeyDown: IEvent<IKeyboardEvent>;
6091
/**
6092
* An event emitted when the layout of the editor has changed.
6093
* @event
6094
*/
6095
readonly onDidLayoutChange: IEvent<EditorLayoutInfo>;
6096
/**
6097
* An event emitted when the content width or content height in the editor has changed.
6098
* @event
6099
*/
6100
readonly onDidContentSizeChange: IEvent<IContentSizeChangedEvent>;
6101
/**
6102
* An event emitted when the scroll in the editor has changed.
6103
* @event
6104
*/
6105
readonly onDidScrollChange: IEvent<IScrollEvent>;
6106
/**
6107
* An event emitted when hidden areas change in the editor (e.g. due to folding).
6108
* @event
6109
*/
6110
readonly onDidChangeHiddenAreas: IEvent<void>;
6111
/**
6112
* Some editor operations fire multiple events at once.
6113
* To allow users to react to multiple events fired by a single operation,
6114
* the editor fires a begin update before the operation and an end update after the operation.
6115
* Whenever the editor fires `onBeginUpdate`, it will also fire `onEndUpdate` once the operation finishes.
6116
* Note that not all operations are bracketed by `onBeginUpdate` and `onEndUpdate`.
6117
*/
6118
readonly onBeginUpdate: IEvent<void>;
6119
/**
6120
* Fires after the editor completes the operation it fired `onBeginUpdate` for.
6121
*/
6122
readonly onEndUpdate: IEvent<void>;
6123
/**
6124
* Saves current view state of the editor in a serializable object.
6125
*/
6126
saveViewState(): ICodeEditorViewState | null;
6127
/**
6128
* Restores the view state of the editor from a serializable object generated by `saveViewState`.
6129
*/
6130
restoreViewState(state: ICodeEditorViewState | null): void;
6131
/**
6132
* Returns true if the text inside this editor or an editor widget has focus.
6133
*/
6134
hasWidgetFocus(): boolean;
6135
/**
6136
* Get a contribution of this editor.
6137
* @id Unique identifier of the contribution.
6138
* @return The contribution or null if contribution not found.
6139
*/
6140
getContribution<T extends IEditorContribution>(id: string): T | null;
6141
/**
6142
* Type the getModel() of IEditor.
6143
*/
6144
getModel(): ITextModel | null;
6145
/**
6146
* Sets the current model attached to this editor.
6147
* If the previous model was created by the editor via the value key in the options
6148
* literal object, it will be destroyed. Otherwise, if the previous model was set
6149
* via setModel, or the model key in the options literal object, the previous model
6150
* will not be destroyed.
6151
* It is safe to call setModel(null) to simply detach the current model from the editor.
6152
*/
6153
setModel(model: ITextModel | null): void;
6154
/**
6155
* Gets all the editor computed options.
6156
*/
6157
getOptions(): IComputedEditorOptions;
6158
/**
6159
* Gets a specific editor option.
6160
*/
6161
getOption<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T>;
6162
/**
6163
* Returns the editor's configuration (without any validation or defaults).
6164
*/
6165
getRawOptions(): IEditorOptions;
6166
/**
6167
* Get value of the current model attached to this editor.
6168
* @see {@link ITextModel.getValue}
6169
*/
6170
getValue(options?: {
6171
preserveBOM: boolean;
6172
lineEnding: string;
6173
}): string;
6174
/**
6175
* Set the value of the current model attached to this editor.
6176
* @see {@link ITextModel.setValue}
6177
*/
6178
setValue(newValue: string): void;
6179
/**
6180
* Get the width of the editor's content.
6181
* This is information that is "erased" when computing `scrollWidth = Math.max(contentWidth, width)`
6182
*/
6183
getContentWidth(): number;
6184
/**
6185
* Get the scrollWidth of the editor's viewport.
6186
*/
6187
getScrollWidth(): number;
6188
/**
6189
* Get the scrollLeft of the editor's viewport.
6190
*/
6191
getScrollLeft(): number;
6192
/**
6193
* Get the height of the editor's content.
6194
* This is information that is "erased" when computing `scrollHeight = Math.max(contentHeight, height)`
6195
*/
6196
getContentHeight(): number;
6197
/**
6198
* Get the scrollHeight of the editor's viewport.
6199
*/
6200
getScrollHeight(): number;
6201
/**
6202
* Get the scrollTop of the editor's viewport.
6203
*/
6204
getScrollTop(): number;
6205
/**
6206
* Change the scrollLeft of the editor's viewport.
6207
*/
6208
setScrollLeft(newScrollLeft: number, scrollType?: ScrollType): void;
6209
/**
6210
* Change the scrollTop of the editor's viewport.
6211
*/
6212
setScrollTop(newScrollTop: number, scrollType?: ScrollType): void;
6213
/**
6214
* Change the scroll position of the editor's viewport.
6215
*/
6216
setScrollPosition(position: INewScrollPosition, scrollType?: ScrollType): void;
6217
/**
6218
* Check if the editor is currently scrolling towards a different scroll position.
6219
*/
6220
hasPendingScrollAnimation(): boolean;
6221
/**
6222
* Get an action that is a contribution to this editor.
6223
* @id Unique identifier of the contribution.
6224
* @return The action or null if action not found.
6225
*/
6226
getAction(id: string): IEditorAction | null;
6227
/**
6228
* Execute a command on the editor.
6229
* The edits will land on the undo-redo stack, but no "undo stop" will be pushed.
6230
* @param source The source of the call.
6231
* @param command The command to execute
6232
*/
6233
executeCommand(source: string | null | undefined, command: ICommand): void;
6234
/**
6235
* Create an "undo stop" in the undo-redo stack.
6236
*/
6237
pushUndoStop(): boolean;
6238
/**
6239
* Remove the "undo stop" in the undo-redo stack.
6240
*/
6241
popUndoStop(): boolean;
6242
/**
6243
* Execute edits on the editor.
6244
* The edits will land on the undo-redo stack, but no "undo stop" will be pushed.
6245
* @param source The source of the call.
6246
* @param edits The edits to execute.
6247
* @param endCursorState Cursor state after the edits were applied.
6248
*/
6249
executeEdits(source: string | null | undefined, edits: IIdentifiedSingleEditOperation[], endCursorState?: ICursorStateComputer | Selection[]): boolean;
6250
/**
6251
* Execute multiple (concomitant) commands on the editor.
6252
* @param source The source of the call.
6253
* @param command The commands to execute
6254
*/
6255
executeCommands(source: string | null | undefined, commands: (ICommand | null)[]): void;
6256
/**
6257
* Get all the decorations on a line (filtering out decorations from other editors).
6258
*/
6259
getLineDecorations(lineNumber: number): IModelDecoration[] | null;
6260
/**
6261
* Get all the decorations for a range (filtering out decorations from other editors).
6262
*/
6263
getDecorationsInRange(range: Range): IModelDecoration[] | null;
6264
/**
6265
* Get the font size at a given position
6266
* @param position the position for which to fetch the font size
6267
*/
6268
getFontSizeAtPosition(position: IPosition): string | null;
6269
/**
6270
* All decorations added through this call will get the ownerId of this editor.
6271
* @deprecated Use `createDecorationsCollection`
6272
* @see createDecorationsCollection
6273
*/
6274
deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[];
6275
/**
6276
* Remove previously added decorations.
6277
*/
6278
removeDecorations(decorationIds: string[]): void;
6279
/**
6280
* Get the layout info for the editor.
6281
*/
6282
getLayoutInfo(): EditorLayoutInfo;
6283
/**
6284
* Returns the ranges that are currently visible.
6285
* Does not account for horizontal scrolling.
6286
*/
6287
getVisibleRanges(): Range[];
6288
/**
6289
* Get the vertical position (top offset) for the line's top w.r.t. to the first line.
6290
*/
6291
getTopForLineNumber(lineNumber: number, includeViewZones?: boolean): number;
6292
/**
6293
* Get the vertical position (top offset) for the line's bottom w.r.t. to the first line.
6294
*/
6295
getBottomForLineNumber(lineNumber: number): number;
6296
/**
6297
* Get the vertical position (top offset) for the position w.r.t. to the first line.
6298
*/
6299
getTopForPosition(lineNumber: number, column: number): number;
6300
/**
6301
* Get the line height for a model position.
6302
*/
6303
getLineHeightForPosition(position: IPosition): number;
6304
/**
6305
* Write the screen reader content to be the current selection
6306
*/
6307
writeScreenReaderContent(reason: string): void;
6308
/**
6309
* Returns the editor's container dom node
6310
*/
6311
getContainerDomNode(): HTMLElement;
6312
/**
6313
* Returns the editor's dom node
6314
*/
6315
getDomNode(): HTMLElement | null;
6316
/**
6317
* Add a content widget. Widgets must have unique ids, otherwise they will be overwritten.
6318
*/
6319
addContentWidget(widget: IContentWidget): void;
6320
/**
6321
* Layout/Reposition a content widget. This is a ping to the editor to call widget.getPosition()
6322
* and update appropriately.
6323
*/
6324
layoutContentWidget(widget: IContentWidget): void;
6325
/**
6326
* Remove a content widget.
6327
*/
6328
removeContentWidget(widget: IContentWidget): void;
6329
/**
6330
* Add an overlay widget. Widgets must have unique ids, otherwise they will be overwritten.
6331
*/
6332
addOverlayWidget(widget: IOverlayWidget): void;
6333
/**
6334
* Layout/Reposition an overlay widget. This is a ping to the editor to call widget.getPosition()
6335
* and update appropriately.
6336
*/
6337
layoutOverlayWidget(widget: IOverlayWidget): void;
6338
/**
6339
* Remove an overlay widget.
6340
*/
6341
removeOverlayWidget(widget: IOverlayWidget): void;
6342
/**
6343
* Add a glyph margin widget. Widgets must have unique ids, otherwise they will be overwritten.
6344
*/
6345
addGlyphMarginWidget(widget: IGlyphMarginWidget): void;
6346
/**
6347
* Layout/Reposition a glyph margin widget. This is a ping to the editor to call widget.getPosition()
6348
* and update appropriately.
6349
*/
6350
layoutGlyphMarginWidget(widget: IGlyphMarginWidget): void;
6351
/**
6352
* Remove a glyph margin widget.
6353
*/
6354
removeGlyphMarginWidget(widget: IGlyphMarginWidget): void;
6355
/**
6356
* Change the view zones. View zones are lost when a new model is attached to the editor.
6357
*/
6358
changeViewZones(callback: (accessor: IViewZoneChangeAccessor) => void): void;
6359
/**
6360
* Get the horizontal position (left offset) for the column w.r.t to the beginning of the line.
6361
* This method works only if the line `lineNumber` is currently rendered (in the editor's viewport).
6362
* Use this method with caution.
6363
*/
6364
getOffsetForColumn(lineNumber: number, column: number): number;
6365
/**
6366
* Force an editor render now.
6367
*/
6368
render(forceRedraw?: boolean): void;
6369
/**
6370
* Get the hit test target at coordinates `clientX` and `clientY`.
6371
* The coordinates are relative to the top-left of the viewport.
6372
*
6373
* @returns Hit test target or null if the coordinates fall outside the editor or the editor has no model.
6374
*/
6375
getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget | null;
6376
/**
6377
* Get the visible position for `position`.
6378
* The result position takes scrolling into account and is relative to the top left corner of the editor.
6379
* Explanation 1: the results of this method will change for the same `position` if the user scrolls the editor.
6380
* Explanation 2: the results of this method will not change if the container of the editor gets repositioned.
6381
* Warning: the results of this method are inaccurate for positions that are outside the current editor viewport.
6382
*/
6383
getScrolledVisiblePosition(position: IPosition): {
6384
top: number;
6385
left: number;
6386
height: number;
6387
} | null;
6388
/**
6389
* Apply the same font settings as the editor to `target`.
6390
*/
6391
applyFontInfo(target: HTMLElement): void;
6392
setBanner(bannerDomNode: HTMLElement | null, height: number): void;
6393
/**
6394
* Is called when the model has been set, view state was restored and options are updated.
6395
* This is the best place to compute data for the viewport (such as tokens).
6396
*/
6397
handleInitialized?(): void;
6398
}
6399
6400
/**
6401
* A rich diff editor.
6402
*/
6403
export interface IDiffEditor extends IEditor {
6404
/**
6405
* @see {@link ICodeEditor.getContainerDomNode}
6406
*/
6407
getContainerDomNode(): HTMLElement;
6408
/**
6409
* An event emitted when the diff information computed by this diff editor has been updated.
6410
* @event
6411
*/
6412
readonly onDidUpdateDiff: IEvent<void>;
6413
/**
6414
* An event emitted when the diff model is changed (i.e. the diff editor shows new content).
6415
* @event
6416
*/
6417
readonly onDidChangeModel: IEvent<void>;
6418
/**
6419
* Saves current view state of the editor in a serializable object.
6420
*/
6421
saveViewState(): IDiffEditorViewState | null;
6422
/**
6423
* Restores the view state of the editor from a serializable object generated by `saveViewState`.
6424
*/
6425
restoreViewState(state: IDiffEditorViewState | null): void;
6426
/**
6427
* Type the getModel() of IEditor.
6428
*/
6429
getModel(): IDiffEditorModel | null;
6430
createViewModel(model: IDiffEditorModel): IDiffEditorViewModel;
6431
/**
6432
* Sets the current model attached to this editor.
6433
* If the previous model was created by the editor via the value key in the options
6434
* literal object, it will be destroyed. Otherwise, if the previous model was set
6435
* via setModel, or the model key in the options literal object, the previous model
6436
* will not be destroyed.
6437
* It is safe to call setModel(null) to simply detach the current model from the editor.
6438
*/
6439
setModel(model: IDiffEditorModel | IDiffEditorViewModel | null): void;
6440
/**
6441
* Get the `original` editor.
6442
*/
6443
getOriginalEditor(): ICodeEditor;
6444
/**
6445
* Get the `modified` editor.
6446
*/
6447
getModifiedEditor(): ICodeEditor;
6448
/**
6449
* Get the computed diff information.
6450
*/
6451
getLineChanges(): ILineChange[] | null;
6452
/**
6453
* Update the editor's options after the editor has been created.
6454
*/
6455
updateOptions(newOptions: IDiffEditorOptions): void;
6456
/**
6457
* Jumps to the next or previous diff.
6458
*/
6459
goToDiff(target: 'next' | 'previous'): void;
6460
/**
6461
* Scrolls to the first diff.
6462
* (Waits until the diff computation finished.)
6463
*/
6464
revealFirstDiff(): unknown;
6465
accessibleDiffViewerNext(): void;
6466
accessibleDiffViewerPrev(): void;
6467
handleInitialized(): void;
6468
}
6469
6470
export class FontInfo extends BareFontInfo {
6471
readonly _editorStylingBrand: void;
6472
readonly version: number;
6473
readonly isTrusted: boolean;
6474
readonly isMonospace: boolean;
6475
readonly typicalHalfwidthCharacterWidth: number;
6476
readonly typicalFullwidthCharacterWidth: number;
6477
readonly canUseHalfwidthRightwardsArrow: boolean;
6478
readonly spaceWidth: number;
6479
readonly middotWidth: number;
6480
readonly wsmiddotWidth: number;
6481
readonly maxDigitWidth: number;
6482
}
6483
6484
export class BareFontInfo {
6485
readonly _bareFontInfoBrand: void;
6486
readonly pixelRatio: number;
6487
readonly fontFamily: string;
6488
readonly fontWeight: string;
6489
readonly fontSize: number;
6490
readonly fontFeatureSettings: string;
6491
readonly fontVariationSettings: string;
6492
readonly lineHeight: number;
6493
readonly letterSpacing: number;
6494
}
6495
6496
export const EditorZoom: IEditorZoom;
6497
6498
export interface IEditorZoom {
6499
onDidChangeZoomLevel: IEvent<number>;
6500
getZoomLevel(): number;
6501
setZoomLevel(zoomLevel: number): void;
6502
}
6503
6504
//compatibility:
6505
export type IReadOnlyModel = ITextModel;
6506
export type IModel = ITextModel;
6507
}
6508
6509
declare namespace monaco.languages {
6510
6511
export interface IRelativePattern {
6512
/**
6513
* A base file path to which this pattern will be matched against relatively.
6514
*/
6515
readonly base: string;
6516
/**
6517
* A file glob pattern like `*.{ts,js}` that will be matched on file paths
6518
* relative to the base path.
6519
*
6520
* Example: Given a base of `/home/work/folder` and a file path of `/home/work/folder/index.js`,
6521
* the file glob pattern will match on `index.js`.
6522
*/
6523
readonly pattern: string;
6524
}
6525
6526
export type LanguageSelector = string | LanguageFilter | ReadonlyArray<string | LanguageFilter>;
6527
6528
export interface LanguageFilter {
6529
readonly language?: string;
6530
readonly scheme?: string;
6531
readonly pattern?: string | IRelativePattern;
6532
readonly notebookType?: string;
6533
/**
6534
* This provider is implemented in the UI thread.
6535
*/
6536
readonly hasAccessToAllModels?: boolean;
6537
readonly exclusive?: boolean;
6538
/**
6539
* This provider comes from a builtin extension.
6540
*/
6541
readonly isBuiltin?: boolean;
6542
}
6543
6544
/**
6545
* Register information about a new language.
6546
*/
6547
export function register(language: ILanguageExtensionPoint): void;
6548
6549
/**
6550
* Get the information of all the registered languages.
6551
*/
6552
export function getLanguages(): ILanguageExtensionPoint[];
6553
6554
export function getEncodedLanguageId(languageId: string): number;
6555
6556
/**
6557
* An event emitted when a language is associated for the first time with a text model.
6558
* @event
6559
*/
6560
export function onLanguage(languageId: string, callback: () => void): IDisposable;
6561
6562
/**
6563
* An event emitted when a language is associated for the first time with a text model or
6564
* when a language is encountered during the tokenization of another language.
6565
* @event
6566
*/
6567
export function onLanguageEncountered(languageId: string, callback: () => void): IDisposable;
6568
6569
/**
6570
* Set the editing configuration for a language.
6571
*/
6572
export function setLanguageConfiguration(languageId: string, configuration: LanguageConfiguration): IDisposable;
6573
6574
/**
6575
* A token.
6576
*/
6577
export interface IToken {
6578
startIndex: number;
6579
scopes: string;
6580
}
6581
6582
/**
6583
* The result of a line tokenization.
6584
*/
6585
export interface ILineTokens {
6586
/**
6587
* The list of tokens on the line.
6588
*/
6589
tokens: IToken[];
6590
/**
6591
* The tokenization end state.
6592
* A pointer will be held to this and the object should not be modified by the tokenizer after the pointer is returned.
6593
*/
6594
endState: IState;
6595
}
6596
6597
/**
6598
* The result of a line tokenization.
6599
*/
6600
export interface IEncodedLineTokens {
6601
/**
6602
* The tokens on the line in a binary, encoded format. Each token occupies two array indices. For token i:
6603
* - at offset 2*i => startIndex
6604
* - at offset 2*i + 1 => metadata
6605
* Meta data is in binary format:
6606
* - -------------------------------------------
6607
* 3322 2222 2222 1111 1111 1100 0000 0000
6608
* 1098 7654 3210 9876 5432 1098 7654 3210
6609
* - -------------------------------------------
6610
* bbbb bbbb bfff ffff ffFF FFTT LLLL LLLL
6611
* - -------------------------------------------
6612
* - L = EncodedLanguageId (8 bits): Use `getEncodedLanguageId` to get the encoded ID of a language.
6613
* - T = StandardTokenType (2 bits): Other = 0, Comment = 1, String = 2, RegEx = 3.
6614
* - F = FontStyle (4 bits): None = 0, Italic = 1, Bold = 2, Underline = 4, Strikethrough = 8.
6615
* - f = foreground ColorId (9 bits)
6616
* - b = background ColorId (9 bits)
6617
* - The color value for each colorId is defined in IStandaloneThemeData.customTokenColors:
6618
* e.g. colorId = 1 is stored in IStandaloneThemeData.customTokenColors[1]. Color id = 0 means no color,
6619
* id = 1 is for the default foreground color, id = 2 for the default background.
6620
*/
6621
tokens: Uint32Array;
6622
/**
6623
* The tokenization end state.
6624
* A pointer will be held to this and the object should not be modified by the tokenizer after the pointer is returned.
6625
*/
6626
endState: IState;
6627
}
6628
6629
/**
6630
* A factory for token providers.
6631
*/
6632
export interface TokensProviderFactory {
6633
create(): ProviderResult<TokensProvider | EncodedTokensProvider | IMonarchLanguage>;
6634
}
6635
6636
/**
6637
* A "manual" provider of tokens.
6638
*/
6639
export interface TokensProvider {
6640
/**
6641
* The initial state of a language. Will be the state passed in to tokenize the first line.
6642
*/
6643
getInitialState(): IState;
6644
/**
6645
* Tokenize a line given the state at the beginning of the line.
6646
*/
6647
tokenize(line: string, state: IState): ILineTokens;
6648
}
6649
6650
/**
6651
* A "manual" provider of tokens, returning tokens in a binary form.
6652
*/
6653
export interface EncodedTokensProvider {
6654
/**
6655
* The initial state of a language. Will be the state passed in to tokenize the first line.
6656
*/
6657
getInitialState(): IState;
6658
/**
6659
* Tokenize a line given the state at the beginning of the line.
6660
*/
6661
tokenizeEncoded(line: string, state: IState): IEncodedLineTokens;
6662
/**
6663
* Tokenize a line given the state at the beginning of the line.
6664
*/
6665
tokenize?(line: string, state: IState): ILineTokens;
6666
}
6667
6668
/**
6669
* Change the color map that is used for token colors.
6670
* Supported formats (hex): #RRGGBB, $RRGGBBAA, #RGB, #RGBA
6671
*/
6672
export function setColorMap(colorMap: string[] | null): void;
6673
6674
/**
6675
* Register a tokens provider factory for a language. This tokenizer will be exclusive with a tokenizer
6676
* set using `setTokensProvider` or one created using `setMonarchTokensProvider`, but will work together
6677
* with a tokens provider set using `registerDocumentSemanticTokensProvider` or `registerDocumentRangeSemanticTokensProvider`.
6678
*/
6679
export function registerTokensProviderFactory(languageId: string, factory: TokensProviderFactory): IDisposable;
6680
6681
/**
6682
* Set the tokens provider for a language (manual implementation). This tokenizer will be exclusive
6683
* with a tokenizer created using `setMonarchTokensProvider`, or with `registerTokensProviderFactory`,
6684
* but will work together with a tokens provider set using `registerDocumentSemanticTokensProvider`
6685
* or `registerDocumentRangeSemanticTokensProvider`.
6686
*/
6687
export function setTokensProvider(languageId: string, provider: TokensProvider | EncodedTokensProvider | Thenable<TokensProvider | EncodedTokensProvider>): IDisposable;
6688
6689
/**
6690
* Set the tokens provider for a language (monarch implementation). This tokenizer will be exclusive
6691
* with a tokenizer set using `setTokensProvider`, or with `registerTokensProviderFactory`, but will
6692
* work together with a tokens provider set using `registerDocumentSemanticTokensProvider` or
6693
* `registerDocumentRangeSemanticTokensProvider`.
6694
*/
6695
export function setMonarchTokensProvider(languageId: string, languageDef: IMonarchLanguage | Thenable<IMonarchLanguage>): IDisposable;
6696
6697
/**
6698
* Register a reference provider (used by e.g. reference search).
6699
*/
6700
export function registerReferenceProvider(languageSelector: LanguageSelector, provider: ReferenceProvider): IDisposable;
6701
6702
/**
6703
* Register a rename provider (used by e.g. rename symbol).
6704
*/
6705
export function registerRenameProvider(languageSelector: LanguageSelector, provider: RenameProvider): IDisposable;
6706
6707
/**
6708
* Register a new symbol-name provider (e.g., when a symbol is being renamed, show new possible symbol-names)
6709
*/
6710
export function registerNewSymbolNameProvider(languageSelector: LanguageSelector, provider: NewSymbolNamesProvider): IDisposable;
6711
6712
/**
6713
* Register a signature help provider (used by e.g. parameter hints).
6714
*/
6715
export function registerSignatureHelpProvider(languageSelector: LanguageSelector, provider: SignatureHelpProvider): IDisposable;
6716
6717
/**
6718
* Register a hover provider (used by e.g. editor hover).
6719
*/
6720
export function registerHoverProvider(languageSelector: LanguageSelector, provider: HoverProvider): IDisposable;
6721
6722
/**
6723
* Register a document symbol provider (used by e.g. outline).
6724
*/
6725
export function registerDocumentSymbolProvider(languageSelector: LanguageSelector, provider: DocumentSymbolProvider): IDisposable;
6726
6727
/**
6728
* Register a document highlight provider (used by e.g. highlight occurrences).
6729
*/
6730
export function registerDocumentHighlightProvider(languageSelector: LanguageSelector, provider: DocumentHighlightProvider): IDisposable;
6731
6732
/**
6733
* Register an linked editing range provider.
6734
*/
6735
export function registerLinkedEditingRangeProvider(languageSelector: LanguageSelector, provider: LinkedEditingRangeProvider): IDisposable;
6736
6737
/**
6738
* Register a definition provider (used by e.g. go to definition).
6739
*/
6740
export function registerDefinitionProvider(languageSelector: LanguageSelector, provider: DefinitionProvider): IDisposable;
6741
6742
/**
6743
* Register a implementation provider (used by e.g. go to implementation).
6744
*/
6745
export function registerImplementationProvider(languageSelector: LanguageSelector, provider: ImplementationProvider): IDisposable;
6746
6747
/**
6748
* Register a type definition provider (used by e.g. go to type definition).
6749
*/
6750
export function registerTypeDefinitionProvider(languageSelector: LanguageSelector, provider: TypeDefinitionProvider): IDisposable;
6751
6752
/**
6753
* Register a code lens provider (used by e.g. inline code lenses).
6754
*/
6755
export function registerCodeLensProvider(languageSelector: LanguageSelector, provider: CodeLensProvider): IDisposable;
6756
6757
/**
6758
* Register a code action provider (used by e.g. quick fix).
6759
*/
6760
export function registerCodeActionProvider(languageSelector: LanguageSelector, provider: CodeActionProvider, metadata?: CodeActionProviderMetadata): IDisposable;
6761
6762
/**
6763
* Register a formatter that can handle only entire models.
6764
*/
6765
export function registerDocumentFormattingEditProvider(languageSelector: LanguageSelector, provider: DocumentFormattingEditProvider): IDisposable;
6766
6767
/**
6768
* Register a formatter that can handle a range inside a model.
6769
*/
6770
export function registerDocumentRangeFormattingEditProvider(languageSelector: LanguageSelector, provider: DocumentRangeFormattingEditProvider): IDisposable;
6771
6772
/**
6773
* Register a formatter than can do formatting as the user types.
6774
*/
6775
export function registerOnTypeFormattingEditProvider(languageSelector: LanguageSelector, provider: OnTypeFormattingEditProvider): IDisposable;
6776
6777
/**
6778
* Register a link provider that can find links in text.
6779
*/
6780
export function registerLinkProvider(languageSelector: LanguageSelector, provider: LinkProvider): IDisposable;
6781
6782
/**
6783
* Register a completion item provider (use by e.g. suggestions).
6784
*/
6785
export function registerCompletionItemProvider(languageSelector: LanguageSelector, provider: CompletionItemProvider): IDisposable;
6786
6787
/**
6788
* Register a document color provider (used by Color Picker, Color Decorator).
6789
*/
6790
export function registerColorProvider(languageSelector: LanguageSelector, provider: DocumentColorProvider): IDisposable;
6791
6792
/**
6793
* Register a folding range provider
6794
*/
6795
export function registerFoldingRangeProvider(languageSelector: LanguageSelector, provider: FoldingRangeProvider): IDisposable;
6796
6797
/**
6798
* Register a declaration provider
6799
*/
6800
export function registerDeclarationProvider(languageSelector: LanguageSelector, provider: DeclarationProvider): IDisposable;
6801
6802
/**
6803
* Register a selection range provider
6804
*/
6805
export function registerSelectionRangeProvider(languageSelector: LanguageSelector, provider: SelectionRangeProvider): IDisposable;
6806
6807
/**
6808
* Register a document semantic tokens provider. A semantic tokens provider will complement and enhance a
6809
* simple top-down tokenizer. Simple top-down tokenizers can be set either via `setMonarchTokensProvider`
6810
* or `setTokensProvider`.
6811
*
6812
* For the best user experience, register both a semantic tokens provider and a top-down tokenizer.
6813
*/
6814
export function registerDocumentSemanticTokensProvider(languageSelector: LanguageSelector, provider: DocumentSemanticTokensProvider): IDisposable;
6815
6816
/**
6817
* Register a document range semantic tokens provider. A semantic tokens provider will complement and enhance a
6818
* simple top-down tokenizer. Simple top-down tokenizers can be set either via `setMonarchTokensProvider`
6819
* or `setTokensProvider`.
6820
*
6821
* For the best user experience, register both a semantic tokens provider and a top-down tokenizer.
6822
*/
6823
export function registerDocumentRangeSemanticTokensProvider(languageSelector: LanguageSelector, provider: DocumentRangeSemanticTokensProvider): IDisposable;
6824
6825
/**
6826
* Register an inline completions provider.
6827
*/
6828
export function registerInlineCompletionsProvider(languageSelector: LanguageSelector, provider: InlineCompletionsProvider): IDisposable;
6829
6830
/**
6831
* Register an inlay hints provider.
6832
*/
6833
export function registerInlayHintsProvider(languageSelector: LanguageSelector, provider: InlayHintsProvider): IDisposable;
6834
6835
/**
6836
* Contains additional diagnostic information about the context in which
6837
* a [code action](#CodeActionProvider.provideCodeActions) is run.
6838
*/
6839
export interface CodeActionContext {
6840
/**
6841
* An array of diagnostics.
6842
*/
6843
readonly markers: editor.IMarkerData[];
6844
/**
6845
* Requested kind of actions to return.
6846
*/
6847
readonly only?: string;
6848
/**
6849
* The reason why code actions were requested.
6850
*/
6851
readonly trigger: CodeActionTriggerType;
6852
}
6853
6854
/**
6855
* The code action interface defines the contract between extensions and
6856
* the [light bulb](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) feature.
6857
*/
6858
export interface CodeActionProvider {
6859
/**
6860
* Provide commands for the given document and range.
6861
*/
6862
provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): ProviderResult<CodeActionList>;
6863
/**
6864
* Given a code action fill in the edit. Will only invoked when missing.
6865
*/
6866
resolveCodeAction?(codeAction: CodeAction, token: CancellationToken): ProviderResult<CodeAction>;
6867
}
6868
6869
/**
6870
* Metadata about the type of code actions that a {@link CodeActionProvider} provides.
6871
*/
6872
export interface CodeActionProviderMetadata {
6873
/**
6874
* List of code action kinds that a {@link CodeActionProvider} may return.
6875
*
6876
* This list is used to determine if a given `CodeActionProvider` should be invoked or not.
6877
* To avoid unnecessary computation, every `CodeActionProvider` should list use `providedCodeActionKinds`. The
6878
* list of kinds may either be generic, such as `["quickfix", "refactor", "source"]`, or list out every kind provided,
6879
* such as `["quickfix.removeLine", "source.fixAll" ...]`.
6880
*/
6881
readonly providedCodeActionKinds?: readonly string[];
6882
readonly documentation?: ReadonlyArray<{
6883
readonly kind: string;
6884
readonly command: Command;
6885
}>;
6886
}
6887
6888
/**
6889
* Configuration for line comments.
6890
*/
6891
export interface LineCommentConfig {
6892
/**
6893
* The line comment token, like `//`
6894
*/
6895
comment: string;
6896
/**
6897
* Whether the comment token should not be indented and placed at the first column.
6898
* Defaults to false.
6899
*/
6900
noIndent?: boolean;
6901
}
6902
6903
/**
6904
* Describes how comments for a language work.
6905
*/
6906
export interface CommentRule {
6907
/**
6908
* The line comment token, like `// this is a comment`.
6909
* Can be a string or an object with comment and optional noIndent properties.
6910
*/
6911
lineComment?: string | LineCommentConfig | null;
6912
/**
6913
* The block comment character pair, like `/* block comment *&#47;`
6914
*/
6915
blockComment?: CharacterPair | null;
6916
}
6917
6918
/**
6919
* The language configuration interface defines the contract between extensions and
6920
* various editor features, like automatic bracket insertion, automatic indentation etc.
6921
*/
6922
export interface LanguageConfiguration {
6923
/**
6924
* The language's comment settings.
6925
*/
6926
comments?: CommentRule;
6927
/**
6928
* The language's brackets.
6929
* This configuration implicitly affects pressing Enter around these brackets.
6930
*/
6931
brackets?: CharacterPair[];
6932
/**
6933
* The language's word definition.
6934
* If the language supports Unicode identifiers (e.g. JavaScript), it is preferable
6935
* to provide a word definition that uses exclusion of known separators.
6936
* e.g.: A regex that matches anything except known separators (and dot is allowed to occur in a floating point number):
6937
* /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
6938
*/
6939
wordPattern?: RegExp;
6940
/**
6941
* The language's indentation settings.
6942
*/
6943
indentationRules?: IndentationRule;
6944
/**
6945
* The language's rules to be evaluated when pressing Enter.
6946
*/
6947
onEnterRules?: OnEnterRule[];
6948
/**
6949
* The language's auto closing pairs. The 'close' character is automatically inserted with the
6950
* 'open' character is typed. If not set, the configured brackets will be used.
6951
*/
6952
autoClosingPairs?: IAutoClosingPairConditional[];
6953
/**
6954
* The language's surrounding pairs. When the 'open' character is typed on a selection, the
6955
* selected string is surrounded by the open and close characters. If not set, the autoclosing pairs
6956
* settings will be used.
6957
*/
6958
surroundingPairs?: IAutoClosingPair[];
6959
/**
6960
* Defines a list of bracket pairs that are colorized depending on their nesting level.
6961
* If not set, the configured brackets will be used.
6962
*/
6963
colorizedBracketPairs?: CharacterPair[];
6964
/**
6965
* Defines what characters must be after the cursor for bracket or quote autoclosing to occur when using the \'languageDefined\' autoclosing setting.
6966
*
6967
* This is typically the set of characters which can not start an expression, such as whitespace, closing brackets, non-unary operators, etc.
6968
*/
6969
autoCloseBefore?: string;
6970
/**
6971
* The language's folding rules.
6972
*/
6973
folding?: FoldingRules;
6974
/**
6975
* **Deprecated** Do not use.
6976
*
6977
* @deprecated Will be replaced by a better API soon.
6978
*/
6979
__electricCharacterSupport?: {
6980
docComment?: IDocComment;
6981
};
6982
}
6983
6984
/**
6985
* Describes indentation rules for a language.
6986
*/
6987
export interface IndentationRule {
6988
/**
6989
* If a line matches this pattern, then all the lines after it should be unindented once (until another rule matches).
6990
*/
6991
decreaseIndentPattern: RegExp;
6992
/**
6993
* If a line matches this pattern, then all the lines after it should be indented once (until another rule matches).
6994
*/
6995
increaseIndentPattern: RegExp;
6996
/**
6997
* If a line matches this pattern, then **only the next line** after it should be indented once.
6998
*/
6999
indentNextLinePattern?: RegExp | null;
7000
/**
7001
* If a line matches this pattern, then its indentation should not be changed and it should not be evaluated against the other rules.
7002
*/
7003
unIndentedLinePattern?: RegExp | null;
7004
}
7005
7006
/**
7007
* Describes language specific folding markers such as '#region' and '#endregion'.
7008
* The start and end regexes will be tested against the contents of all lines and must be designed efficiently:
7009
* - the regex should start with '^'
7010
* - regexp flags (i, g) are ignored
7011
*/
7012
export interface FoldingMarkers {
7013
start: RegExp;
7014
end: RegExp;
7015
}
7016
7017
/**
7018
* Describes folding rules for a language.
7019
*/
7020
export interface FoldingRules {
7021
/**
7022
* Used by the indentation based strategy to decide whether empty lines belong to the previous or the next block.
7023
* A language adheres to the off-side rule if blocks in that language are expressed by their indentation.
7024
* See [wikipedia](https://en.wikipedia.org/wiki/Off-side_rule) for more information.
7025
* If not set, `false` is used and empty lines belong to the previous block.
7026
*/
7027
offSide?: boolean;
7028
/**
7029
* Region markers used by the language.
7030
*/
7031
markers?: FoldingMarkers;
7032
}
7033
7034
/**
7035
* Describes a rule to be evaluated when pressing Enter.
7036
*/
7037
export interface OnEnterRule {
7038
/**
7039
* This rule will only execute if the text before the cursor matches this regular expression.
7040
*/
7041
beforeText: RegExp;
7042
/**
7043
* This rule will only execute if the text after the cursor matches this regular expression.
7044
*/
7045
afterText?: RegExp;
7046
/**
7047
* This rule will only execute if the text above the this line matches this regular expression.
7048
*/
7049
previousLineText?: RegExp;
7050
/**
7051
* The action to execute.
7052
*/
7053
action: EnterAction;
7054
}
7055
7056
/**
7057
* Definition of documentation comments (e.g. Javadoc/JSdoc)
7058
*/
7059
export interface IDocComment {
7060
/**
7061
* The string that starts a doc comment (e.g. '/**')
7062
*/
7063
open: string;
7064
/**
7065
* The string that appears on the last line and closes the doc comment (e.g. ' * /').
7066
*/
7067
close?: string;
7068
}
7069
7070
/**
7071
* A tuple of two characters, like a pair of
7072
* opening and closing brackets.
7073
*/
7074
export type CharacterPair = [string, string];
7075
7076
export interface IAutoClosingPair {
7077
open: string;
7078
close: string;
7079
}
7080
7081
export interface IAutoClosingPairConditional extends IAutoClosingPair {
7082
notIn?: string[];
7083
}
7084
7085
/**
7086
* Describes what to do with the indentation when pressing Enter.
7087
*/
7088
export enum IndentAction {
7089
/**
7090
* Insert new line and copy the previous line's indentation.
7091
*/
7092
None = 0,
7093
/**
7094
* Insert new line and indent once (relative to the previous line's indentation).
7095
*/
7096
Indent = 1,
7097
/**
7098
* Insert two new lines:
7099
* - the first one indented which will hold the cursor
7100
* - the second one at the same indentation level
7101
*/
7102
IndentOutdent = 2,
7103
/**
7104
* Insert new line and outdent once (relative to the previous line's indentation).
7105
*/
7106
Outdent = 3
7107
}
7108
7109
/**
7110
* Describes what to do when pressing Enter.
7111
*/
7112
export interface EnterAction {
7113
/**
7114
* Describe what to do with the indentation.
7115
*/
7116
indentAction: IndentAction;
7117
/**
7118
* Describes text to be appended after the new line and after the indentation.
7119
*/
7120
appendText?: string;
7121
/**
7122
* Describes the number of characters to remove from the new line's indentation.
7123
*/
7124
removeText?: number;
7125
}
7126
7127
export interface SyntaxNode {
7128
startIndex: number;
7129
endIndex: number;
7130
startPosition: IPosition;
7131
endPosition: IPosition;
7132
}
7133
7134
export interface QueryCapture {
7135
name: string;
7136
text?: string;
7137
node: SyntaxNode;
7138
encodedLanguageId: number;
7139
}
7140
7141
/**
7142
* The state of the tokenizer between two lines.
7143
* It is useful to store flags such as in multiline comment, etc.
7144
* The model will clone the previous line's state and pass it in to tokenize the next line.
7145
*/
7146
export interface IState {
7147
clone(): IState;
7148
equals(other: IState): boolean;
7149
}
7150
7151
/**
7152
* A provider result represents the values a provider, like the {@link HoverProvider},
7153
* may return. For once this is the actual result type `T`, like `Hover`, or a thenable that resolves
7154
* to that type `T`. In addition, `null` and `undefined` can be returned - either directly or from a
7155
* thenable.
7156
*/
7157
export type ProviderResult<T> = T | undefined | null | Thenable<T | undefined | null>;
7158
7159
/**
7160
* A hover represents additional information for a symbol or word. Hovers are
7161
* rendered in a tooltip-like widget.
7162
*/
7163
export interface Hover {
7164
/**
7165
* The contents of this hover.
7166
*/
7167
contents: IMarkdownString[];
7168
/**
7169
* The range to which this hover applies. When missing, the
7170
* editor will use the range at the current position or the
7171
* current position itself.
7172
*/
7173
range?: IRange;
7174
/**
7175
* Can increase the verbosity of the hover
7176
*/
7177
canIncreaseVerbosity?: boolean;
7178
/**
7179
* Can decrease the verbosity of the hover
7180
*/
7181
canDecreaseVerbosity?: boolean;
7182
}
7183
7184
/**
7185
* The hover provider interface defines the contract between extensions and
7186
* the [hover](https://code.visualstudio.com/docs/editor/intellisense)-feature.
7187
*/
7188
export interface HoverProvider<THover = Hover> {
7189
/**
7190
* Provide a hover for the given position, context and document. Multiple hovers at the same
7191
* position will be merged by the editor. A hover can have a range which defaults
7192
* to the word range at the position when omitted.
7193
*/
7194
provideHover(model: editor.ITextModel, position: Position, token: CancellationToken, context?: HoverContext<THover>): ProviderResult<THover>;
7195
}
7196
7197
export interface HoverContext<THover = Hover> {
7198
/**
7199
* Hover verbosity request
7200
*/
7201
verbosityRequest?: HoverVerbosityRequest<THover>;
7202
}
7203
7204
export interface HoverVerbosityRequest<THover = Hover> {
7205
/**
7206
* The delta by which to increase/decrease the hover verbosity level
7207
*/
7208
verbosityDelta: number;
7209
/**
7210
* The previous hover for the same position
7211
*/
7212
previousHover: THover;
7213
}
7214
7215
export enum HoverVerbosityAction {
7216
/**
7217
* Increase the verbosity of the hover
7218
*/
7219
Increase = 0,
7220
/**
7221
* Decrease the verbosity of the hover
7222
*/
7223
Decrease = 1
7224
}
7225
7226
export enum CompletionItemKind {
7227
Method = 0,
7228
Function = 1,
7229
Constructor = 2,
7230
Field = 3,
7231
Variable = 4,
7232
Class = 5,
7233
Struct = 6,
7234
Interface = 7,
7235
Module = 8,
7236
Property = 9,
7237
Event = 10,
7238
Operator = 11,
7239
Unit = 12,
7240
Value = 13,
7241
Constant = 14,
7242
Enum = 15,
7243
EnumMember = 16,
7244
Keyword = 17,
7245
Text = 18,
7246
Color = 19,
7247
File = 20,
7248
Reference = 21,
7249
Customcolor = 22,
7250
Folder = 23,
7251
TypeParameter = 24,
7252
User = 25,
7253
Issue = 26,
7254
Tool = 27,
7255
Snippet = 28
7256
}
7257
7258
export interface CompletionItemLabel {
7259
label: string;
7260
detail?: string;
7261
description?: string;
7262
}
7263
7264
export enum CompletionItemTag {
7265
Deprecated = 1
7266
}
7267
7268
export enum CompletionItemInsertTextRule {
7269
None = 0,
7270
/**
7271
* Adjust whitespace/indentation of multiline insert texts to
7272
* match the current line indentation.
7273
*/
7274
KeepWhitespace = 1,
7275
/**
7276
* `insertText` is a snippet.
7277
*/
7278
InsertAsSnippet = 4
7279
}
7280
7281
export interface CompletionItemRanges {
7282
insert: IRange;
7283
replace: IRange;
7284
}
7285
7286
/**
7287
* A completion item represents a text snippet that is
7288
* proposed to complete text that is being typed.
7289
*/
7290
export interface CompletionItem {
7291
/**
7292
* The label of this completion item. By default
7293
* this is also the text that is inserted when selecting
7294
* this completion.
7295
*/
7296
label: string | CompletionItemLabel;
7297
/**
7298
* The kind of this completion item. Based on the kind
7299
* an icon is chosen by the editor.
7300
*/
7301
kind: CompletionItemKind;
7302
/**
7303
* A modifier to the `kind` which affect how the item
7304
* is rendered, e.g. Deprecated is rendered with a strikeout
7305
*/
7306
tags?: ReadonlyArray<CompletionItemTag>;
7307
/**
7308
* A human-readable string with additional information
7309
* about this item, like type or symbol information.
7310
*/
7311
detail?: string;
7312
/**
7313
* A human-readable string that represents a doc-comment.
7314
*/
7315
documentation?: string | IMarkdownString;
7316
/**
7317
* A string that should be used when comparing this item
7318
* with other items. When `falsy` the {@link CompletionItem.label label}
7319
* is used.
7320
*/
7321
sortText?: string;
7322
/**
7323
* A string that should be used when filtering a set of
7324
* completion items. When `falsy` the {@link CompletionItem.label label}
7325
* is used.
7326
*/
7327
filterText?: string;
7328
/**
7329
* Select this item when showing. *Note* that only one completion item can be selected and
7330
* that the editor decides which item that is. The rule is that the *first* item of those
7331
* that match best is selected.
7332
*/
7333
preselect?: boolean;
7334
/**
7335
* A string or snippet that should be inserted in a document when selecting
7336
* this completion.
7337
*/
7338
insertText: string;
7339
/**
7340
* Additional rules (as bitmask) that should be applied when inserting
7341
* this completion.
7342
*/
7343
insertTextRules?: CompletionItemInsertTextRule;
7344
/**
7345
* A range of text that should be replaced by this completion item.
7346
*
7347
* *Note:* The range must be a {@link Range.isSingleLine single line} and it must
7348
* {@link Range.contains contain} the position at which completion has been {@link CompletionItemProvider.provideCompletionItems requested}.
7349
*/
7350
range: IRange | CompletionItemRanges;
7351
/**
7352
* An optional set of characters that when pressed while this completion is active will accept it first and
7353
* then type that character. *Note* that all commit characters should have `length=1` and that superfluous
7354
* characters will be ignored.
7355
*/
7356
commitCharacters?: string[];
7357
/**
7358
* An optional array of additional text edits that are applied when
7359
* selecting this completion. Edits must not overlap with the main edit
7360
* nor with themselves.
7361
*/
7362
additionalTextEdits?: editor.ISingleEditOperation[];
7363
/**
7364
* A command that should be run upon acceptance of this item.
7365
*/
7366
command?: Command;
7367
/**
7368
* A command that should be run upon acceptance of this item.
7369
*/
7370
action?: Command;
7371
}
7372
7373
export interface CompletionList {
7374
suggestions: CompletionItem[];
7375
incomplete?: boolean;
7376
dispose?(): void;
7377
}
7378
7379
/**
7380
* Info provided on partial acceptance.
7381
*/
7382
export interface PartialAcceptInfo {
7383
kind: PartialAcceptTriggerKind;
7384
acceptedLength: number;
7385
}
7386
7387
/**
7388
* How a partial acceptance was triggered.
7389
*/
7390
export enum PartialAcceptTriggerKind {
7391
Word = 0,
7392
Line = 1,
7393
Suggest = 2
7394
}
7395
7396
/**
7397
* How a suggest provider was triggered.
7398
*/
7399
export enum CompletionTriggerKind {
7400
Invoke = 0,
7401
TriggerCharacter = 1,
7402
TriggerForIncompleteCompletions = 2
7403
}
7404
7405
/**
7406
* Contains additional information about the context in which
7407
* {@link CompletionItemProvider.provideCompletionItems completion provider} is triggered.
7408
*/
7409
export interface CompletionContext {
7410
/**
7411
* How the completion was triggered.
7412
*/
7413
triggerKind: CompletionTriggerKind;
7414
/**
7415
* Character that triggered the completion item provider.
7416
*
7417
* `undefined` if provider was not triggered by a character.
7418
*/
7419
triggerCharacter?: string;
7420
}
7421
7422
/**
7423
* The completion item provider interface defines the contract between extensions and
7424
* the [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense).
7425
*
7426
* When computing *complete* completion items is expensive, providers can optionally implement
7427
* the `resolveCompletionItem`-function. In that case it is enough to return completion
7428
* items with a {@link CompletionItem.label label} from the
7429
* {@link CompletionItemProvider.provideCompletionItems provideCompletionItems}-function. Subsequently,
7430
* when a completion item is shown in the UI and gains focus this provider is asked to resolve
7431
* the item, like adding {@link CompletionItem.documentation doc-comment} or {@link CompletionItem.detail details}.
7432
*/
7433
export interface CompletionItemProvider {
7434
triggerCharacters?: string[];
7435
/**
7436
* Provide completion items for the given position and document.
7437
*/
7438
provideCompletionItems(model: editor.ITextModel, position: Position, context: CompletionContext, token: CancellationToken): ProviderResult<CompletionList>;
7439
/**
7440
* Given a completion item fill in more data, like {@link CompletionItem.documentation doc-comment}
7441
* or {@link CompletionItem.detail details}.
7442
*
7443
* The editor will only resolve a completion item once.
7444
*/
7445
resolveCompletionItem?(item: CompletionItem, token: CancellationToken): ProviderResult<CompletionItem>;
7446
}
7447
7448
/**
7449
* How an {@link InlineCompletionsProvider inline completion provider} was triggered.
7450
*/
7451
export enum InlineCompletionTriggerKind {
7452
/**
7453
* Completion was triggered automatically while editing.
7454
* It is sufficient to return a single completion item in this case.
7455
*/
7456
Automatic = 0,
7457
/**
7458
* Completion was triggered explicitly by a user gesture.
7459
* Return multiple completion items to enable cycling through them.
7460
*/
7461
Explicit = 1
7462
}
7463
7464
export interface InlineCompletionContext {
7465
/**
7466
* How the completion was triggered.
7467
*/
7468
readonly triggerKind: InlineCompletionTriggerKind;
7469
readonly selectedSuggestionInfo: SelectedSuggestionInfo | undefined;
7470
readonly includeInlineEdits: boolean;
7471
readonly includeInlineCompletions: boolean;
7472
readonly requestIssuedDateTime: number;
7473
readonly earliestShownDateTime: number;
7474
}
7475
7476
export class SelectedSuggestionInfo {
7477
readonly range: IRange;
7478
readonly text: string;
7479
readonly completionKind: CompletionItemKind;
7480
readonly isSnippetText: boolean;
7481
constructor(range: IRange, text: string, completionKind: CompletionItemKind, isSnippetText: boolean);
7482
equals(other: SelectedSuggestionInfo): boolean;
7483
}
7484
7485
export interface InlineCompletion {
7486
/**
7487
* The text to insert.
7488
* If the text contains a line break, the range must end at the end of a line.
7489
* If existing text should be replaced, the existing text must be a prefix of the text to insert.
7490
*
7491
* The text can also be a snippet. In that case, a preview with default parameters is shown.
7492
* When accepting the suggestion, the full snippet is inserted.
7493
*/
7494
readonly insertText: string | {
7495
snippet: string;
7496
};
7497
/**
7498
* A text that is used to decide if this inline completion should be shown.
7499
* An inline completion is shown if the text to replace is a subword of the filter text.
7500
*/
7501
readonly filterText?: string;
7502
/**
7503
* An optional array of additional text edits that are applied when
7504
* selecting this completion. Edits must not overlap with the main edit
7505
* nor with themselves.
7506
*/
7507
readonly additionalTextEdits?: editor.ISingleEditOperation[];
7508
/**
7509
* The range to replace.
7510
* Must begin and end on the same line.
7511
*/
7512
readonly range?: IRange;
7513
readonly command?: Command;
7514
readonly action?: Command;
7515
/**
7516
* Is called the first time an inline completion is shown.
7517
* @deprecated. Use `onDidShow` of the provider instead.
7518
*/
7519
readonly shownCommand?: Command;
7520
/**
7521
* If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed.
7522
* Defaults to `false`.
7523
*/
7524
readonly completeBracketPairs?: boolean;
7525
readonly isInlineEdit?: boolean;
7526
readonly showInlineEditMenu?: boolean;
7527
readonly showRange?: IRange;
7528
readonly warning?: InlineCompletionWarning;
7529
readonly displayLocation?: InlineCompletionDisplayLocation;
7530
/**
7531
* Used for telemetry.
7532
*/
7533
readonly correlationId?: string | undefined;
7534
}
7535
7536
export interface InlineCompletionWarning {
7537
message: IMarkdownString | string;
7538
icon?: IconPath;
7539
}
7540
7541
export enum InlineCompletionDisplayLocationKind {
7542
Code = 1,
7543
Label = 2
7544
}
7545
7546
export interface InlineCompletionDisplayLocation {
7547
range: IRange;
7548
kind: InlineCompletionDisplayLocationKind;
7549
label: string;
7550
}
7551
7552
/**
7553
* TODO: add `| Uri | { light: Uri; dark: Uri }`.
7554
*/
7555
export type IconPath = editor.ThemeIcon;
7556
7557
export interface InlineCompletions<TItem extends InlineCompletion = InlineCompletion> {
7558
readonly items: readonly TItem[];
7559
/**
7560
* A list of commands associated with the inline completions of this list.
7561
*/
7562
readonly commands?: InlineCompletionCommand[];
7563
readonly suppressSuggestions?: boolean | undefined;
7564
/**
7565
* When set and the user types a suggestion without derivating from it, the inline suggestion is not updated.
7566
*/
7567
readonly enableForwardStability?: boolean | undefined;
7568
}
7569
7570
export type InlineCompletionCommand = {
7571
command: Command;
7572
icon?: editor.ThemeIcon;
7573
};
7574
7575
export type InlineCompletionProviderGroupId = string;
7576
7577
export interface InlineCompletionsProvider<T extends InlineCompletions = InlineCompletions> {
7578
provideInlineCompletions(model: editor.ITextModel, position: Position, context: InlineCompletionContext, token: CancellationToken): ProviderResult<T>;
7579
/**
7580
* Will be called when an item is shown.
7581
* @param updatedInsertText Is useful to understand bracket completion.
7582
*/
7583
handleItemDidShow?(completions: T, item: T['items'][number], updatedInsertText: string): void;
7584
/**
7585
* Will be called when an item is partially accepted. TODO: also handle full acceptance here!
7586
* @param acceptedCharacters Deprecated. Use `info.acceptedCharacters` instead.
7587
*/
7588
handlePartialAccept?(completions: T, item: T['items'][number], acceptedCharacters: number, info: PartialAcceptInfo): void;
7589
/**
7590
* @deprecated Use `handleEndOfLifetime` instead.
7591
*/
7592
handleRejection?(completions: T, item: T['items'][number]): void;
7593
/**
7594
* Is called when an inline completion item is no longer being used.
7595
* Provides a reason of why it is not used anymore.
7596
*/
7597
handleEndOfLifetime?(completions: T, item: T['items'][number], reason: InlineCompletionEndOfLifeReason<T['items'][number]>, lifetimeSummary: LifetimeSummary): void;
7598
/**
7599
* Will be called when a completions list is no longer in use and can be garbage-collected.
7600
*/
7601
disposeInlineCompletions(completions: T, reason: InlineCompletionsDisposeReason): void;
7602
onDidChangeInlineCompletions?: IEvent<void>;
7603
/**
7604
* Only used for {@link yieldsToGroupIds}.
7605
* Multiple providers can have the same group id.
7606
*/
7607
groupId?: InlineCompletionProviderGroupId;
7608
/**
7609
* Returns a list of preferred provider {@link groupId}s.
7610
* The current provider is only requested for completions if no provider with a preferred group id returned a result.
7611
*/
7612
yieldsToGroupIds?: InlineCompletionProviderGroupId[];
7613
excludesGroupIds?: InlineCompletionProviderGroupId[];
7614
displayName?: string;
7615
debounceDelayMs?: number;
7616
toString?(): string;
7617
}
7618
7619
export type InlineCompletionsDisposeReason = {
7620
kind: 'lostRace' | 'tokenCancellation' | 'other' | 'empty' | 'notTaken';
7621
};
7622
7623
export enum InlineCompletionEndOfLifeReasonKind {
7624
Accepted = 0,
7625
Rejected = 1,
7626
Ignored = 2
7627
}
7628
7629
export type InlineCompletionEndOfLifeReason<TInlineCompletion = InlineCompletion> = {
7630
kind: InlineCompletionEndOfLifeReasonKind.Accepted;
7631
} | {
7632
kind: InlineCompletionEndOfLifeReasonKind.Rejected;
7633
} | {
7634
kind: InlineCompletionEndOfLifeReasonKind.Ignored;
7635
supersededBy?: TInlineCompletion;
7636
userTypingDisagreed: boolean;
7637
};
7638
7639
export type LifetimeSummary = {
7640
requestUuid: string;
7641
correlationId: string | undefined;
7642
partiallyAccepted: number;
7643
partiallyAcceptedCountSinceOriginal: number;
7644
partiallyAcceptedRatioSinceOriginal: number;
7645
partiallyAcceptedCharactersSinceOriginal: number;
7646
shown: boolean;
7647
shownDuration: number;
7648
shownDurationUncollapsed: number;
7649
timeUntilShown: number | undefined;
7650
timeUntilProviderRequest: number;
7651
timeUntilProviderResponse: number;
7652
editorType: string;
7653
viewKind: string | undefined;
7654
error: string | undefined;
7655
preceeded: boolean;
7656
languageId: string;
7657
requestReason: string;
7658
cursorColumnDistance?: number;
7659
cursorLineDistance?: number;
7660
lineCountOriginal?: number;
7661
lineCountModified?: number;
7662
characterCountOriginal?: number;
7663
characterCountModified?: number;
7664
disjointReplacements?: number;
7665
sameShapeReplacements?: boolean;
7666
typingInterval: number;
7667
typingIntervalCharacterCount: number;
7668
};
7669
7670
export interface CodeAction {
7671
title: string;
7672
command?: Command;
7673
edit?: WorkspaceEdit;
7674
diagnostics?: editor.IMarkerData[];
7675
kind?: string;
7676
isPreferred?: boolean;
7677
isAI?: boolean;
7678
disabled?: string;
7679
ranges?: IRange[];
7680
}
7681
7682
export enum CodeActionTriggerType {
7683
Invoke = 1,
7684
Auto = 2
7685
}
7686
7687
export interface CodeActionList extends IDisposable {
7688
readonly actions: ReadonlyArray<CodeAction>;
7689
}
7690
7691
/**
7692
* Represents a parameter of a callable-signature. A parameter can
7693
* have a label and a doc-comment.
7694
*/
7695
export interface ParameterInformation {
7696
/**
7697
* The label of this signature. Will be shown in
7698
* the UI.
7699
*/
7700
label: string | [number, number];
7701
/**
7702
* The human-readable doc-comment of this signature. Will be shown
7703
* in the UI but can be omitted.
7704
*/
7705
documentation?: string | IMarkdownString;
7706
}
7707
7708
/**
7709
* Represents the signature of something callable. A signature
7710
* can have a label, like a function-name, a doc-comment, and
7711
* a set of parameters.
7712
*/
7713
export interface SignatureInformation {
7714
/**
7715
* The label of this signature. Will be shown in
7716
* the UI.
7717
*/
7718
label: string;
7719
/**
7720
* The human-readable doc-comment of this signature. Will be shown
7721
* in the UI but can be omitted.
7722
*/
7723
documentation?: string | IMarkdownString;
7724
/**
7725
* The parameters of this signature.
7726
*/
7727
parameters: ParameterInformation[];
7728
/**
7729
* Index of the active parameter.
7730
*
7731
* If provided, this is used in place of `SignatureHelp.activeSignature`.
7732
*/
7733
activeParameter?: number;
7734
}
7735
7736
/**
7737
* Signature help represents the signature of something
7738
* callable. There can be multiple signatures but only one
7739
* active and only one active parameter.
7740
*/
7741
export interface SignatureHelp {
7742
/**
7743
* One or more signatures.
7744
*/
7745
signatures: SignatureInformation[];
7746
/**
7747
* The active signature.
7748
*/
7749
activeSignature: number;
7750
/**
7751
* The active parameter of the active signature.
7752
*/
7753
activeParameter: number;
7754
}
7755
7756
export interface SignatureHelpResult extends IDisposable {
7757
value: SignatureHelp;
7758
}
7759
7760
export enum SignatureHelpTriggerKind {
7761
Invoke = 1,
7762
TriggerCharacter = 2,
7763
ContentChange = 3
7764
}
7765
7766
export interface SignatureHelpContext {
7767
readonly triggerKind: SignatureHelpTriggerKind;
7768
readonly triggerCharacter?: string;
7769
readonly isRetrigger: boolean;
7770
readonly activeSignatureHelp?: SignatureHelp;
7771
}
7772
7773
/**
7774
* The signature help provider interface defines the contract between extensions and
7775
* the [parameter hints](https://code.visualstudio.com/docs/editor/intellisense)-feature.
7776
*/
7777
export interface SignatureHelpProvider {
7778
readonly signatureHelpTriggerCharacters?: ReadonlyArray<string>;
7779
readonly signatureHelpRetriggerCharacters?: ReadonlyArray<string>;
7780
/**
7781
* Provide help for the signature at the given position and document.
7782
*/
7783
provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelpResult>;
7784
}
7785
7786
/**
7787
* A document highlight kind.
7788
*/
7789
export enum DocumentHighlightKind {
7790
/**
7791
* A textual occurrence.
7792
*/
7793
Text = 0,
7794
/**
7795
* Read-access of a symbol, like reading a variable.
7796
*/
7797
Read = 1,
7798
/**
7799
* Write-access of a symbol, like writing to a variable.
7800
*/
7801
Write = 2
7802
}
7803
7804
/**
7805
* A document highlight is a range inside a text document which deserves
7806
* special attention. Usually a document highlight is visualized by changing
7807
* the background color of its range.
7808
*/
7809
export interface DocumentHighlight {
7810
/**
7811
* The range this highlight applies to.
7812
*/
7813
range: IRange;
7814
/**
7815
* The highlight kind, default is {@link DocumentHighlightKind.Text text}.
7816
*/
7817
kind?: DocumentHighlightKind;
7818
}
7819
7820
/**
7821
* Represents a set of document highlights for a specific Uri.
7822
*/
7823
export interface MultiDocumentHighlight {
7824
/**
7825
* The Uri of the document that the highlights belong to.
7826
*/
7827
uri: Uri;
7828
/**
7829
* The set of highlights for the document.
7830
*/
7831
highlights: DocumentHighlight[];
7832
}
7833
7834
/**
7835
* The document highlight provider interface defines the contract between extensions and
7836
* the word-highlight-feature.
7837
*/
7838
export interface DocumentHighlightProvider {
7839
/**
7840
* Provide a set of document highlights, like all occurrences of a variable or
7841
* all exit-points of a function.
7842
*/
7843
provideDocumentHighlights(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<DocumentHighlight[]>;
7844
}
7845
7846
/**
7847
* A provider that can provide document highlights across multiple documents.
7848
*/
7849
export interface MultiDocumentHighlightProvider {
7850
readonly selector: LanguageSelector;
7851
/**
7852
* Provide a Map of Uri --> document highlights, like all occurrences of a variable or
7853
* all exit-points of a function.
7854
*
7855
* Used in cases such as split view, notebooks, etc. where there can be multiple documents
7856
* with shared symbols.
7857
*
7858
* @param primaryModel The primary text model.
7859
* @param position The position at which to provide document highlights.
7860
* @param otherModels The other text models to search for document highlights.
7861
* @param token A cancellation token.
7862
* @returns A map of Uri to document highlights.
7863
*/
7864
provideMultiDocumentHighlights(primaryModel: editor.ITextModel, position: Position, otherModels: editor.ITextModel[], token: CancellationToken): ProviderResult<Map<Uri, DocumentHighlight[]>>;
7865
}
7866
7867
/**
7868
* The linked editing range provider interface defines the contract between extensions and
7869
* the linked editing feature.
7870
*/
7871
export interface LinkedEditingRangeProvider {
7872
/**
7873
* Provide a list of ranges that can be edited together.
7874
*/
7875
provideLinkedEditingRanges(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<LinkedEditingRanges>;
7876
}
7877
7878
/**
7879
* Represents a list of ranges that can be edited together along with a word pattern to describe valid contents.
7880
*/
7881
export interface LinkedEditingRanges {
7882
/**
7883
* A list of ranges that can be edited together. The ranges must have
7884
* identical length and text content. The ranges cannot overlap
7885
*/
7886
ranges: IRange[];
7887
/**
7888
* An optional word pattern that describes valid contents for the given ranges.
7889
* If no pattern is provided, the language configuration's word pattern will be used.
7890
*/
7891
wordPattern?: RegExp;
7892
}
7893
7894
/**
7895
* Value-object that contains additional information when
7896
* requesting references.
7897
*/
7898
export interface ReferenceContext {
7899
/**
7900
* Include the declaration of the current symbol.
7901
*/
7902
includeDeclaration: boolean;
7903
}
7904
7905
/**
7906
* The reference provider interface defines the contract between extensions and
7907
* the [find references](https://code.visualstudio.com/docs/editor/editingevolved#_peek)-feature.
7908
*/
7909
export interface ReferenceProvider {
7910
/**
7911
* Provide a set of project-wide references for the given position and document.
7912
*/
7913
provideReferences(model: editor.ITextModel, position: Position, context: ReferenceContext, token: CancellationToken): ProviderResult<Location[]>;
7914
}
7915
7916
/**
7917
* Represents a location inside a resource, such as a line
7918
* inside a text file.
7919
*/
7920
export interface Location {
7921
/**
7922
* The resource identifier of this location.
7923
*/
7924
uri: Uri;
7925
/**
7926
* The document range of this locations.
7927
*/
7928
range: IRange;
7929
}
7930
7931
export interface LocationLink {
7932
/**
7933
* A range to select where this link originates from.
7934
*/
7935
originSelectionRange?: IRange;
7936
/**
7937
* The target uri this link points to.
7938
*/
7939
uri: Uri;
7940
/**
7941
* The full range this link points to.
7942
*/
7943
range: IRange;
7944
/**
7945
* A range to select this link points to. Must be contained
7946
* in `LocationLink.range`.
7947
*/
7948
targetSelectionRange?: IRange;
7949
}
7950
7951
export type Definition = Location | Location[] | LocationLink[];
7952
7953
/**
7954
* The definition provider interface defines the contract between extensions and
7955
* the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)
7956
* and peek definition features.
7957
*/
7958
export interface DefinitionProvider {
7959
/**
7960
* Provide the definition of the symbol at the given position and document.
7961
*/
7962
provideDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;
7963
}
7964
7965
/**
7966
* The definition provider interface defines the contract between extensions and
7967
* the [go to definition](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition)
7968
* and peek definition features.
7969
*/
7970
export interface DeclarationProvider {
7971
/**
7972
* Provide the declaration of the symbol at the given position and document.
7973
*/
7974
provideDeclaration(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;
7975
}
7976
7977
/**
7978
* The implementation provider interface defines the contract between extensions and
7979
* the go to implementation feature.
7980
*/
7981
export interface ImplementationProvider {
7982
/**
7983
* Provide the implementation of the symbol at the given position and document.
7984
*/
7985
provideImplementation(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;
7986
}
7987
7988
/**
7989
* The type definition provider interface defines the contract between extensions and
7990
* the go to type definition feature.
7991
*/
7992
export interface TypeDefinitionProvider {
7993
/**
7994
* Provide the type definition of the symbol at the given position and document.
7995
*/
7996
provideTypeDefinition(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<Definition | LocationLink[]>;
7997
}
7998
7999
/**
8000
* A symbol kind.
8001
*/
8002
export enum SymbolKind {
8003
File = 0,
8004
Module = 1,
8005
Namespace = 2,
8006
Package = 3,
8007
Class = 4,
8008
Method = 5,
8009
Property = 6,
8010
Field = 7,
8011
Constructor = 8,
8012
Enum = 9,
8013
Interface = 10,
8014
Function = 11,
8015
Variable = 12,
8016
Constant = 13,
8017
String = 14,
8018
Number = 15,
8019
Boolean = 16,
8020
Array = 17,
8021
Object = 18,
8022
Key = 19,
8023
Null = 20,
8024
EnumMember = 21,
8025
Struct = 22,
8026
Event = 23,
8027
Operator = 24,
8028
TypeParameter = 25
8029
}
8030
8031
export enum SymbolTag {
8032
Deprecated = 1
8033
}
8034
8035
export interface DocumentSymbol {
8036
name: string;
8037
detail: string;
8038
kind: SymbolKind;
8039
tags: ReadonlyArray<SymbolTag>;
8040
containerName?: string;
8041
range: IRange;
8042
selectionRange: IRange;
8043
children?: DocumentSymbol[];
8044
}
8045
8046
/**
8047
* The document symbol provider interface defines the contract between extensions and
8048
* the [go to symbol](https://code.visualstudio.com/docs/editor/editingevolved#_go-to-symbol)-feature.
8049
*/
8050
export interface DocumentSymbolProvider {
8051
displayName?: string;
8052
/**
8053
* Provide symbol information for the given document.
8054
*/
8055
provideDocumentSymbols(model: editor.ITextModel, token: CancellationToken): ProviderResult<DocumentSymbol[]>;
8056
}
8057
8058
export interface TextEdit {
8059
range: IRange;
8060
text: string;
8061
eol?: editor.EndOfLineSequence;
8062
}
8063
8064
/**
8065
* Interface used to format a model
8066
*/
8067
export interface FormattingOptions {
8068
/**
8069
* Size of a tab in spaces.
8070
*/
8071
tabSize: number;
8072
/**
8073
* Prefer spaces over tabs.
8074
*/
8075
insertSpaces: boolean;
8076
}
8077
8078
/**
8079
* The document formatting provider interface defines the contract between extensions and
8080
* the formatting-feature.
8081
*/
8082
export interface DocumentFormattingEditProvider {
8083
readonly displayName?: string;
8084
/**
8085
* Provide formatting edits for a whole document.
8086
*/
8087
provideDocumentFormattingEdits(model: editor.ITextModel, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
8088
}
8089
8090
/**
8091
* The document formatting provider interface defines the contract between extensions and
8092
* the formatting-feature.
8093
*/
8094
export interface DocumentRangeFormattingEditProvider {
8095
readonly displayName?: string;
8096
/**
8097
* Provide formatting edits for a range in a document.
8098
*
8099
* The given range is a hint and providers can decide to format a smaller
8100
* or larger range. Often this is done by adjusting the start and end
8101
* of the range to full syntax nodes.
8102
*/
8103
provideDocumentRangeFormattingEdits(model: editor.ITextModel, range: Range, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
8104
provideDocumentRangesFormattingEdits?(model: editor.ITextModel, ranges: Range[], options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
8105
}
8106
8107
/**
8108
* The document formatting provider interface defines the contract between extensions and
8109
* the formatting-feature.
8110
*/
8111
export interface OnTypeFormattingEditProvider {
8112
autoFormatTriggerCharacters: string[];
8113
/**
8114
* Provide formatting edits after a character has been typed.
8115
*
8116
* The given position and character should hint to the provider
8117
* what range the position to expand to, like find the matching `{`
8118
* when `}` has been entered.
8119
*/
8120
provideOnTypeFormattingEdits(model: editor.ITextModel, position: Position, ch: string, options: FormattingOptions, token: CancellationToken): ProviderResult<TextEdit[]>;
8121
}
8122
8123
/**
8124
* A link inside the editor.
8125
*/
8126
export interface ILink {
8127
range: IRange;
8128
url?: Uri | string;
8129
tooltip?: string;
8130
}
8131
8132
export interface ILinksList {
8133
links: ILink[];
8134
dispose?(): void;
8135
}
8136
8137
/**
8138
* A provider of links.
8139
*/
8140
export interface LinkProvider {
8141
provideLinks(model: editor.ITextModel, token: CancellationToken): ProviderResult<ILinksList>;
8142
resolveLink?: (link: ILink, token: CancellationToken) => ProviderResult<ILink>;
8143
}
8144
8145
/**
8146
* A color in RGBA format.
8147
*/
8148
export interface IColor {
8149
/**
8150
* The red component in the range [0-1].
8151
*/
8152
readonly red: number;
8153
/**
8154
* The green component in the range [0-1].
8155
*/
8156
readonly green: number;
8157
/**
8158
* The blue component in the range [0-1].
8159
*/
8160
readonly blue: number;
8161
/**
8162
* The alpha component in the range [0-1].
8163
*/
8164
readonly alpha: number;
8165
}
8166
8167
/**
8168
* String representations for a color
8169
*/
8170
export interface IColorPresentation {
8171
/**
8172
* The label of this color presentation. It will be shown on the color
8173
* picker header. By default this is also the text that is inserted when selecting
8174
* this color presentation.
8175
*/
8176
label: string;
8177
/**
8178
* An {@link TextEdit edit} which is applied to a document when selecting
8179
* this presentation for the color.
8180
*/
8181
textEdit?: TextEdit;
8182
/**
8183
* An optional array of additional {@link TextEdit text edits} that are applied when
8184
* selecting this color presentation.
8185
*/
8186
additionalTextEdits?: TextEdit[];
8187
}
8188
8189
/**
8190
* A color range is a range in a text model which represents a color.
8191
*/
8192
export interface IColorInformation {
8193
/**
8194
* The range within the model.
8195
*/
8196
range: IRange;
8197
/**
8198
* The color represented in this range.
8199
*/
8200
color: IColor;
8201
}
8202
8203
/**
8204
* A provider of colors for editor models.
8205
*/
8206
export interface DocumentColorProvider {
8207
/**
8208
* Provides the color ranges for a specific model.
8209
*/
8210
provideDocumentColors(model: editor.ITextModel, token: CancellationToken): ProviderResult<IColorInformation[]>;
8211
/**
8212
* Provide the string representations for a color.
8213
*/
8214
provideColorPresentations(model: editor.ITextModel, colorInfo: IColorInformation, token: CancellationToken): ProviderResult<IColorPresentation[]>;
8215
}
8216
8217
export interface SelectionRange {
8218
range: IRange;
8219
}
8220
8221
export interface SelectionRangeProvider {
8222
/**
8223
* Provide ranges that should be selected from the given position.
8224
*/
8225
provideSelectionRanges(model: editor.ITextModel, positions: Position[], token: CancellationToken): ProviderResult<SelectionRange[][]>;
8226
}
8227
8228
export interface FoldingContext {
8229
}
8230
8231
/**
8232
* A provider of folding ranges for editor models.
8233
*/
8234
export interface FoldingRangeProvider {
8235
/**
8236
* An optional event to signal that the folding ranges from this provider have changed.
8237
*/
8238
onDidChange?: IEvent<this>;
8239
/**
8240
* Provides the folding ranges for a specific model.
8241
*/
8242
provideFoldingRanges(model: editor.ITextModel, context: FoldingContext, token: CancellationToken): ProviderResult<FoldingRange[]>;
8243
}
8244
8245
export interface FoldingRange {
8246
/**
8247
* The one-based start line of the range to fold. The folded area starts after the line's last character.
8248
*/
8249
start: number;
8250
/**
8251
* The one-based end line of the range to fold. The folded area ends with the line's last character.
8252
*/
8253
end: number;
8254
/**
8255
* Describes the {@link FoldingRangeKind Kind} of the folding range such as {@link FoldingRangeKind.Comment Comment} or
8256
* {@link FoldingRangeKind.Region Region}. The kind is used to categorize folding ranges and used by commands
8257
* like 'Fold all comments'. See
8258
* {@link FoldingRangeKind} for an enumeration of standardized kinds.
8259
*/
8260
kind?: FoldingRangeKind;
8261
}
8262
8263
export class FoldingRangeKind {
8264
value: string;
8265
/**
8266
* Kind for folding range representing a comment. The value of the kind is 'comment'.
8267
*/
8268
static readonly Comment: FoldingRangeKind;
8269
/**
8270
* Kind for folding range representing a import. The value of the kind is 'imports'.
8271
*/
8272
static readonly Imports: FoldingRangeKind;
8273
/**
8274
* Kind for folding range representing regions (for example marked by `#region`, `#endregion`).
8275
* The value of the kind is 'region'.
8276
*/
8277
static readonly Region: FoldingRangeKind;
8278
/**
8279
* Returns a {@link FoldingRangeKind} for the given value.
8280
*
8281
* @param value of the kind.
8282
*/
8283
static fromValue(value: string): FoldingRangeKind;
8284
/**
8285
* Creates a new {@link FoldingRangeKind}.
8286
*
8287
* @param value of the kind.
8288
*/
8289
constructor(value: string);
8290
}
8291
8292
export interface WorkspaceEditMetadata {
8293
needsConfirmation: boolean;
8294
label: string;
8295
description?: string;
8296
}
8297
8298
export interface WorkspaceFileEditOptions {
8299
overwrite?: boolean;
8300
ignoreIfNotExists?: boolean;
8301
ignoreIfExists?: boolean;
8302
recursive?: boolean;
8303
copy?: boolean;
8304
folder?: boolean;
8305
skipTrashBin?: boolean;
8306
maxSize?: number;
8307
}
8308
8309
export interface IWorkspaceFileEdit {
8310
oldResource?: Uri;
8311
newResource?: Uri;
8312
options?: WorkspaceFileEditOptions;
8313
metadata?: WorkspaceEditMetadata;
8314
}
8315
8316
export interface IWorkspaceTextEdit {
8317
resource: Uri;
8318
textEdit: TextEdit & {
8319
insertAsSnippet?: boolean;
8320
keepWhitespace?: boolean;
8321
};
8322
versionId: number | undefined;
8323
metadata?: WorkspaceEditMetadata;
8324
}
8325
8326
export interface WorkspaceEdit {
8327
edits: Array<IWorkspaceTextEdit | IWorkspaceFileEdit | ICustomEdit>;
8328
}
8329
8330
export interface ICustomEdit {
8331
readonly resource: Uri;
8332
readonly metadata?: WorkspaceEditMetadata;
8333
undo(): Promise<void> | void;
8334
redo(): Promise<void> | void;
8335
}
8336
8337
export interface Rejection {
8338
rejectReason?: string;
8339
}
8340
8341
export interface RenameLocation {
8342
range: IRange;
8343
text: string;
8344
}
8345
8346
export interface RenameProvider {
8347
provideRenameEdits(model: editor.ITextModel, position: Position, newName: string, token: CancellationToken): ProviderResult<WorkspaceEdit & Rejection>;
8348
resolveRenameLocation?(model: editor.ITextModel, position: Position, token: CancellationToken): ProviderResult<RenameLocation & Rejection>;
8349
}
8350
8351
export enum NewSymbolNameTag {
8352
AIGenerated = 1
8353
}
8354
8355
export enum NewSymbolNameTriggerKind {
8356
Invoke = 0,
8357
Automatic = 1
8358
}
8359
8360
export interface NewSymbolName {
8361
readonly newSymbolName: string;
8362
readonly tags?: readonly NewSymbolNameTag[];
8363
}
8364
8365
export interface NewSymbolNamesProvider {
8366
supportsAutomaticNewSymbolNamesTriggerKind?: Promise<boolean | undefined>;
8367
provideNewSymbolNames(model: editor.ITextModel, range: IRange, triggerKind: NewSymbolNameTriggerKind, token: CancellationToken): ProviderResult<NewSymbolName[]>;
8368
}
8369
8370
export interface Command {
8371
id: string;
8372
title: string;
8373
tooltip?: string;
8374
arguments?: any[];
8375
}
8376
8377
export interface CommentThreadRevealOptions {
8378
preserveFocus: boolean;
8379
focusReply: boolean;
8380
}
8381
8382
export interface CommentAuthorInformation {
8383
name: string;
8384
iconPath?: UriComponents;
8385
}
8386
8387
export interface PendingCommentThread {
8388
range: IRange | undefined;
8389
uri: Uri;
8390
uniqueOwner: string;
8391
isReply: boolean;
8392
comment: PendingComment;
8393
}
8394
8395
export interface PendingComment {
8396
body: string;
8397
cursor: IPosition;
8398
}
8399
8400
export interface CodeLens {
8401
range: IRange;
8402
id?: string;
8403
command?: Command;
8404
}
8405
8406
export interface CodeLensList {
8407
readonly lenses: readonly CodeLens[];
8408
dispose?(): void;
8409
}
8410
8411
export interface CodeLensProvider {
8412
onDidChange?: IEvent<this>;
8413
provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult<CodeLensList>;
8414
resolveCodeLens?(model: editor.ITextModel, codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;
8415
}
8416
8417
export enum InlayHintKind {
8418
Type = 1,
8419
Parameter = 2
8420
}
8421
8422
export interface InlayHintLabelPart {
8423
label: string;
8424
tooltip?: string | IMarkdownString;
8425
command?: Command;
8426
location?: Location;
8427
}
8428
8429
export interface InlayHint {
8430
label: string | InlayHintLabelPart[];
8431
tooltip?: string | IMarkdownString;
8432
textEdits?: TextEdit[];
8433
position: IPosition;
8434
kind?: InlayHintKind;
8435
paddingLeft?: boolean;
8436
paddingRight?: boolean;
8437
}
8438
8439
export interface InlayHintList {
8440
hints: InlayHint[];
8441
dispose(): void;
8442
}
8443
8444
export interface InlayHintsProvider {
8445
displayName?: string;
8446
onDidChangeInlayHints?: IEvent<void>;
8447
provideInlayHints(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult<InlayHintList>;
8448
resolveInlayHint?(hint: InlayHint, token: CancellationToken): ProviderResult<InlayHint>;
8449
}
8450
8451
export interface SemanticTokensLegend {
8452
readonly tokenTypes: string[];
8453
readonly tokenModifiers: string[];
8454
}
8455
8456
export interface SemanticTokens {
8457
readonly resultId?: string;
8458
readonly data: Uint32Array;
8459
}
8460
8461
export interface SemanticTokensEdit {
8462
readonly start: number;
8463
readonly deleteCount: number;
8464
readonly data?: Uint32Array;
8465
}
8466
8467
export interface SemanticTokensEdits {
8468
readonly resultId?: string;
8469
readonly edits: SemanticTokensEdit[];
8470
}
8471
8472
export interface DocumentSemanticTokensProvider {
8473
onDidChange?: IEvent<void>;
8474
getLegend(): SemanticTokensLegend;
8475
provideDocumentSemanticTokens(model: editor.ITextModel, lastResultId: string | null, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensEdits>;
8476
releaseDocumentSemanticTokens(resultId: string | undefined): void;
8477
}
8478
8479
export interface DocumentRangeSemanticTokensProvider {
8480
getLegend(): SemanticTokensLegend;
8481
provideDocumentRangeSemanticTokens(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
8482
}
8483
8484
export interface ILanguageExtensionPoint {
8485
id: string;
8486
extensions?: string[];
8487
filenames?: string[];
8488
filenamePatterns?: string[];
8489
firstLine?: string;
8490
aliases?: string[];
8491
mimetypes?: string[];
8492
configuration?: Uri;
8493
}
8494
/**
8495
* A Monarch language definition
8496
*/
8497
export interface IMonarchLanguage {
8498
/**
8499
* map from string to ILanguageRule[]
8500
*/
8501
tokenizer: {
8502
[name: string]: IMonarchLanguageRule[];
8503
};
8504
/**
8505
* is the language case insensitive?
8506
*/
8507
ignoreCase?: boolean;
8508
/**
8509
* is the language unicode-aware? (i.e., /\u{1D306}/)
8510
*/
8511
unicode?: boolean;
8512
/**
8513
* if no match in the tokenizer assign this token class (default 'source')
8514
*/
8515
defaultToken?: string;
8516
/**
8517
* for example [['{','}','delimiter.curly']]
8518
*/
8519
brackets?: IMonarchLanguageBracket[];
8520
/**
8521
* start symbol in the tokenizer (by default the first entry is used)
8522
*/
8523
start?: string;
8524
/**
8525
* attach this to every token class (by default '.' + name)
8526
*/
8527
tokenPostfix?: string;
8528
/**
8529
* include line feeds (in the form of a \n character) at the end of lines
8530
* Defaults to false
8531
*/
8532
includeLF?: boolean;
8533
/**
8534
* Other keys that can be referred to by the tokenizer.
8535
*/
8536
[key: string]: any;
8537
}
8538
8539
/**
8540
* A rule is either a regular expression and an action
8541
* shorthands: [reg,act] == { regex: reg, action: act}
8542
* and : [reg,act,nxt] == { regex: reg, action: act{ next: nxt }}
8543
*/
8544
export type IShortMonarchLanguageRule1 = [string | RegExp, IMonarchLanguageAction];
8545
8546
export type IShortMonarchLanguageRule2 = [string | RegExp, IMonarchLanguageAction, string];
8547
8548
export interface IExpandedMonarchLanguageRule {
8549
/**
8550
* match tokens
8551
*/
8552
regex?: string | RegExp;
8553
/**
8554
* action to take on match
8555
*/
8556
action?: IMonarchLanguageAction;
8557
/**
8558
* or an include rule. include all rules from the included state
8559
*/
8560
include?: string;
8561
}
8562
8563
export type IMonarchLanguageRule = IShortMonarchLanguageRule1 | IShortMonarchLanguageRule2 | IExpandedMonarchLanguageRule;
8564
8565
/**
8566
* An action is either an array of actions...
8567
* ... or a case statement with guards...
8568
* ... or a basic action with a token value.
8569
*/
8570
export type IShortMonarchLanguageAction = string;
8571
8572
export interface IExpandedMonarchLanguageAction {
8573
/**
8574
* array of actions for each parenthesized match group
8575
*/
8576
group?: IMonarchLanguageAction[];
8577
/**
8578
* map from string to ILanguageAction
8579
*/
8580
cases?: Object;
8581
/**
8582
* token class (ie. css class) (or "@brackets" or "@rematch")
8583
*/
8584
token?: string;
8585
/**
8586
* the next state to push, or "@push", "@pop", "@popall"
8587
*/
8588
next?: string;
8589
/**
8590
* switch to this state
8591
*/
8592
switchTo?: string;
8593
/**
8594
* go back n characters in the stream
8595
*/
8596
goBack?: number;
8597
/**
8598
* @open or @close
8599
*/
8600
bracket?: string;
8601
/**
8602
* switch to embedded language (using the mimetype) or get out using "@pop"
8603
*/
8604
nextEmbedded?: string;
8605
/**
8606
* log a message to the browser console window
8607
*/
8608
log?: string;
8609
}
8610
8611
export type IMonarchLanguageAction = IShortMonarchLanguageAction | IExpandedMonarchLanguageAction | (IShortMonarchLanguageAction | IExpandedMonarchLanguageAction)[];
8612
8613
/**
8614
* This interface can be shortened as an array, ie. ['{','}','delimiter.curly']
8615
*/
8616
export interface IMonarchLanguageBracket {
8617
/**
8618
* open bracket
8619
*/
8620
open: string;
8621
/**
8622
* closing bracket
8623
*/
8624
close: string;
8625
/**
8626
* token class
8627
*/
8628
token: string;
8629
}
8630
8631
}
8632
8633
declare namespace monaco.worker {
8634
8635
8636
export interface IMirrorTextModel {
8637
readonly version: number;
8638
}
8639
8640
export interface IMirrorModel extends IMirrorTextModel {
8641
readonly uri: Uri;
8642
readonly version: number;
8643
getValue(): string;
8644
}
8645
8646
export interface IWorkerContext<H = {}> {
8647
/**
8648
* A proxy to the main thread host object.
8649
*/
8650
host: H;
8651
/**
8652
* Get all available mirror models in this worker.
8653
*/
8654
getMirrorModels(): IMirrorModel[];
8655
}
8656
8657
}
8658
8659
//dtsv=3
8660
8661