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