-
Notifications
You must be signed in to change notification settings - Fork 29.4k
/
editorOptions.ts
2227 lines (2090 loc) · 74 KB
/
editorOptions.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.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as nls from 'vs/nls';
import * as platform from 'vs/base/common/platform';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
import { FontInfo } from 'vs/editor/common/config/fontInfo';
import { Constants } from 'vs/editor/common/core/uint';
import { USUAL_WORD_SEPARATORS } from 'vs/editor/common/model/wordHelper';
/**
* Configuration options for editor scrollbars
*/
export interface IEditorScrollbarOptions {
/**
* The size of arrows (if displayed).
* Defaults to 11.
*/
arrowSize?: number;
/**
* Render vertical scrollbar.
* Accepted values: 'auto', 'visible', 'hidden'.
* Defaults to 'auto'.
*/
vertical?: string;
/**
* Render horizontal scrollbar.
* Accepted values: 'auto', 'visible', 'hidden'.
* Defaults to 'auto'.
*/
horizontal?: string;
/**
* Cast horizontal and vertical shadows when the content is scrolled.
* Defaults to true.
*/
useShadows?: boolean;
/**
* Render arrows at the top and bottom of the vertical scrollbar.
* Defaults to false.
*/
verticalHasArrows?: boolean;
/**
* Render arrows at the left and right of the horizontal scrollbar.
* Defaults to false.
*/
horizontalHasArrows?: boolean;
/**
* Listen to mouse wheel events and react to them by scrolling.
* Defaults to true.
*/
handleMouseWheel?: boolean;
/**
* Height in pixels for the horizontal scrollbar.
* Defaults to 10 (px).
*/
horizontalScrollbarSize?: number;
/**
* Width in pixels for the vertical scrollbar.
* Defaults to 10 (px).
*/
verticalScrollbarSize?: number;
/**
* Width in pixels for the vertical slider.
* Defaults to `verticalScrollbarSize`.
*/
verticalSliderSize?: number;
/**
* Height in pixels for the horizontal slider.
* Defaults to `horizontalScrollbarSize`.
*/
horizontalSliderSize?: number;
}
/**
* Configuration options for editor find widget
*/
export interface IEditorFindOptions {
/**
* Controls if we seed search string in the Find Widget with editor selection.
*/
seedSearchStringFromSelection?: boolean;
/**
* Controls if Find in Selection flag is turned on when multiple lines of text are selected in the editor.
*/
autoFindInSelection: boolean;
}
/**
* Configuration options for editor minimap
*/
export interface IEditorMinimapOptions {
/**
* Enable the rendering of the minimap.
* Defaults to false.
*/
enabled?: boolean;
/**
* Control the rendering of the minimap slider.
* Defaults to 'mouseover'.
*/
showSlider?: 'always' | 'mouseover';
/**
* Render the actual text on a line (as opposed to color blocks).
* Defaults to true.
*/
renderCharacters?: boolean;
/**
* Limit the width of the minimap to render at most a certain number of columns.
* Defaults to 120.
*/
maxColumn?: number;
}
/**
* Configuration options for editor minimap
*/
export interface IEditorLightbulbOptions {
/**
* Enable the lightbulb code action.
* Defaults to true.
*/
enabled?: boolean;
}
/**
* Configuration options for the editor.
*/
export interface IEditorOptions {
/**
* This editor is used inside a diff editor.
* @internal
*/
inDiffEditor?: boolean;
/**
* The aria label for the editor's textarea (when it is focused).
*/
ariaLabel?: string;
/**
* Render vertical lines at the specified columns.
* Defaults to empty array.
*/
rulers?: number[];
/**
* A string containing the word separators used when doing word navigation.
* Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?
*/
wordSeparators?: string;
/**
* Enable Linux primary clipboard.
* Defaults to true.
*/
selectionClipboard?: boolean;
/**
* Control the rendering of line numbers.
* If it is a function, it will be invoked when rendering a line number and the return value will be rendered.
* Otherwise, if it is a truey, line numbers will be rendered normally (equivalent of using an identity function).
* Otherwise, line numbers will not be rendered.
* Defaults to true.
*/
lineNumbers?: 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string);
/**
* Should the corresponding line be selected when clicking on the line number?
* Defaults to true.
*/
selectOnLineNumbers?: boolean;
/**
* Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits.
* Defaults to 5.
*/
lineNumbersMinChars?: number;
/**
* Enable the rendering of the glyph margin.
* Defaults to true in vscode and to false in monaco-editor.
*/
glyphMargin?: boolean;
/**
* The width reserved for line decorations (in px).
* Line decorations are placed between line numbers and the editor content.
* You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch.
* Defaults to 10.
*/
lineDecorationsWidth?: number | string;
/**
* When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle.
* This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport.
* Defaults to 30 (px).
*/
revealHorizontalRightPadding?: number;
/**
* Render the editor selection with rounded borders.
* Defaults to true.
*/
roundedSelection?: boolean;
/**
* Class name to be added to the editor.
*/
extraEditorClassName?: string;
/**
* Should the editor be read only.
* Defaults to false.
*/
readOnly?: boolean;
/**
* Control the behavior and rendering of the scrollbars.
*/
scrollbar?: IEditorScrollbarOptions;
/**
* Control the behavior and rendering of the minimap.
*/
minimap?: IEditorMinimapOptions;
/**
* Control the behavior of the find widget.
*/
find?: IEditorFindOptions;
/**
* Display overflow widgets as `fixed`.
* Defaults to `false`.
*/
fixedOverflowWidgets?: boolean;
/**
* The number of vertical lanes the overview ruler should render.
* Defaults to 2.
*/
overviewRulerLanes?: number;
/**
* Controls if a border should be drawn around the overview ruler.
* Defaults to `true`.
*/
overviewRulerBorder?: boolean;
/**
* Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'.
* Defaults to 'blink'.
*/
cursorBlinking?: string;
/**
* Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl.
* Defaults to false.
*/
mouseWheelZoom?: boolean;
/**
* Control the mouse pointer style, either 'text' or 'default' or 'copy'
* Defaults to 'text'
* @internal
*/
mouseStyle?: 'text' | 'default' | 'copy';
/**
* Control the cursor style, either 'block' or 'line'.
* Defaults to 'line'.
*/
cursorStyle?: string;
/**
* Enable font ligatures.
* Defaults to false.
*/
fontLigatures?: boolean;
/**
* Disable the use of `will-change` for the editor margin and lines layers.
* The usage of `will-change` acts as a hint for browsers to create an extra layer.
* Defaults to false.
*/
disableLayerHinting?: boolean;
/**
* Disable the optimizations for monospace fonts.
* Defaults to false.
*/
disableMonospaceOptimizations?: boolean;
/**
* Should the cursor be hidden in the overview ruler.
* Defaults to false.
*/
hideCursorInOverviewRuler?: boolean;
/**
* Enable that scrolling can go one screen size after the last line.
* Defaults to true.
*/
scrollBeyondLastLine?: boolean;
/**
* Enable that the editor animates scrolling to a position.
* Defaults to false.
*/
smoothScrolling?: boolean;
/**
* Enable that the editor will install an interval to check if its container dom node size has changed.
* Enabling this might have a severe performance impact.
* Defaults to false.
*/
automaticLayout?: boolean;
/**
* Control the wrapping of the editor.
* When `wordWrap` = "off", the lines will never wrap.
* When `wordWrap` = "on", the lines will wrap at the viewport width.
* When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
* When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
* Defaults to "off".
*/
wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded';
/**
* Control the wrapping of the editor.
* When `wordWrap` = "off", the lines will never wrap.
* When `wordWrap` = "on", the lines will wrap at the viewport width.
* When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.
* When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).
* Defaults to 80.
*/
wordWrapColumn?: number;
/**
* Force word wrapping when the text appears to be of a minified/generated file.
* Defaults to true.
*/
wordWrapMinified?: boolean;
/**
* Control indentation of wrapped lines. Can be: 'none', 'same' or 'indent'.
* Defaults to 'same' in vscode and to 'none' in monaco-editor.
*/
wrappingIndent?: string;
/**
* Configure word wrapping characters. A break will be introduced before these characters.
* Defaults to '{([+'.
*/
wordWrapBreakBeforeCharacters?: string;
/**
* Configure word wrapping characters. A break will be introduced after these characters.
* Defaults to ' \t})]?|&,;'.
*/
wordWrapBreakAfterCharacters?: string;
/**
* Configure word wrapping characters. A break will be introduced after these characters only if no `wordWrapBreakBeforeCharacters` or `wordWrapBreakAfterCharacters` were found.
* Defaults to '.'.
*/
wordWrapBreakObtrusiveCharacters?: string;
/**
* Performance guard: Stop rendering a line after x characters.
* Defaults to 10000.
* Use -1 to never stop rendering
*/
stopRenderingLineAfter?: number;
/**
* Enable hover.
* Defaults to true.
*/
hover?: boolean;
/**
* Enable detecting links and making them clickable.
* Defaults to true.
*/
links?: boolean;
/**
* Enable inline color decorators and color picker rendering.
*/
colorDecorators?: boolean;
/**
* Enable custom contextmenu.
* Defaults to true.
*/
contextmenu?: boolean;
/**
* A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.
* Defaults to 1.
*/
mouseWheelScrollSensitivity?: number;
/**
* The modifier to be used to add multiple cursors with the mouse.
* Defaults to 'alt'
*/
multiCursorModifier?: 'ctrlCmd' | 'alt';
/**
* Configure the editor's accessibility support.
* Defaults to 'auto'. It is best to leave this to 'auto'.
*/
accessibilitySupport?: 'auto' | 'off' | 'on';
/**
* Enable quick suggestions (shadow suggestions)
* Defaults to true.
*/
quickSuggestions?: boolean | { other: boolean, comments: boolean, strings: boolean };
/**
* Quick suggestions show delay (in ms)
* Defaults to 500 (ms)
*/
quickSuggestionsDelay?: number;
/**
* Enables parameter hints
*/
parameterHints?: boolean;
/**
* Render icons in suggestions box.
* Defaults to true.
*/
iconsInSuggestions?: boolean;
/**
* Enable auto closing brackets.
* Defaults to true.
*/
autoClosingBrackets?: boolean;
/**
* Enable auto indentation adjustment.
* Defaults to false.
*/
autoIndent?: boolean;
/**
* Enable format on type.
* Defaults to false.
*/
formatOnType?: boolean;
/**
* Enable format on paste.
* Defaults to false.
*/
formatOnPaste?: boolean;
/**
* Controls if the editor should allow to move selections via drag and drop.
* Defaults to false.
*/
dragAndDrop?: boolean;
/**
* Enable the suggestion box to pop-up on trigger characters.
* Defaults to true.
*/
suggestOnTriggerCharacters?: boolean;
/**
* Accept suggestions on ENTER.
* Defaults to 'on'.
*/
acceptSuggestionOnEnter?: boolean | 'on' | 'smart' | 'off';
/**
* Accept suggestions on provider defined characters.
* Defaults to true.
*/
acceptSuggestionOnCommitCharacter?: boolean;
/**
* Enable snippet suggestions. Default to 'true'.
*/
snippetSuggestions?: 'top' | 'bottom' | 'inline' | 'none';
/**
* Copying without a selection copies the current line.
*/
emptySelectionClipboard?: boolean;
/**
* Enable word based suggestions. Defaults to 'true'
*/
wordBasedSuggestions?: boolean;
/**
* The font size for the suggest widget.
* Defaults to the editor font size.
*/
suggestFontSize?: number;
/**
* The line height for the suggest widget.
* Defaults to the editor line height.
*/
suggestLineHeight?: number;
/**
* Enable selection highlight.
* Defaults to true.
*/
selectionHighlight?: boolean;
/**
* Enable semantic occurrences highlight.
* Defaults to true.
*/
occurrencesHighlight?: boolean;
/**
* Show code lens
* Defaults to true.
*/
codeLens?: boolean;
/**
* @deprecated - use codeLens instead
* @internal
*/
referenceInfos?: boolean;
/**
* Control the behavior and rendering of the code action lightbulb.
*/
lightbulb?: IEditorLightbulbOptions;
/**
* Enable code folding
* Defaults to true in vscode and to false in monaco-editor.
*/
folding?: boolean;
/**
* Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter.
* Defaults to 'mouseover'.
*/
showFoldingControls?: 'always' | 'mouseover';
/**
* Enable highlighting of matching brackets.
* Defaults to true.
*/
matchBrackets?: boolean;
/**
* Enable rendering of whitespace.
* Defaults to none.
*/
renderWhitespace?: 'none' | 'boundary' | 'all';
/**
* Enable rendering of control characters.
* Defaults to false.
*/
renderControlCharacters?: boolean;
/**
* Enable rendering of indent guides.
* Defaults to false.
*/
renderIndentGuides?: boolean;
/**
* Enable rendering of current line highlight.
* Defaults to all.
*/
renderLineHighlight?: 'none' | 'gutter' | 'line' | 'all';
/**
* Inserting and deleting whitespace follows tab stops.
*/
useTabStops?: boolean;
/**
* The font family
*/
fontFamily?: string;
/**
* The font weight
*/
fontWeight?: 'normal' | 'bold' | 'bolder' | 'lighter' | 'initial' | 'inherit' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
/**
* The font size
*/
fontSize?: number;
/**
* The line height
*/
lineHeight?: number;
/**
* The letter spacing
*/
letterSpacing?: number;
}
/**
* Configuration options for the diff editor.
*/
export interface IDiffEditorOptions extends IEditorOptions {
/**
* Allow the user to resize the diff editor split view.
* Defaults to true.
*/
enableSplitViewResizing?: boolean;
/**
* Render the differences in two side-by-side editors.
* Defaults to true.
*/
renderSideBySide?: boolean;
/**
* Compute the diff by ignoring leading/trailing whitespace
* Defaults to true.
*/
ignoreTrimWhitespace?: boolean;
/**
* Render +/- indicators for added/deleted changes.
* Defaults to true.
*/
renderIndicators?: boolean;
/**
* Original model should be editable?
* Defaults to false.
*/
originalEditable?: boolean;
}
export enum RenderMinimap {
None = 0,
Small = 1,
Large = 2,
SmallBlocks = 3,
LargeBlocks = 4,
}
/**
* Describes how to indent wrapped lines.
*/
export enum WrappingIndent {
/**
* No indentation => wrapped lines begin at column 1.
*/
None = 0,
/**
* Same => wrapped lines get the same indentation as the parent.
*/
Same = 1,
/**
* Indent => wrapped lines get +1 indentation as the parent.
*/
Indent = 2
}
/**
* The kind of animation in which the editor's cursor should be rendered.
*/
export enum TextEditorCursorBlinkingStyle {
/**
* Hidden
*/
Hidden = 0,
/**
* Blinking
*/
Blink = 1,
/**
* Blinking with smooth fading
*/
Smooth = 2,
/**
* Blinking with prolonged filled state and smooth fading
*/
Phase = 3,
/**
* Expand collapse animation on the y axis
*/
Expand = 4,
/**
* No-Blinking
*/
Solid = 5
}
/**
* @internal
*/
export function blinkingStyleToString(blinkingStyle: TextEditorCursorBlinkingStyle): string {
if (blinkingStyle === TextEditorCursorBlinkingStyle.Blink) {
return 'blink';
} else if (blinkingStyle === TextEditorCursorBlinkingStyle.Expand) {
return 'expand';
} else if (blinkingStyle === TextEditorCursorBlinkingStyle.Phase) {
return 'phase';
} else if (blinkingStyle === TextEditorCursorBlinkingStyle.Smooth) {
return 'smooth';
} else if (blinkingStyle === TextEditorCursorBlinkingStyle.Solid) {
return 'solid';
} else {
throw new Error('blinkingStyleToString: Unknown blinkingStyle');
}
}
/**
* The style in which the editor's cursor should be rendered.
*/
export enum TextEditorCursorStyle {
/**
* As a vertical line (sitting between two characters).
*/
Line = 1,
/**
* As a block (sitting on top of a character).
*/
Block = 2,
/**
* As a horizontal line (sitting under a character).
*/
Underline = 3,
/**
* As a thin vertical line (sitting between two characters).
*/
LineThin = 4,
/**
* As an outlined block (sitting on top of a character).
*/
BlockOutline = 5,
/**
* As a thin horizontal line (sitting under a character).
*/
UnderlineThin = 6
}
/**
* @internal
*/
export function cursorStyleToString(cursorStyle: TextEditorCursorStyle): string {
if (cursorStyle === TextEditorCursorStyle.Line) {
return 'line';
} else if (cursorStyle === TextEditorCursorStyle.Block) {
return 'block';
} else if (cursorStyle === TextEditorCursorStyle.Underline) {
return 'underline';
} else if (cursorStyle === TextEditorCursorStyle.LineThin) {
return 'line-thin';
} else if (cursorStyle === TextEditorCursorStyle.BlockOutline) {
return 'block-outline';
} else if (cursorStyle === TextEditorCursorStyle.UnderlineThin) {
return 'underline-thin';
} else {
throw new Error('cursorStyleToString: Unknown cursorStyle');
}
}
function _cursorStyleFromString(cursorStyle: string, defaultValue: TextEditorCursorStyle): TextEditorCursorStyle {
if (typeof cursorStyle !== 'string') {
return defaultValue;
}
if (cursorStyle === 'line') {
return TextEditorCursorStyle.Line;
} else if (cursorStyle === 'block') {
return TextEditorCursorStyle.Block;
} else if (cursorStyle === 'underline') {
return TextEditorCursorStyle.Underline;
} else if (cursorStyle === 'line-thin') {
return TextEditorCursorStyle.LineThin;
} else if (cursorStyle === 'block-outline') {
return TextEditorCursorStyle.BlockOutline;
} else if (cursorStyle === 'underline-thin') {
return TextEditorCursorStyle.UnderlineThin;
}
return TextEditorCursorStyle.Line;
}
export interface InternalEditorScrollbarOptions {
readonly arrowSize: number;
readonly vertical: ScrollbarVisibility;
readonly horizontal: ScrollbarVisibility;
readonly useShadows: boolean;
readonly verticalHasArrows: boolean;
readonly horizontalHasArrows: boolean;
readonly handleMouseWheel: boolean;
readonly horizontalScrollbarSize: number;
readonly horizontalSliderSize: number;
readonly verticalScrollbarSize: number;
readonly verticalSliderSize: number;
readonly mouseWheelScrollSensitivity: number;
}
export interface InternalEditorMinimapOptions {
readonly enabled: boolean;
readonly showSlider: 'always' | 'mouseover';
readonly renderCharacters: boolean;
readonly maxColumn: number;
}
export interface InternalEditorFindOptions {
readonly seedSearchStringFromSelection: boolean;
readonly autoFindInSelection: boolean;
}
export interface EditorWrappingInfo {
readonly inDiffEditor: boolean;
readonly isDominatedByLongLines: boolean;
readonly isWordWrapMinified: boolean;
readonly isViewportWrapping: boolean;
readonly wrappingColumn: number;
readonly wrappingIndent: WrappingIndent;
readonly wordWrapBreakBeforeCharacters: string;
readonly wordWrapBreakAfterCharacters: string;
readonly wordWrapBreakObtrusiveCharacters: string;
}
export const enum RenderLineNumbersType {
Off = 0,
On = 1,
Relative = 2,
Interval = 3,
Custom = 4
}
export interface InternalEditorViewOptions {
readonly extraEditorClassName: string;
readonly disableMonospaceOptimizations: boolean;
readonly rulers: number[];
readonly ariaLabel: string;
readonly renderLineNumbers: RenderLineNumbersType;
readonly renderCustomLineNumbers: (lineNumber: number) => string;
readonly selectOnLineNumbers: boolean;
readonly glyphMargin: boolean;
readonly revealHorizontalRightPadding: number;
readonly roundedSelection: boolean;
readonly overviewRulerLanes: number;
readonly overviewRulerBorder: boolean;
readonly cursorBlinking: TextEditorCursorBlinkingStyle;
readonly mouseWheelZoom: boolean;
readonly cursorStyle: TextEditorCursorStyle;
readonly hideCursorInOverviewRuler: boolean;
readonly scrollBeyondLastLine: boolean;
readonly smoothScrolling: boolean;
readonly stopRenderingLineAfter: number;
readonly renderWhitespace: 'none' | 'boundary' | 'all';
readonly renderControlCharacters: boolean;
readonly fontLigatures: boolean;
readonly renderIndentGuides: boolean;
readonly renderLineHighlight: 'none' | 'gutter' | 'line' | 'all';
readonly scrollbar: InternalEditorScrollbarOptions;
readonly minimap: InternalEditorMinimapOptions;
readonly fixedOverflowWidgets: boolean;
}
export interface EditorContribOptions {
readonly selectionClipboard: boolean;
readonly hover: boolean;
readonly links: boolean;
readonly contextmenu: boolean;
readonly quickSuggestions: boolean | { other: boolean, comments: boolean, strings: boolean };
readonly quickSuggestionsDelay: number;
readonly parameterHints: boolean;
readonly iconsInSuggestions: boolean;
readonly formatOnType: boolean;
readonly formatOnPaste: boolean;
readonly suggestOnTriggerCharacters: boolean;
readonly acceptSuggestionOnEnter: 'on' | 'smart' | 'off';
readonly acceptSuggestionOnCommitCharacter: boolean;
readonly snippetSuggestions: 'top' | 'bottom' | 'inline' | 'none';
readonly wordBasedSuggestions: boolean;
readonly suggestFontSize: number;
readonly suggestLineHeight: number;
readonly selectionHighlight: boolean;
readonly occurrencesHighlight: boolean;
readonly codeLens: boolean;
readonly folding: boolean;
readonly showFoldingControls: 'always' | 'mouseover';
readonly matchBrackets: boolean;
readonly find: InternalEditorFindOptions;
readonly colorDecorators: boolean;
readonly lightbulbEnabled: boolean;
}
/**
* Validated configuration options for the editor.
* This is a 1 to 1 validated/parsed version of IEditorOptions merged on top of the defaults.
* @internal
*/
export interface IValidatedEditorOptions {
readonly inDiffEditor: boolean;
readonly wordSeparators: string;
readonly lineNumbersMinChars: number;
readonly lineDecorationsWidth: number | string;
readonly readOnly: boolean;
readonly mouseStyle: 'text' | 'default' | 'copy';
readonly disableLayerHinting: boolean;
readonly automaticLayout: boolean;
readonly wordWrap: 'off' | 'on' | 'wordWrapColumn' | 'bounded';
readonly wordWrapColumn: number;
readonly wordWrapMinified: boolean;
readonly wrappingIndent: WrappingIndent;
readonly wordWrapBreakBeforeCharacters: string;
readonly wordWrapBreakAfterCharacters: string;
readonly wordWrapBreakObtrusiveCharacters: string;
readonly autoClosingBrackets: boolean;
readonly autoIndent: boolean;
readonly dragAndDrop: boolean;
readonly emptySelectionClipboard: boolean;
readonly useTabStops: boolean;
readonly multiCursorModifier: 'altKey' | 'ctrlKey' | 'metaKey';
readonly accessibilitySupport: 'auto' | 'off' | 'on';
readonly viewInfo: InternalEditorViewOptions;
readonly contribInfo: EditorContribOptions;
}
/**
* Internal configuration options (transformed or computed) for the editor.
*/
export class InternalEditorOptions {
readonly _internalEditorOptionsBrand: void;
readonly canUseLayerHinting: boolean;
readonly pixelRatio: number;
readonly editorClassName: string;
readonly lineHeight: number;
readonly readOnly: boolean;
/**
* @internal
*/
readonly accessibilitySupport: platform.AccessibilitySupport;
readonly multiCursorModifier: 'altKey' | 'ctrlKey' | 'metaKey';
// ---- cursor options
readonly wordSeparators: string;
readonly autoClosingBrackets: boolean;
readonly autoIndent: boolean;
readonly useTabStops: boolean;
readonly tabFocusMode: boolean;
readonly dragAndDrop: boolean;
readonly emptySelectionClipboard: boolean;
// ---- grouped options
readonly layoutInfo: EditorLayoutInfo;
readonly fontInfo: FontInfo;
readonly viewInfo: InternalEditorViewOptions;
readonly wrappingInfo: EditorWrappingInfo;
readonly contribInfo: EditorContribOptions;
/**
* @internal
*/
constructor(source: {
canUseLayerHinting: boolean;
pixelRatio: number;
editorClassName: string;
lineHeight: number;
readOnly: boolean;
accessibilitySupport: platform.AccessibilitySupport;
multiCursorModifier: 'altKey' | 'ctrlKey' | 'metaKey';
wordSeparators: string;
autoClosingBrackets: boolean;
autoIndent: boolean;
useTabStops: boolean;
tabFocusMode: boolean;
dragAndDrop: boolean;
emptySelectionClipboard: boolean;
layoutInfo: EditorLayoutInfo;
fontInfo: FontInfo;
viewInfo: InternalEditorViewOptions;
wrappingInfo: EditorWrappingInfo;
contribInfo: EditorContribOptions;
}) {
this.canUseLayerHinting = source.canUseLayerHinting;
this.pixelRatio = source.pixelRatio;
this.editorClassName = source.editorClassName;
this.lineHeight = source.lineHeight | 0;
this.readOnly = source.readOnly;
this.accessibilitySupport = source.accessibilitySupport;
this.multiCursorModifier = source.multiCursorModifier;
this.wordSeparators = source.wordSeparators;
this.autoClosingBrackets = source.autoClosingBrackets;
this.autoIndent = source.autoIndent;
this.useTabStops = source.useTabStops;
this.tabFocusMode = source.tabFocusMode;
this.dragAndDrop = source.dragAndDrop;
this.emptySelectionClipboard = source.emptySelectionClipboard;
this.layoutInfo = source.layoutInfo;
this.fontInfo = source.fontInfo;
this.viewInfo = source.viewInfo;
this.wrappingInfo = source.wrappingInfo;
this.contribInfo = source.contribInfo;
}
/**
* @internal
*/
public equals(other: InternalEditorOptions): boolean {
return (
this.canUseLayerHinting === other.canUseLayerHinting
&& this.pixelRatio === other.pixelRatio
&& this.editorClassName === other.editorClassName
&& this.lineHeight === other.lineHeight
&& this.readOnly === other.readOnly
&& this.accessibilitySupport === other.accessibilitySupport
&& this.multiCursorModifier === other.multiCursorModifier
&& this.wordSeparators === other.wordSeparators
&& this.autoClosingBrackets === other.autoClosingBrackets
&& this.autoIndent === other.autoIndent
&& this.useTabStops === other.useTabStops
&& this.tabFocusMode === other.tabFocusMode
&& this.dragAndDrop === other.dragAndDrop
&& this.emptySelectionClipboard === other.emptySelectionClipboard
&& InternalEditorOptions._equalsLayoutInfo(this.layoutInfo, other.layoutInfo)
&& this.fontInfo.equals(other.fontInfo)
&& InternalEditorOptions._equalsViewOptions(this.viewInfo, other.viewInfo)
&& InternalEditorOptions._equalsWrappingInfo(this.wrappingInfo, other.wrappingInfo)
&& InternalEditorOptions._equalsContribOptions(this.contribInfo, other.contribInfo)
);
}
/**
* @internal
*/
public createChangeEvent(newOpts: InternalEditorOptions): IConfigurationChangedEvent {
return {
canUseLayerHinting: (this.canUseLayerHinting !== newOpts.canUseLayerHinting),
pixelRatio: (this.pixelRatio !== newOpts.pixelRatio),
editorClassName: (this.editorClassName !== newOpts.editorClassName),
lineHeight: (this.lineHeight !== newOpts.lineHeight),
readOnly: (this.readOnly !== newOpts.readOnly),
accessibilitySupport: (this.accessibilitySupport !== newOpts.accessibilitySupport),
multiCursorModifier: (this.multiCursorModifier !== newOpts.multiCursorModifier),
wordSeparators: (this.wordSeparators !== newOpts.wordSeparators),
autoClosingBrackets: (this.autoClosingBrackets !== newOpts.autoClosingBrackets),
autoIndent: (this.autoIndent !== newOpts.autoIndent),
useTabStops: (this.useTabStops !== newOpts.useTabStops),
tabFocusMode: (this.tabFocusMode !== newOpts.tabFocusMode),
dragAndDrop: (this.dragAndDrop !== newOpts.dragAndDrop),
emptySelectionClipboard: (this.emptySelectionClipboard !== newOpts.emptySelectionClipboard),
layoutInfo: (!InternalEditorOptions._equalsLayoutInfo(this.layoutInfo, newOpts.layoutInfo)),
fontInfo: (!this.fontInfo.equals(newOpts.fontInfo)),
viewInfo: (!InternalEditorOptions._equalsViewOptions(this.viewInfo, newOpts.viewInfo)),
wrappingInfo: (!InternalEditorOptions._equalsWrappingInfo(this.wrappingInfo, newOpts.wrappingInfo)),
contribInfo: (!InternalEditorOptions._equalsContribOptions(this.contribInfo, newOpts.contribInfo))
};
}
/**
* @internal
*/
private static _equalsLayoutInfo(a: EditorLayoutInfo, b: EditorLayoutInfo): boolean {
return (
a.width === b.width
&& a.height === b.height
&& a.glyphMarginLeft === b.glyphMarginLeft
&& a.glyphMarginWidth === b.glyphMarginWidth
&& a.glyphMarginHeight === b.glyphMarginHeight
&& a.lineNumbersLeft === b.lineNumbersLeft
&& a.lineNumbersWidth === b.lineNumbersWidth
&& a.lineNumbersHeight === b.lineNumbersHeight