forked from microsoft/monaco-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
monaco.d.ts
5857 lines (5542 loc) · 197 KB
/
monaco.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*!-----------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Type definitions for monaco-editor v0.15.6
* Released under the MIT license
*-----------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare namespace monaco {
export type Thenable<T> = PromiseLike<T>;
export interface IDisposable {
dispose(): void;
}
export interface IEvent<T> {
(listener: (e: T) => any, thisArg?: any): IDisposable;
}
/**
* A helper that allows to emit and listen to typed events
*/
export class Emitter<T> {
constructor();
readonly event: IEvent<T>;
fire(event?: T): void;
dispose(): void;
}
export enum MarkerTag {
Unnecessary = 1
}
export enum MarkerSeverity {
Hint = 1,
Info = 2,
Warning = 4,
Error = 8
}
export class Promise<T = any> {
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason: any) => void) => void);
public then<TResult1 = T, TResult2 = never>(
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
public static as(value: null): Promise<null>;
public static as(value: undefined): Promise<undefined>;
public static as<T>(value: PromiseLike<T>): PromiseLike<T>;
public static as<T, SomePromise extends PromiseLike<T>>(value: SomePromise): SomePromise;
public static as<T>(value: T): Promise<T>;
public static join<T1, T2>(promises: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
public static join<T>(promises: (T | PromiseLike<T>)[]): Promise<T[]>;
public static wrap<T>(value: T | PromiseLike<T>): Promise<T>;
public static wrapError<T = never>(error: Error): Promise<T>;
}
export class CancellationTokenSource {
readonly token: CancellationToken;
cancel(): void;
dispose(): void;
}
export interface CancellationToken {
readonly isCancellationRequested: boolean;
/**
* An event emitted when cancellation is requested
* @event
*/
readonly onCancellationRequested: IEvent<any>;
}
/**
* Uniform Resource Identifier (Uri) http://tools.ietf.org/html/rfc3986.
* This class is a simple parser which creates the basic component parts
* (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
* and encoding.
*
* foo://example.com:8042/over/there?name=ferret#nose
* \_/ \______________/\_________/ \_________/ \__/
* | | | | |
* scheme authority path query fragment
* | _____________________|__
* / \ / \
* urn:example:animal:ferret:nose
*/
export class Uri implements UriComponents {
static isUri(thing: any): thing is Uri;
/**
* scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'.
* The part before the first colon.
*/
readonly scheme: string;
/**
* authority is the 'www.msft.com' part of 'http://www.msft.com/some/path?query#fragment'.
* The part between the first double slashes and the next slash.
*/
readonly authority: string;
/**
* path is the '/some/path' part of 'http://www.msft.com/some/path?query#fragment'.
*/
readonly path: string;
/**
* query is the 'query' part of 'http://www.msft.com/some/path?query#fragment'.
*/
readonly query: string;
/**
* fragment is the 'fragment' part of 'http://www.msft.com/some/path?query#fragment'.
*/
readonly fragment: string;
/**
* Returns a string representing the corresponding file system path of this Uri.
* Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the
* platform specific path separator.
*
* * Will *not* validate the path for invalid characters and semantics.
* * Will *not* look at the scheme of this Uri.
* * The result shall *not* be used for display purposes but for accessing a file on disk.
*
*
* The *difference* to `Uri#path` is the use of the platform specific separator and the handling
* of UNC paths. See the below sample of a file-uri with an authority (UNC path).
*
* ```ts
const u = Uri.parse('file://server/c$/folder/file.txt')
u.authority === 'server'
u.path === '/shares/c$/file.txt'
u.fsPath === '\\server\c$\folder\file.txt'
```
*
* Using `Uri#path` to read a file (using fs-apis) would not be enough because parts of the path,
* namely the server name, would be missing. Therefore `Uri#fsPath` exists - it's sugar to ease working
* with URIs that represent files on disk (`file` scheme).
*/
readonly fsPath: string;
with(change: {
scheme?: string;
authority?: string | null;
path?: string | null;
query?: string | null;
fragment?: string | null;
}): Uri;
/**
* Creates a new Uri from a string, e.g. `http://www.msft.com/some/path`,
* `file:///usr/home`, or `scheme:with/path`.
*
* @param value A string which represents an Uri (see `Uri#toString`).
*/
static parse(value: string): Uri;
/**
* Creates a new Uri from a file system path, e.g. `c:\my\files`,
* `/usr/home`, or `\\server\share\some\path`.
*
* The *difference* between `Uri#parse` and `Uri#file` is that the latter treats the argument
* as path, not as stringified-uri. E.g. `Uri.file(path)` is **not the same as**
* `Uri.parse('file://' + path)` because the path might contain characters that are
* interpreted (# and ?). See the following sample:
* ```ts
const good = Uri.file('/coding/c#/project1');
good.scheme === 'file';
good.path === '/coding/c#/project1';
good.fragment === '';
const bad = Uri.parse('file://' + '/coding/c#/project1');
bad.scheme === 'file';
bad.path === '/coding/c'; // path is now broken
bad.fragment === '/project1';
```
*
* @param path A file system path (see `Uri#fsPath`)
*/
static file(path: string): Uri;
static from(components: {
scheme: string;
authority?: string;
path?: string;
query?: string;
fragment?: string;
}): Uri;
/**
* Creates a string presentation for this Uri. It's guaranteed that calling
* `Uri.parse` with the result of this function creates an Uri which is equal
* to this Uri.
*
* * The result shall *not* be used for display purposes but for externalization or transport.
* * The result will be encoded using the percentage encoding and encoding happens mostly
* ignore the scheme-specific encoding rules.
*
* @param skipEncoding Do not encode the result, default is `false`
*/
toString(skipEncoding?: boolean): string;
toJSON(): object;
static revive(data: UriComponents | any): Uri;
}
export interface UriComponents {
scheme: string;
authority: string;
path: string;
query: string;
fragment: string;
}
/**
* Virtual Key Codes, the value does not hold any inherent meaning.
* Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
* But these are "more general", as they should work across browsers & OS`s.
*/
export enum KeyCode {
/**
* Placed first to cover the 0 value of the enum.
*/
Unknown = 0,
Backspace = 1,
Tab = 2,
Enter = 3,
Shift = 4,
Ctrl = 5,
Alt = 6,
PauseBreak = 7,
CapsLock = 8,
Escape = 9,
Space = 10,
PageUp = 11,
PageDown = 12,
End = 13,
Home = 14,
LeftArrow = 15,
UpArrow = 16,
RightArrow = 17,
DownArrow = 18,
Insert = 19,
Delete = 20,
KEY_0 = 21,
KEY_1 = 22,
KEY_2 = 23,
KEY_3 = 24,
KEY_4 = 25,
KEY_5 = 26,
KEY_6 = 27,
KEY_7 = 28,
KEY_8 = 29,
KEY_9 = 30,
KEY_A = 31,
KEY_B = 32,
KEY_C = 33,
KEY_D = 34,
KEY_E = 35,
KEY_F = 36,
KEY_G = 37,
KEY_H = 38,
KEY_I = 39,
KEY_J = 40,
KEY_K = 41,
KEY_L = 42,
KEY_M = 43,
KEY_N = 44,
KEY_O = 45,
KEY_P = 46,
KEY_Q = 47,
KEY_R = 48,
KEY_S = 49,
KEY_T = 50,
KEY_U = 51,
KEY_V = 52,
KEY_W = 53,
KEY_X = 54,
KEY_Y = 55,
KEY_Z = 56,
Meta = 57,
ContextMenu = 58,
F1 = 59,
F2 = 60,
F3 = 61,
F4 = 62,
F5 = 63,
F6 = 64,
F7 = 65,
F8 = 66,
F9 = 67,
F10 = 68,
F11 = 69,
F12 = 70,
F13 = 71,
F14 = 72,
F15 = 73,
F16 = 74,
F17 = 75,
F18 = 76,
F19 = 77,
NumLock = 78,
ScrollLock = 79,
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the ';:' key
*/
US_SEMICOLON = 80,
/**
* For any country/region, the '+' key
* For the US standard keyboard, the '=+' key
*/
US_EQUAL = 81,
/**
* For any country/region, the ',' key
* For the US standard keyboard, the ',<' key
*/
US_COMMA = 82,
/**
* For any country/region, the '-' key
* For the US standard keyboard, the '-_' key
*/
US_MINUS = 83,
/**
* For any country/region, the '.' key
* For the US standard keyboard, the '.>' key
*/
US_DOT = 84,
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the '/?' key
*/
US_SLASH = 85,
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the '`~' key
*/
US_BACKTICK = 86,
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the '[{' key
*/
US_OPEN_SQUARE_BRACKET = 87,
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the '\|' key
*/
US_BACKSLASH = 88,
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the ']}' key
*/
US_CLOSE_SQUARE_BRACKET = 89,
/**
* Used for miscellaneous characters; it can vary by keyboard.
* For the US standard keyboard, the ''"' key
*/
US_QUOTE = 90,
/**
* Used for miscellaneous characters; it can vary by keyboard.
*/
OEM_8 = 91,
/**
* Either the angle bracket key or the backslash key on the RT 102-key keyboard.
*/
OEM_102 = 92,
NUMPAD_0 = 93,
NUMPAD_1 = 94,
NUMPAD_2 = 95,
NUMPAD_3 = 96,
NUMPAD_4 = 97,
NUMPAD_5 = 98,
NUMPAD_6 = 99,
NUMPAD_7 = 100,
NUMPAD_8 = 101,
NUMPAD_9 = 102,
NUMPAD_MULTIPLY = 103,
NUMPAD_ADD = 104,
NUMPAD_SEPARATOR = 105,
NUMPAD_SUBTRACT = 106,
NUMPAD_DECIMAL = 107,
NUMPAD_DIVIDE = 108,
/**
* Cover all key codes when IME is processing input.
*/
KEY_IN_COMPOSITION = 109,
ABNT_C1 = 110,
ABNT_C2 = 111,
/**
* Placed last to cover the length of the enum.
* Please do not depend on this value!
*/
MAX_VALUE = 112
}
export class KeyMod {
static readonly CtrlCmd: number;
static readonly Shift: number;
static readonly Alt: number;
static readonly WinCtrl: number;
static chord(firstPart: number, secondPart: number): number;
}
export interface IMarkdownString {
value: string;
isTrusted?: boolean;
}
export interface IKeyboardEvent {
readonly browserEvent: KeyboardEvent;
readonly target: HTMLElement;
readonly ctrlKey: boolean;
readonly shiftKey: boolean;
readonly altKey: boolean;
readonly metaKey: boolean;
readonly keyCode: KeyCode;
readonly code: string;
equals(keybinding: number): boolean;
preventDefault(): void;
stopPropagation(): void;
}
export interface IMouseEvent {
readonly browserEvent: MouseEvent;
readonly leftButton: boolean;
readonly middleButton: boolean;
readonly rightButton: boolean;
readonly target: HTMLElement;
readonly detail: number;
readonly posx: number;
readonly posy: number;
readonly ctrlKey: boolean;
readonly shiftKey: boolean;
readonly altKey: boolean;
readonly metaKey: boolean;
readonly timestamp: number;
preventDefault(): void;
stopPropagation(): void;
}
export interface IScrollEvent {
readonly scrollTop: number;
readonly scrollLeft: number;
readonly scrollWidth: number;
readonly scrollHeight: number;
readonly scrollTopChanged: boolean;
readonly scrollLeftChanged: boolean;
readonly scrollWidthChanged: boolean;
readonly scrollHeightChanged: boolean;
}
/**
* A position in the editor. This interface is suitable for serialization.
*/
export interface IPosition {
/**
* line number (starts at 1)
*/
readonly lineNumber: number;
/**
* column (the first character in a line is between column 1 and column 2)
*/
readonly column: number;
}
/**
* A position in the editor.
*/
export class Position {
/**
* line number (starts at 1)
*/
readonly lineNumber: number;
/**
* column (the first character in a line is between column 1 and column 2)
*/
readonly column: number;
constructor(lineNumber: number, column: number);
/**
* Create a new postion from this position.
*
* @param newLineNumber new line number
* @param newColumn new column
*/
with(newLineNumber?: number, newColumn?: number): Position;
/**
* Derive a new position from this position.
*
* @param deltaLineNumber line number delta
* @param deltaColumn column delta
*/
delta(deltaLineNumber?: number, deltaColumn?: number): Position;
/**
* Test if this position equals other position
*/
equals(other: IPosition): boolean;
/**
* Test if position `a` equals position `b`
*/
static equals(a: IPosition, b: IPosition): boolean;
/**
* Test if this position is before other position.
* If the two positions are equal, the result will be false.
*/
isBefore(other: IPosition): boolean;
/**
* Test if position `a` is before position `b`.
* If the two positions are equal, the result will be false.
*/
static isBefore(a: IPosition, b: IPosition): boolean;
/**
* Test if this position is before other position.
* If the two positions are equal, the result will be true.
*/
isBeforeOrEqual(other: IPosition): boolean;
/**
* Test if position `a` is before position `b`.
* If the two positions are equal, the result will be true.
*/
static isBeforeOrEqual(a: IPosition, b: IPosition): boolean;
/**
* A function that compares positions, useful for sorting
*/
static compare(a: IPosition, b: IPosition): number;
/**
* Clone this position.
*/
clone(): Position;
/**
* Convert to a human-readable representation.
*/
toString(): string;
/**
* Create a `Position` from an `IPosition`.
*/
static lift(pos: IPosition): Position;
/**
* Test if `obj` is an `IPosition`.
*/
static isIPosition(obj: any): obj is IPosition;
}
/**
* A range in the editor. This interface is suitable for serialization.
*/
export interface IRange {
/**
* Line number on which the range starts (starts at 1).
*/
readonly startLineNumber: number;
/**
* Column on which the range starts in line `startLineNumber` (starts at 1).
*/
readonly startColumn: number;
/**
* Line number on which the range ends.
*/
readonly endLineNumber: number;
/**
* Column on which the range ends in line `endLineNumber`.
*/
readonly endColumn: number;
}
/**
* A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)
*/
export class Range {
/**
* Line number on which the range starts (starts at 1).
*/
readonly startLineNumber: number;
/**
* Column on which the range starts in line `startLineNumber` (starts at 1).
*/
readonly startColumn: number;
/**
* Line number on which the range ends.
*/
readonly endLineNumber: number;
/**
* Column on which the range ends in line `endLineNumber`.
*/
readonly endColumn: number;
constructor(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number);
/**
* Test if this range is empty.
*/
isEmpty(): boolean;
/**
* Test if `range` is empty.
*/
static isEmpty(range: IRange): boolean;
/**
* Test if position is in this range. If the position is at the edges, will return true.
*/
containsPosition(position: IPosition): boolean;
/**
* Test if `position` is in `range`. If the position is at the edges, will return true.
*/
static containsPosition(range: IRange, position: IPosition): boolean;
/**
* Test if range is in this range. If the range is equal to this range, will return true.
*/
containsRange(range: IRange): boolean;
/**
* Test if `otherRange` is in `range`. If the ranges are equal, will return true.
*/
static containsRange(range: IRange, otherRange: IRange): boolean;
/**
* A reunion of the two ranges.
* The smallest position will be used as the start point, and the largest one as the end point.
*/
plusRange(range: IRange): Range;
/**
* A reunion of the two ranges.
* The smallest position will be used as the start point, and the largest one as the end point.
*/
static plusRange(a: IRange, b: IRange): Range;
/**
* A intersection of the two ranges.
*/
intersectRanges(range: IRange): Range | null;
/**
* A intersection of the two ranges.
*/
static intersectRanges(a: IRange, b: IRange): Range | null;
/**
* Test if this range equals other.
*/
equalsRange(other: IRange | null): boolean;
/**
* Test if range `a` equals `b`.
*/
static equalsRange(a: IRange | null, b: IRange | null): boolean;
/**
* Return the end position (which will be after or equal to the start position)
*/
getEndPosition(): Position;
/**
* Return the start position (which will be before or equal to the end position)
*/
getStartPosition(): Position;
/**
* Transform to a user presentable string representation.
*/
toString(): string;
/**
* Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.
*/
setEndPosition(endLineNumber: number, endColumn: number): Range;
/**
* Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.
*/
setStartPosition(startLineNumber: number, startColumn: number): Range;
/**
* Create a new empty range using this range's start position.
*/
collapseToStart(): Range;
/**
* Create a new empty range using this range's start position.
*/
static collapseToStart(range: IRange): Range;
static fromPositions(start: IPosition, end?: IPosition): Range;
/**
* Create a `Range` from an `IRange`.
*/
static lift(range: undefined | null): null;
static lift(range: IRange): Range;
/**
* Test if `obj` is an `IRange`.
*/
static isIRange(obj: any): obj is IRange;
/**
* Test if the two ranges are touching in any way.
*/
static areIntersectingOrTouching(a: IRange, b: IRange): boolean;
/**
* Test if the two ranges are intersecting. If the ranges are touching it returns true.
*/
static areIntersecting(a: IRange, b: IRange): boolean;
/**
* A function that compares ranges, useful for sorting ranges
* It will first compare ranges on the startPosition and then on the endPosition
*/
static compareRangesUsingStarts(a: IRange | null | undefined, b: IRange | null | undefined): number;
/**
* A function that compares ranges, useful for sorting ranges
* It will first compare ranges on the endPosition and then on the startPosition
*/
static compareRangesUsingEnds(a: IRange, b: IRange): number;
/**
* Test if the range spans multiple lines.
*/
static spansMultipleLines(range: IRange): boolean;
}
/**
* A selection in the editor.
* The selection is a range that has an orientation.
*/
export interface ISelection {
/**
* The line number on which the selection has started.
*/
readonly selectionStartLineNumber: number;
/**
* The column on `selectionStartLineNumber` where the selection has started.
*/
readonly selectionStartColumn: number;
/**
* The line number on which the selection has ended.
*/
readonly positionLineNumber: number;
/**
* The column on `positionLineNumber` where the selection has ended.
*/
readonly positionColumn: number;
}
/**
* A selection in the editor.
* The selection is a range that has an orientation.
*/
export class Selection extends Range {
/**
* The line number on which the selection has started.
*/
readonly selectionStartLineNumber: number;
/**
* The column on `selectionStartLineNumber` where the selection has started.
*/
readonly selectionStartColumn: number;
/**
* The line number on which the selection has ended.
*/
readonly positionLineNumber: number;
/**
* The column on `positionLineNumber` where the selection has ended.
*/
readonly positionColumn: number;
constructor(selectionStartLineNumber: number, selectionStartColumn: number, positionLineNumber: number, positionColumn: number);
/**
* Clone this selection.
*/
clone(): Selection;
/**
* Transform to a human-readable representation.
*/
toString(): string;
/**
* Test if equals other selection.
*/
equalsSelection(other: ISelection): boolean;
/**
* Test if the two selections are equal.
*/
static selectionsEqual(a: ISelection, b: ISelection): boolean;
/**
* Get directions (LTR or RTL).
*/
getDirection(): SelectionDirection;
/**
* Create a new selection with a different `positionLineNumber` and `positionColumn`.
*/
setEndPosition(endLineNumber: number, endColumn: number): Selection;
/**
* Get the position at `positionLineNumber` and `positionColumn`.
*/
getPosition(): Position;
/**
* Create a new selection with a different `selectionStartLineNumber` and `selectionStartColumn`.
*/
setStartPosition(startLineNumber: number, startColumn: number): Selection;
/**
* Create a `Selection` from one or two positions
*/
static fromPositions(start: IPosition, end?: IPosition): Selection;
/**
* Create a `Selection` from an `ISelection`.
*/
static liftSelection(sel: ISelection): Selection;
/**
* `a` equals `b`.
*/
static selectionsArrEqual(a: ISelection[], b: ISelection[]): boolean;
/**
* Test if `obj` is an `ISelection`.
*/
static isISelection(obj: any): obj is ISelection;
/**
* Create with a direction.
*/
static createWithDirection(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number, direction: SelectionDirection): Selection;
}
/**
* The direction of a selection.
*/
export enum SelectionDirection {
/**
* The selection starts above where it ends.
*/
LTR = 0,
/**
* The selection starts below where it ends.
*/
RTL = 1
}
export class Token {
_tokenBrand: void;
readonly offset: number;
readonly type: string;
readonly language: string;
constructor(offset: number, type: string, language: string);
toString(): string;
}
}
declare namespace monaco.editor {
/**
* Create a new editor under `domElement`.
* `domElement` should be empty (not contain other dom nodes).
* The editor will read the size of `domElement`.
*/
export function create(domElement: HTMLElement, options?: IEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneCodeEditor;
/**
* Emitted when an editor is created.
* Creating a diff editor might cause this listener to be invoked with the two editors.
* @event
*/
export function onDidCreateEditor(listener: (codeEditor: ICodeEditor) => void): IDisposable;
/**
* Create a new diff editor under `domElement`.
* `domElement` should be empty (not contain other dom nodes).
* The editor will read the size of `domElement`.
*/
export function createDiffEditor(domElement: HTMLElement, options?: IDiffEditorConstructionOptions, override?: IEditorOverrideServices): IStandaloneDiffEditor;
export interface IDiffNavigator {
canNavigate(): boolean;
next(): void;
previous(): void;
dispose(): void;
}
export interface IDiffNavigatorOptions {
readonly followsCaret?: boolean;
readonly ignoreCharChanges?: boolean;
readonly alwaysRevealFirst?: boolean;
}
export function createDiffNavigator(diffEditor: IStandaloneDiffEditor, opts?: IDiffNavigatorOptions): IDiffNavigator;
/**
* Create a new editor model.
* You can specify the language that should be set for this model or let the language be inferred from the `uri`.
*/
export function createModel(value: string, language?: string, uri?: Uri): ITextModel;
/**
* Change the language for a model.
*/
export function setModelLanguage(model: ITextModel, languageId: string): void;
/**
* Set the markers for a model.
*/
export function setModelMarkers(model: ITextModel, owner: string, markers: IMarkerData[]): void;
/**
* Get markers for owner and/or resource
* @returns {IMarker[]} list of markers
* @param filter
*/
export function getModelMarkers(filter: {
owner?: string;
resource?: Uri;
take?: number;
}): IMarker[];
/**
* Get the model that has `uri` if it exists.
*/
export function getModel(uri: Uri): ITextModel | null;
/**
* Get all the created models.
*/
export function getModels(): ITextModel[];
/**
* Emitted when a model is created.
* @event
*/
export function onDidCreateModel(listener: (model: ITextModel) => void): IDisposable;
/**
* Emitted right before a model is disposed.
* @event
*/
export function onWillDisposeModel(listener: (model: ITextModel) => void): IDisposable;
/**
* Emitted when a different language is set to a model.
* @event
*/
export function onDidChangeModelLanguage(listener: (e: {
readonly model: ITextModel;
readonly oldLanguage: string;
}) => void): IDisposable;
/**
* Create a new web worker that has model syncing capabilities built in.
* Specify an AMD module to load that will `create` an object that will be proxied.
*/
export function createWebWorker<T>(opts: IWebWorkerOptions): MonacoWebWorker<T>;
/**
* Colorize the contents of `domNode` using attribute `data-lang`.
*/
export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): Promise<void>;
/**
* Colorize `text` using language `languageId`.
*/
export function colorize(text: string, languageId: string, options: IColorizerOptions): Promise<string>;
/**
* Colorize a line in a model.
*/
export function colorizeModelLine(model: ITextModel, lineNumber: number, tabSize?: number): string;
/**
* Tokenize `text` using language `languageId`
*/
export function tokenize(text: string, languageId: string): Token[][];
/**
* Define a new theme or update an existing theme.
*/
export function defineTheme(themeName: string, themeData: IStandaloneThemeData): void;
/**
* Switches to a theme.
*/
export function setTheme(themeName: string): void;
export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black';
export interface IStandaloneThemeData {
base: BuiltinTheme;
inherit: boolean;
rules: ITokenThemeRule[];
encodedTokensColors?: string[];
colors: IColors;
}
export type IColors = {
[colorId: string]: string;
};
export interface ITokenThemeRule {
token: string;
foreground?: string;
background?: string;
fontStyle?: string;
}
/**
* A web worker that can provide a proxy to an arbitrary file.
*/
export interface MonacoWebWorker<T> {
/**
* Terminate the web worker, thus invalidating the returned proxy.
*/
dispose(): void;
/**
* Get a proxy to the arbitrary loaded code.
*/
getProxy(): Promise<T>;
/**
* Synchronize (send) the models at `resources` to the web worker,
* making them available in the monaco.worker.getMirrorModels().
*/
withSyncedResources(resources: Uri[]): Promise<T>;
}
export interface IWebWorkerOptions {
/**
* The AMD moduleId to load.
* It should export a function `create` that should return the exported proxy.
*/
moduleId: string;
/**
* The data to send over when calling create on the module.
*/
createData?: any;
/**
* A label to be used to identify the web worker for debugging purposes.
*/