-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMonaco.fs
More file actions
5049 lines (4658 loc) · 286 KB
/
Monaco.fs
File metadata and controls
5049 lines (4658 loc) · 286 KB
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
// ts2fable 0.0.0
module rec Monaco
#nowarn "3390" // disable warnings for invalid XML comments
#nowarn "0044" // disable warnings for `Obsolete` usage
open System
open Fable.Core
open Fable.Core.JS
open Browser.Types
type Array<'T> = System.Collections.Generic.IList<'T>
type PromiseLike<'T> = Fable.Core.JS.Promise<'T>
type ReadonlyArray<'T> = System.Collections.Generic.IReadOnlyList<'T>
type RegExp = System.Text.RegularExpressions.Regex
let [<Import("MonacoEnvironment","monaco-editor")>] MonacoEnvironment: Monaco.Environment option = jsNative
module Monaco =
let [<Import("editor","monaco-editor/monaco")>] editor: Editor.IExports = jsNative
let [<Import("languages","monaco-editor/monaco")>] languages: Languages.IExports = jsNative
type [<AllowNullLiteral>] IExports =
/// A helper that allows to emit and listen to typed events
abstract Emitter: EmitterStatic
abstract CancellationTokenSource: CancellationTokenSourceStatic
/// <summary>
/// Uniform Resource Identifier (Uri) <see href="http://tools.ietf.org/html/rfc3986." />
/// This class is a simple parser which creates the basic component parts
/// (<see href="http://tools.ietf.org/html/rfc3986#section-3)" /> with minimal validation
/// and encoding.
///
/// <code lang="txt">
/// foo://example.com:8042/over/there?name=ferret#nose
/// \_/ \______________/\_________/ \_________/ \__/
/// | | | | |
/// scheme authority path query fragment
/// | _____________________|__
/// / \ / \
/// urn:example:animal:ferret:nose
/// </code>
/// </summary>
abstract Uri: UriStatic
abstract KeyMod: KeyModStatic
/// A position in the editor.
abstract Position: PositionStatic
/// A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)
abstract Range: RangeStatic
/// A selection in the editor.
/// The selection is a range that has an orientation.
abstract Selection: SelectionStatic
abstract Token: TokenStatic
type Thenable<'T> =
PromiseLike<'T>
type [<AllowNullLiteral>] Environment =
abstract baseUrl: string option with get, set
abstract getWorker: workerId: string * label: string -> Worker
abstract getWorkerUrl: workerId: string * label: string -> string
type [<AllowNullLiteral>] IDisposable =
abstract dispose: unit -> unit
type [<AllowNullLiteral>] IEvent<'T> =
[<Emit("$0($1...)")>] abstract Invoke: listener: ('T -> obj option) * ?thisArg: obj -> IDisposable
/// A helper that allows to emit and listen to typed events
type [<AllowNullLiteral>] Emitter<'T> =
abstract ``event``: IEvent<'T>
abstract fire: ``event``: 'T -> unit
abstract dispose: unit -> unit
/// A helper that allows to emit and listen to typed events
type [<AllowNullLiteral>] EmitterStatic =
[<EmitConstructor>] abstract Create: unit -> Emitter<'T>
type [<RequireQualifiedAccess>] MarkerTag =
| Unnecessary = 1
| Deprecated = 2
type [<RequireQualifiedAccess>] MarkerSeverity =
| Hint = 1
| Info = 2
| Warning = 4
| Error = 8
type [<AllowNullLiteral>] CancellationTokenSource =
abstract token: CancellationToken
abstract cancel: unit -> unit
abstract dispose: ?cancel: bool -> unit
type [<AllowNullLiteral>] CancellationTokenSourceStatic =
[<EmitConstructor>] abstract Create: ?parent: CancellationToken -> CancellationTokenSource
type [<AllowNullLiteral>] CancellationToken =
/// A flag signalling is cancellation has been requested.
abstract isCancellationRequested: bool
/// <summary>
/// An event which fires when cancellation is requested. This event
/// only ever fires <c>once</c> as cancellation can only happen once. Listeners
/// that are registered after cancellation will be called (next event loop run),
/// but also only once.
/// </summary>
abstract onCancellationRequested: (obj option -> obj option) -> (obj) option -> (ResizeArray<IDisposable>) option -> IDisposable
/// <summary>
/// Uniform Resource Identifier (Uri) <see href="http://tools.ietf.org/html/rfc3986." />
/// This class is a simple parser which creates the basic component parts
/// (<see href="http://tools.ietf.org/html/rfc3986#section-3)" /> with minimal validation
/// and encoding.
///
/// <code lang="txt">
/// foo://example.com:8042/over/there?name=ferret#nose
/// \_/ \______________/\_________/ \_________/ \__/
/// | | | | |
/// scheme authority path query fragment
/// | _____________________|__
/// / \ / \
/// urn:example:animal:ferret:nose
/// </code>
/// </summary>
type [<AllowNullLiteral>] Uri =
inherit UriComponents
/// <summary>
/// scheme is the 'http' part of '<see href="http://www.msft.com/some/path?query#fragment'." />
/// The part before the first colon.
/// </summary>
abstract scheme: string
/// <summary>
/// authority is the 'www.msft.com' part of '<see href="http://www.msft.com/some/path?query#fragment'." />
/// The part between the first double slashes and the next slash.
/// </summary>
abstract authority: string
/// <summary>path is the '/some/path' part of '<see href="http://www.msft.com/some/path?query#fragment'." /></summary>
abstract path: string
/// <summary>query is the 'query' part of '<see href="http://www.msft.com/some/path?query#fragment'." /></summary>
abstract query: string
/// <summary>fragment is the 'fragment' part of '<see href="http://www.msft.com/some/path?query#fragment'." /></summary>
abstract fragment: string
/// <summary>
/// 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 <c>Uri#path</c> 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).
///
/// <code lang="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'
/// </code>
///
/// Using <c>Uri#path</c> to read a file (using fs-apis) would not be enough because parts of the path,
/// namely the server name, would be missing. Therefore <c>Uri#fsPath</c> exists - it's sugar to ease working
/// with URIs that represent files on disk (<c>file</c> scheme).
/// </summary>
abstract fsPath: string
abstract ``with``: change: UriWithChange -> Uri
/// <summary>
/// Creates a string representation for this Uri. It's guaranteed that calling
/// <c>Uri.parse</c> 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.
/// </summary>
/// <param name="skipEncoding">Do not encode the result, default is <c>false</c></param>
abstract toString: ?skipEncoding: bool -> string
abstract toJSON: unit -> UriComponents
type [<AllowNullLiteral>] UriWithChange =
abstract scheme: string option with get, set
abstract authority: string option with get, set
abstract path: string option with get, set
abstract query: string option with get, set
abstract fragment: string option with get, set
/// <summary>
/// Uniform Resource Identifier (Uri) <see href="http://tools.ietf.org/html/rfc3986." />
/// This class is a simple parser which creates the basic component parts
/// (<see href="http://tools.ietf.org/html/rfc3986#section-3)" /> with minimal validation
/// and encoding.
///
/// <code lang="txt">
/// foo://example.com:8042/over/there?name=ferret#nose
/// \_/ \______________/\_________/ \_________/ \__/
/// | | | | |
/// scheme authority path query fragment
/// | _____________________|__
/// / \ / \
/// urn:example:animal:ferret:nose
/// </code>
/// </summary>
type [<AllowNullLiteral>] UriStatic =
[<EmitConstructor>] abstract Create: unit -> Uri
abstract isUri: thing: obj option -> bool
/// <summary>
/// Creates a new Uri from a string, e.g. <c>http://www.msft.com/some/path</c>,
/// <c>file:///usr/home</c>, or <c>scheme:with/path</c>.
/// </summary>
/// <param name="value">A string which represents an Uri (see <c>Uri#toString</c>).</param>
abstract parse: value: string * ?_strict: bool -> Uri
/// <summary>
/// Creates a new Uri from a file system path, e.g. <c>c:\my\files</c>,
/// <c>/usr/home</c>, or <c>\\server\share\some\path</c>.
///
/// The *difference* between <c>Uri#parse</c> and <c>Uri#file</c> is that the latter treats the argument
/// as path, not as stringified-uri. E.g. <c>Uri.file(path)</c> is **not the same as**
/// <c>Uri.parse('file://' + path)</c> because the path might contain characters that are
/// interpreted (# and ?). See the following sample:
/// <code lang="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';
/// </code>
/// </summary>
/// <param name="path">A file system path (see <c>Uri#fsPath</c>)</param>
abstract file: path: string -> Uri
abstract from: components: UriStaticFromComponents -> Uri
/// <summary>Join a Uri path with path fragments and normalizes the resulting path.</summary>
/// <param name="uri">The input Uri.</param>
/// <param name="pathFragment">The path fragment to add to the Uri path.</param>
/// <returns>The resulting Uri.</returns>
abstract joinPath: uri: Uri * [<ParamArray>] pathFragment: string[] -> Uri
abstract revive: data: U2<UriComponents, Uri> -> Uri
abstract revive: data: U2<UriComponents, Uri> option -> Uri option
type [<AllowNullLiteral>] UriStaticFromComponents =
abstract scheme: string with get, set
abstract authority: string option with get, set
abstract path: string option with get, set
abstract query: string option with get, set
abstract fragment: string option with get, set
type [<AllowNullLiteral>] UriComponents =
abstract scheme: string with get, set
abstract authority: string with get, set
abstract path: string with get, set
abstract query: string with get, set
abstract fragment: string with get, set
/// <summary>
/// Virtual Key Codes, the value does not hold any inherent meaning.
/// Inspired somewhat from <see href="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.
/// </summary>
type [<RequireQualifiedAccess>] 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
type [<AllowNullLiteral>] KeyMod =
interface end
type [<AllowNullLiteral>] KeyModStatic =
[<EmitConstructor>] abstract Create: unit -> KeyMod
abstract CtrlCmd: float
abstract Shift: float
abstract Alt: float
abstract WinCtrl: float
abstract chord: firstPart: float * secondPart: float -> float
type [<AllowNullLiteral>] IMarkdownString =
abstract value: string
abstract isTrusted: bool option
abstract supportThemeIcons: bool option
abstract uris: IMarkdownStringUris option with get, set
type [<AllowNullLiteral>] IKeyboardEvent =
abstract _standardKeyboardEventBrand: bool
abstract browserEvent: KeyboardEvent
abstract target: HTMLElement
abstract ctrlKey: bool
abstract shiftKey: bool
abstract altKey: bool
abstract metaKey: bool
abstract keyCode: KeyCode
abstract code: string
abstract equals: keybinding: float -> bool
abstract preventDefault: unit -> unit
abstract stopPropagation: unit -> unit
type [<AllowNullLiteral>] IMouseEvent =
abstract browserEvent: MouseEvent
abstract leftButton: bool
abstract middleButton: bool
abstract rightButton: bool
abstract buttons: float
abstract target: HTMLElement
abstract detail: float
abstract posx: float
abstract posy: float
abstract ctrlKey: bool
abstract shiftKey: bool
abstract altKey: bool
abstract metaKey: bool
abstract timestamp: float
abstract preventDefault: unit -> unit
abstract stopPropagation: unit -> unit
type [<AllowNullLiteral>] IScrollEvent =
abstract scrollTop: float
abstract scrollLeft: float
abstract scrollWidth: float
abstract scrollHeight: float
abstract scrollTopChanged: bool
abstract scrollLeftChanged: bool
abstract scrollWidthChanged: bool
abstract scrollHeightChanged: bool
/// A position in the editor. This interface is suitable for serialization.
type [<AllowNullLiteral>] IPosition =
/// line number (starts at 1)
abstract lineNumber: float
/// column (the first character in a line is between column 1 and column 2)
abstract column: float
/// A position in the editor.
type [<AllowNullLiteral>] Position =
/// line number (starts at 1)
abstract lineNumber: float
/// column (the first character in a line is between column 1 and column 2)
abstract column: float
/// <summary>Create a new position from this position.</summary>
/// <param name="newLineNumber">new line number</param>
/// <param name="newColumn">new column</param>
abstract ``with``: ?newLineNumber: float * ?newColumn: float -> Position
/// <summary>Derive a new position from this position.</summary>
/// <param name="deltaLineNumber">line number delta</param>
/// <param name="deltaColumn">column delta</param>
abstract delta: ?deltaLineNumber: float * ?deltaColumn: float -> Position
/// Test if this position equals other position
abstract equals: other: IPosition -> bool
/// Test if this position is before other position.
/// If the two positions are equal, the result will be false.
abstract isBefore: other: IPosition -> bool
/// Test if this position is before other position.
/// If the two positions are equal, the result will be true.
abstract isBeforeOrEqual: other: IPosition -> bool
/// Clone this position.
abstract clone: unit -> Position
/// Convert to a human-readable representation.
abstract toString: unit -> string
/// A position in the editor.
type [<AllowNullLiteral>] PositionStatic =
[<EmitConstructor>] abstract Create: lineNumber: float * column: float -> Position
/// <summary>Test if position <c>a</c> equals position <c>b</c></summary>
abstract equals: a: IPosition option * b: IPosition option -> bool
/// <summary>
/// Test if position <c>a</c> is before position <c>b</c>.
/// If the two positions are equal, the result will be false.
/// </summary>
abstract isBefore: a: IPosition * b: IPosition -> bool
/// <summary>
/// Test if position <c>a</c> is before position <c>b</c>.
/// If the two positions are equal, the result will be true.
/// </summary>
abstract isBeforeOrEqual: a: IPosition * b: IPosition -> bool
/// A function that compares positions, useful for sorting
abstract compare: a: IPosition * b: IPosition -> float
/// <summary>Create a <c>Position</c> from an <c>IPosition</c>.</summary>
abstract lift: pos: IPosition -> Position
/// <summary>Test if <c>obj</c> is an <c>IPosition</c>.</summary>
abstract isIPosition: obj: obj option -> bool
/// A range in the editor. This interface is suitable for serialization.
type [<AllowNullLiteral>] IRange =
/// Line number on which the range starts (starts at 1).
abstract startLineNumber: float
/// <summary>Column on which the range starts in line <c>startLineNumber</c> (starts at 1).</summary>
abstract startColumn: float
/// Line number on which the range ends.
abstract endLineNumber: float
/// <summary>Column on which the range ends in line <c>endLineNumber</c>.</summary>
abstract endColumn: float
/// A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)
type [<AllowNullLiteral>] Range =
/// Line number on which the range starts (starts at 1).
abstract startLineNumber: float
/// <summary>Column on which the range starts in line <c>startLineNumber</c> (starts at 1).</summary>
abstract startColumn: float
/// Line number on which the range ends.
abstract endLineNumber: float
/// <summary>Column on which the range ends in line <c>endLineNumber</c>.</summary>
abstract endColumn: float
/// Test if this range is empty.
abstract isEmpty: unit -> bool
/// Test if position is in this range. If the position is at the edges, will return true.
abstract containsPosition: position: IPosition -> bool
/// Test if range is in this range. If the range is equal to this range, will return true.
abstract containsRange: range: IRange -> bool
/// <summary>Test if <c>range</c> is strictly in this range. <c>range</c> must start after and end before this range for the result to be true.</summary>
abstract strictContainsRange: range: IRange -> bool
/// A reunion of the two ranges.
/// The smallest position will be used as the start point, and the largest one as the end point.
abstract plusRange: range: IRange -> Range
/// A intersection of the two ranges.
abstract intersectRanges: range: IRange -> Range option
/// Test if this range equals other.
abstract equalsRange: other: IRange option -> bool
/// Return the end position (which will be after or equal to the start position)
abstract getEndPosition: unit -> Position
/// Return the start position (which will be before or equal to the end position)
abstract getStartPosition: unit -> Position
/// Transform to a user presentable string representation.
abstract toString: unit -> string
/// Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.
abstract setEndPosition: endLineNumber: float * endColumn: float -> Range
/// Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.
abstract setStartPosition: startLineNumber: float * startColumn: float -> Range
/// Create a new empty range using this range's start position.
abstract collapseToStart: unit -> Range
/// A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)
type [<AllowNullLiteral>] RangeStatic =
[<EmitConstructor>] abstract Create: startLineNumber: float * startColumn: float * endLineNumber: float * endColumn: float -> Range
/// <summary>Test if <c>range</c> is empty.</summary>
abstract isEmpty: range: IRange -> bool
/// <summary>Test if <c>position</c> is in <c>range</c>. If the position is at the edges, will return true.</summary>
abstract containsPosition: range: IRange * position: IPosition -> bool
/// <summary>Test if <c>otherRange</c> is in <c>range</c>. If the ranges are equal, will return true.</summary>
abstract containsRange: range: IRange * otherRange: IRange -> bool
/// <summary>Test if <c>otherRange</c> is strinctly in <c>range</c> (must start after, and end before). If the ranges are equal, will return false.</summary>
abstract strictContainsRange: range: IRange * otherRange: IRange -> bool
/// A reunion of the two ranges.
/// The smallest position will be used as the start point, and the largest one as the end point.
abstract plusRange: a: IRange * b: IRange -> Range
/// A intersection of the two ranges.
abstract intersectRanges: a: IRange * b: IRange -> Range option
/// <summary>Test if range <c>a</c> equals <c>b</c>.</summary>
abstract equalsRange: a: IRange option * b: IRange option -> bool
/// Return the end position (which will be after or equal to the start position)
abstract getEndPosition: range: IRange -> Position
/// Return the start position (which will be before or equal to the end position)
abstract getStartPosition: range: IRange -> Position
/// Create a new empty range using this range's start position.
abstract collapseToStart: range: IRange -> Range
abstract fromPositions: start: IPosition * ?``end``: IPosition -> Range
/// <summary>Create a <c>Range</c> from an <c>IRange</c>.</summary>
abstract lift: range: obj -> obj
abstract lift: range: IRange -> Range
/// <summary>Test if <c>obj</c> is an <c>IRange</c>.</summary>
abstract isIRange: obj: obj option -> bool
/// Test if the two ranges are touching in any way.
abstract areIntersectingOrTouching: a: IRange * b: IRange -> bool
/// Test if the two ranges are intersecting. If the ranges are touching it returns true.
abstract areIntersecting: a: IRange * b: IRange -> bool
/// A function that compares ranges, useful for sorting ranges
/// It will first compare ranges on the startPosition and then on the endPosition
abstract compareRangesUsingStarts: a: IRange option * b: IRange option -> float
/// A function that compares ranges, useful for sorting ranges
/// It will first compare ranges on the endPosition and then on the startPosition
abstract compareRangesUsingEnds: a: IRange * b: IRange -> float
/// Test if the range spans multiple lines.
abstract spansMultipleLines: range: IRange -> bool
/// A selection in the editor.
/// The selection is a range that has an orientation.
type [<AllowNullLiteral>] ISelection =
/// The line number on which the selection has started.
abstract selectionStartLineNumber: float
/// <summary>The column on <c>selectionStartLineNumber</c> where the selection has started.</summary>
abstract selectionStartColumn: float
/// The line number on which the selection has ended.
abstract positionLineNumber: float
/// <summary>The column on <c>positionLineNumber</c> where the selection has ended.</summary>
abstract positionColumn: float
/// A selection in the editor.
/// The selection is a range that has an orientation.
type [<AllowNullLiteral>] Selection =
inherit Range
/// The line number on which the selection has started.
abstract selectionStartLineNumber: float
/// <summary>The column on <c>selectionStartLineNumber</c> where the selection has started.</summary>
abstract selectionStartColumn: float
/// The line number on which the selection has ended.
abstract positionLineNumber: float
/// <summary>The column on <c>positionLineNumber</c> where the selection has ended.</summary>
abstract positionColumn: float
/// Transform to a human-readable representation.
abstract toString: unit -> string
/// Test if equals other selection.
abstract equalsSelection: other: ISelection -> bool
/// Get directions (LTR or RTL).
abstract getDirection: unit -> SelectionDirection
/// <summary>Create a new selection with a different <c>positionLineNumber</c> and <c>positionColumn</c>.</summary>
abstract setEndPosition: endLineNumber: float * endColumn: float -> Selection
/// <summary>Get the position at <c>positionLineNumber</c> and <c>positionColumn</c>.</summary>
abstract getPosition: unit -> Position
/// <summary>Create a new selection with a different <c>selectionStartLineNumber</c> and <c>selectionStartColumn</c>.</summary>
abstract setStartPosition: startLineNumber: float * startColumn: float -> Selection
/// A selection in the editor.
/// The selection is a range that has an orientation.
type [<AllowNullLiteral>] SelectionStatic =
[<EmitConstructor>] abstract Create: selectionStartLineNumber: float * selectionStartColumn: float * positionLineNumber: float * positionColumn: float -> Selection
/// Test if the two selections are equal.
abstract selectionsEqual: a: ISelection * b: ISelection -> bool
/// <summary>Create a <c>Selection</c> from one or two positions</summary>
abstract fromPositions: start: IPosition * ?``end``: IPosition -> Selection
/// <summary>Create a <c>Selection</c> from an <c>ISelection</c>.</summary>
abstract liftSelection: sel: ISelection -> Selection
/// <summary><c>a</c> equals <c>b</c>.</summary>
abstract selectionsArrEqual: a: ResizeArray<ISelection> * b: ResizeArray<ISelection> -> bool
/// <summary>Test if <c>obj</c> is an <c>ISelection</c>.</summary>
abstract isISelection: obj: obj option -> bool
/// Create with a direction.
abstract createWithDirection: startLineNumber: float * startColumn: float * endLineNumber: float * endColumn: float * direction: SelectionDirection -> Selection
/// The direction of a selection.
type [<RequireQualifiedAccess>] SelectionDirection =
/// The selection starts above where it ends.
| LTR = 0
/// The selection starts below where it ends.
| RTL = 1
type [<AllowNullLiteral>] Token =
abstract _tokenBrand: unit with get, set
abstract offset: float
abstract ``type``: string
abstract language: string
abstract toString: unit -> string
type [<AllowNullLiteral>] TokenStatic =
[<EmitConstructor>] abstract Create: offset: float * ``type``: string * language: string -> Token
module Editor =
type [<AllowNullLiteral>] IExports =
/// <summary>
/// Create a new editor under <c>domElement</c>.
/// <c>domElement</c> should be empty (not contain other dom nodes).
/// The editor will read the size of <c>domElement</c>.
/// </summary>
abstract create: domElement: HTMLElement * ?options: IStandaloneEditorConstructionOptions * ?``override``: IEditorOverrideServices -> IStandaloneCodeEditor
/// <summary>
/// Emitted when an editor is created.
/// Creating a diff editor might cause this listener to be invoked with the two editors.
/// </summary>
abstract onDidCreateEditor: listener: (ICodeEditor -> unit) -> IDisposable
/// <summary>
/// Create a new diff editor under <c>domElement</c>.
/// <c>domElement</c> should be empty (not contain other dom nodes).
/// The editor will read the size of <c>domElement</c>.
/// </summary>
abstract createDiffEditor: domElement: HTMLElement * ?options: IDiffEditorConstructionOptions * ?``override``: IEditorOverrideServices -> IStandaloneDiffEditor
abstract createDiffNavigator: diffEditor: IStandaloneDiffEditor * ?opts: IDiffNavigatorOptions -> IDiffNavigator
/// <summary>
/// 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 <c>uri</c>.
/// </summary>
abstract createModel: value: string * ?language: string * ?uri: Uri -> ITextModel
/// Change the language for a model.
abstract setModelLanguage: model: ITextModel * languageId: string -> unit
/// Set the markers for a model.
abstract setModelMarkers: model: ITextModel * owner: string * markers: ResizeArray<IMarkerData> -> unit
/// <summary>Get markers for owner and/or resource</summary>
/// <returns>list of markers</returns>
abstract getModelMarkers: filter: {| owner: string option; resource: Uri option; take: float option |} -> ResizeArray<IMarker>
/// <summary>Get the model that has <c>uri</c> if it exists.</summary>
abstract getModel: uri: Uri -> ITextModel option
/// Get all the created models.
abstract getModels: unit -> ResizeArray<ITextModel>
/// <summary>Emitted when a model is created.</summary>
abstract onDidCreateModel: listener: (ITextModel -> unit) -> IDisposable
/// <summary>Emitted right before a model is disposed.</summary>
abstract onWillDisposeModel: listener: (ITextModel -> unit) -> IDisposable
/// <summary>Emitted when a different language is set to a model.</summary>
abstract onDidChangeModelLanguage: listener: ({| model: ITextModel; oldLanguage: string |} -> unit) -> IDisposable
/// <summary>
/// Create a new web worker that has model syncing capabilities built in.
/// Specify an AMD module to load that will <c>create</c> an object that will be proxied.
/// </summary>
abstract createWebWorker: opts: IWebWorkerOptions -> MonacoWebWorker<'T>
/// <summary>Colorize the contents of <c>domNode</c> using attribute <c>data-lang</c>.</summary>
abstract colorizeElement: domNode: HTMLElement * options: IColorizerElementOptions -> Promise<unit>
/// <summary>Colorize <c>text</c> using language <c>languageId</c>.</summary>
abstract colorize: text: string * languageId: string * options: IColorizerOptions -> Promise<string>
/// Colorize a line in a model.
abstract colorizeModelLine: model: ITextModel * lineNumber: float * ?tabSize: float -> string
/// <summary>Tokenize <c>text</c> using language <c>languageId</c></summary>
abstract tokenize: text: string * languageId: string -> ResizeArray<ResizeArray<Token>>
/// Define a new theme or update an existing theme.
abstract defineTheme: themeName: string * themeData: IStandaloneThemeData -> unit
/// Switches to a theme.
abstract setTheme: themeName: string -> unit
/// Clears all cached font measurements and triggers re-measurement.
abstract remeasureFonts: unit -> unit
abstract TextModelResolvedOptions: TextModelResolvedOptionsStatic
abstract FindMatch: FindMatchStatic
/// <summary>The type of the <c>IEditor</c>.</summary>
abstract EditorType: {| ICodeEditor: string; IDiffEditor: string |}
/// An event describing that the configuration of the editor has changed.
abstract ConfigurationChangedEvent: ConfigurationChangedEventStatic
abstract EditorOptions: IExportsEditorOptions
abstract FontInfo: FontInfoStatic
abstract BareFontInfo: BareFontInfoStatic
type [<AllowNullLiteral>] IDiffNavigator =
abstract canNavigate: unit -> bool
abstract next: unit -> unit
abstract previous: unit -> unit
abstract dispose: unit -> unit
type [<AllowNullLiteral>] IDiffNavigatorOptions =
abstract followsCaret: bool option
abstract ignoreCharChanges: bool option
abstract alwaysRevealFirst: bool option
type [<StringEnum>] [<RequireQualifiedAccess>] BuiltinTheme =
| Vs
| [<CompiledName("vs-dark")>] VsDark
| [<CompiledName("hc-black")>] HcBlack
type [<AllowNullLiteral>] IStandaloneThemeData =
abstract ``base``: BuiltinTheme with get, set
abstract ``inherit``: bool with get, set
abstract rules: ResizeArray<ITokenThemeRule> with get, set
abstract encodedTokensColors: ResizeArray<string> option with get, set
abstract colors: IColors with get, set
type [<AllowNullLiteral>] IColors =
[<EmitIndexer>] abstract Item: colorId: string -> string with get, set
type [<AllowNullLiteral>] ITokenThemeRule =
abstract token: string with get, set
abstract foreground: string option with get, set
abstract background: string option with get, set
abstract fontStyle: string option with get, set
/// A web worker that can provide a proxy to an arbitrary file.
type [<AllowNullLiteral>] MonacoWebWorker<'T> =
/// Terminate the web worker, thus invalidating the returned proxy.
abstract dispose: unit -> unit
/// Get a proxy to the arbitrary loaded code.
abstract getProxy: unit -> Promise<'T>
/// <summary>
/// Synchronize (send) the models at <c>resources</c> to the web worker,
/// making them available in the monaco.worker.getMirrorModels().
/// </summary>
abstract withSyncedResources: resources: ResizeArray<Uri> -> Promise<'T>
type [<AllowNullLiteral>] IWebWorkerOptions =
/// <summary>
/// The AMD moduleId to load.
/// It should export a function <c>create</c> that should return the exported proxy.
/// </summary>
abstract moduleId: string with get, set
/// The data to send over when calling create on the module.
abstract createData: obj option with get, set
/// A label to be used to identify the web worker for debugging purposes.
abstract label: string option with get, set
/// An object that can be used by the web worker to make calls back to the main thread.
abstract host: obj option with get, set
/// Keep idle models.
/// Defaults to false, which means that idle models will stop syncing after a while.
abstract keepIdleModels: bool option with get, set
/// Description of an action contribution
type [<AllowNullLiteral>] IActionDescriptor =
/// An unique identifier of the contributed action.
abstract id: string with get, set
/// A label of the action that will be presented to the user.
abstract label: string with get, set
/// Precondition rule.
abstract precondition: string option with get, set
/// An array of keybindings for the action.
abstract keybindings: ResizeArray<float> option with get, set
/// The keybinding rule (condition on top of precondition).
abstract keybindingContext: string option with get, set
/// Control if the action should show up in the context menu and where.
/// The context menu of the editor has these default:
/// navigation - The navigation group comes first in all cases.
/// 1_modification - This group comes next and contains commands that modify your code.
/// 9_cutcopypaste - The last default group with the basic editing commands.
/// You can also create your own group.
/// Defaults to null (don't show in context menu).
abstract contextMenuGroupId: string option with get, set
/// Control the order in the context menu group.
abstract contextMenuOrder: float option with get, set
/// <summary>Method that will be executed when the action is triggered.</summary>
/// <param name="editor">The editor instance is passed in as a convenience</param>
abstract run: editor: ICodeEditor * [<ParamArray>] args: obj option[] -> U2<unit, Promise<unit>>
/// Options which apply for all editors.
type [<AllowNullLiteral>] IGlobalEditorOptions =
/// <summary>
/// The number of spaces a tab is equal to.
/// This setting is overridden based on the file contents when <c>detectIndentation</c> is on.
/// Defaults to 4.
/// </summary>
abstract tabSize: float option with get, set
/// <summary>
/// Insert spaces when pressing <c>Tab</c>.
/// This setting is overridden based on the file contents when <c>detectIndentation</c> is on.
/// Defaults to true.
/// </summary>
abstract insertSpaces: bool option with get, set
/// <summary>
/// Controls whether <c>tabSize</c> and <c>insertSpaces</c> will be automatically detected when a file is opened based on the file contents.
/// Defaults to true.
/// </summary>
abstract detectIndentation: bool option with get, set
/// Remove trailing auto inserted whitespace.
/// Defaults to true.
abstract trimAutoWhitespace: bool option with get, set
/// Special handling for large files to disable certain memory intensive features.
/// Defaults to true.
abstract largeFileOptimizations: bool option with get, set
/// Controls whether completions should be computed based on words in the document.
/// Defaults to true.
abstract wordBasedSuggestions: bool option with get, set
/// Controls whether the semanticHighlighting is shown for the languages that support it.
/// true: semanticHighlighting is enabled for all themes
/// false: semanticHighlighting is disabled for all themes
/// 'configuredByTheme': semanticHighlighting is controlled by the current color theme's semanticHighlighting setting.
/// Defaults to 'byTheme'.
abstract ``semanticHighlighting.enabled``: IGlobalEditorOptionsSemanticHighlightingEnabled option with get, set
/// <summary>
/// Keep peek editors open even when double clicking their content or when hitting <c>Escape</c>.
/// Defaults to false.
/// </summary>
abstract stablePeek: bool option with get, set
/// Lines above this length will not be tokenized for performance reasons.
/// Defaults to 20000.
abstract maxTokenizationLineLength: float option with get, set
/// <summary>
/// Theme to be used for rendering.
/// The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
/// You can create custom themes via <c>monaco.editor.defineTheme</c>.
/// To switch a theme, use <c>monaco.editor.setTheme</c>
/// </summary>
abstract theme: string option with get, set
/// The options to create an editor.
type [<AllowNullLiteral>] IStandaloneEditorConstructionOptions =
inherit IEditorConstructionOptions
inherit IGlobalEditorOptions
/// The initial model associated with this code editor.
abstract model: ITextModel option with get, set
/// <summary>
/// The initial value of the auto created model in the editor.
/// To not create automatically a model, use <c>model: null</c>.
/// </summary>
abstract value: string option with get, set
/// <summary>
/// The initial language of the auto created model in the editor.
/// To not create automatically a model, use <c>model: null</c>.
/// </summary>
abstract language: string option with get, set
/// <summary>
/// Initial theme to be used for rendering.
/// The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
/// You can create custom themes via <c>monaco.editor.defineTheme</c>.
/// To switch a theme, use <c>monaco.editor.setTheme</c>
/// </summary>
abstract theme: string option with get, set
/// <summary>
/// An URL to open when Ctrl+H (Windows and Linux) or Cmd+H (OSX) is pressed in
/// the accessibility help dialog in the editor.
///
/// Defaults to "<see href="https://go.microsoft.com/fwlink/?linkid=852450"" />
/// </summary>
abstract accessibilityHelpUrl: string option with get, set
/// The options to create a diff editor.
type [<AllowNullLiteral>] IDiffEditorConstructionOptions =
inherit IDiffEditorOptions
/// <summary>
/// Initial theme to be used for rendering.
/// The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
/// You can create custom themes via <c>monaco.editor.defineTheme</c>.
/// To switch a theme, use <c>monaco.editor.setTheme</c>
/// </summary>
abstract theme: string option with get, set
/// Place overflow widgets inside an external DOM node.
/// Defaults to an internal DOM node.
abstract overflowWidgetsDomNode: HTMLElement option with get, set
type [<AllowNullLiteral>] IStandaloneCodeEditor =
inherit ICodeEditor
/// Update the editor's options after the editor has been created.
abstract updateOptions: newOptions: obj -> unit
abstract addCommand: keybinding: float * handler: ICommandHandler * ?context: string -> string option
abstract createContextKey: key: string * defaultValue: 'T -> IContextKey<'T>
abstract addAction: descriptor: IActionDescriptor -> IDisposable
type [<AllowNullLiteral>] IStandaloneDiffEditor =
inherit IDiffEditor
abstract addCommand: keybinding: float * handler: ICommandHandler * ?context: string -> string option
abstract createContextKey: key: string * defaultValue: 'T -> IContextKey<'T>
abstract addAction: descriptor: IActionDescriptor -> IDisposable
/// <summary>Get the <c>original</c> editor.</summary>
abstract getOriginalEditor: unit -> IStandaloneCodeEditor
/// <summary>Get the <c>modified</c> editor.</summary>
abstract getModifiedEditor: unit -> IStandaloneCodeEditor
type [<AllowNullLiteral>] ICommandHandler =
[<Emit("$0($1...)")>] abstract Invoke: [<ParamArray>] args: obj option[] -> unit
type [<AllowNullLiteral>] IContextKey<'T> =
abstract set: value: 'T -> unit
abstract reset: unit -> unit
abstract get: unit -> 'T option
type [<AllowNullLiteral>] IEditorOverrideServices =
[<EmitIndexer>] abstract Item: index: string -> obj option with get, set
type [<AllowNullLiteral>] IMarker =
abstract owner: string with get, set
abstract resource: Uri with get, set
abstract severity: MarkerSeverity with get, set
abstract code: U2<string, {| value: string; target: Uri |}> option with get, set
abstract message: string with get, set
abstract source: string option with get, set
abstract startLineNumber: float with get, set
abstract startColumn: float with get, set
abstract endLineNumber: float with get, set
abstract endColumn: float with get, set
abstract relatedInformation: ResizeArray<IRelatedInformation> option with get, set
abstract tags: ResizeArray<MarkerTag> option with get, set
/// A structure defining a problem/warning/etc.
type [<AllowNullLiteral>] IMarkerData =
abstract code: U2<string, {| value: string; target: Uri |}> option with get, set
abstract severity: MarkerSeverity with get, set
abstract message: string with get, set
abstract source: string option with get, set
abstract startLineNumber: float with get, set
abstract startColumn: float with get, set
abstract endLineNumber: float with get, set
abstract endColumn: float with get, set
abstract relatedInformation: ResizeArray<IRelatedInformation> option with get, set
abstract tags: ResizeArray<MarkerTag> option with get, set
type [<AllowNullLiteral>] IRelatedInformation =
abstract resource: Uri with get, set
abstract message: string with get, set
abstract startLineNumber: float with get, set
abstract startColumn: float with get, set
abstract endLineNumber: float with get, set
abstract endColumn: float with get, set
type [<AllowNullLiteral>] IColorizerOptions =
abstract tabSize: float option with get, set