-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Expand file tree
/
Copy patheditorBrowser.ts
More file actions
1538 lines (1397 loc) · 42.7 KB
/
editorBrowser.ts
File metadata and controls
1538 lines (1397 loc) · 42.7 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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IKeyboardEvent } from '../../base/browser/keyboardEvent.js';
import { IMouseEvent, IMouseWheelEvent } from '../../base/browser/mouseEvent.js';
import { IBoundarySashes } from '../../base/browser/ui/sash/sash.js';
import { Event } from '../../base/common/event.js';
import { MenuId } from '../../platform/actions/common/actions.js';
import { IContextKeyService } from '../../platform/contextkey/common/contextkey.js';
import { ServicesAccessor } from '../../platform/instantiation/common/instantiation.js';
import { ConfigurationChangedEvent, EditorLayoutInfo, EditorOption, FindComputedEditorOptionValueById, IComputedEditorOptions, IDiffEditorOptions, IEditorOptions, OverviewRulerPosition } from '../common/config/editorOptions.js';
import { IDimension } from '../common/core/2d/dimension.js';
import { TextEdit } from '../common/core/edits/textEdit.js';
import { IPosition, Position } from '../common/core/position.js';
import { IRange, Range } from '../common/core/range.js';
import { Selection } from '../common/core/selection.js';
import { IWordAtPosition } from '../common/core/wordHelper.js';
import { ICursorPositionChangedEvent, ICursorSelectionChangedEvent } from '../common/cursorEvents.js';
import { IDiffComputationResult, ILineChange } from '../common/diff/legacyLinesDiffComputer.js';
import * as editorCommon from '../common/editorCommon.js';
import { GlyphMarginLane, ICursorStateComputer, IIdentifiedSingleEditOperation, IModelDecoration, IModelDecorationsChangeAccessor, IModelDeltaDecoration, ITextModel, PositionAffinity } from '../common/model.js';
import { InjectedText } from '../common/modelLineProjectionData.js';
import { TextModelEditSource } from '../common/textModelEditSource.js';
import { IModelContentChangedEvent, IModelDecorationsChangedEvent, IModelLanguageChangedEvent, IModelLanguageConfigurationChangedEvent, IModelOptionsChangedEvent, IModelTokensChangedEvent, ModelFontChangedEvent, ModelLineHeightChangedEvent } from '../common/textModelEvents.js';
import { IEditorWhitespace, IViewModel } from '../common/viewModel.js';
import { OverviewRulerZone } from '../common/viewModel/overviewZoneManager.js';
import { IEditorConstructionOptions } from './config/editorConfiguration.js';
import { IClipboardCopyEvent, IClipboardPasteEvent } from './controller/editContext/clipboardUtils.js';
/**
* A view zone is a full horizontal rectangle that 'pushes' text down.
* The editor reserves space for view zones when rendering.
*/
export interface IViewZone {
/**
* The line number after which this zone should appear.
* Use 0 to place a view zone before the first line number.
*/
afterLineNumber: number;
/**
* The column after which this zone should appear.
* If not set, the maxLineColumn of `afterLineNumber` will be used.
* This is relevant for wrapped lines.
*/
afterColumn?: number;
/**
* If the `afterColumn` has multiple view columns, the affinity specifies which one to use. Defaults to `none`.
*/
afterColumnAffinity?: PositionAffinity;
/**
* Render the zone even when its line is hidden.
*/
showInHiddenAreas?: boolean;
/**
* Tiebreaker that is used when multiple view zones want to be after the same line.
* Defaults to `afterColumn` otherwise 10000;
*/
ordinal?: number;
/**
* Suppress mouse down events.
* If set, the editor will attach a mouse down listener to the view zone and .preventDefault on it.
* Defaults to false
*/
suppressMouseDown?: boolean;
/**
* The height in lines of the view zone.
* If specified, `heightInPx` will be used instead of this.
* If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen.
*/
heightInLines?: number;
/**
* The height in px of the view zone.
* If this is set, the editor will give preference to it rather than `heightInLines` above.
* If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen.
*/
heightInPx?: number;
/**
* The minimum width in px of the view zone.
* If this is set, the editor will ensure that the scroll width is >= than this value.
*/
minWidthInPx?: number;
/**
* The dom node of the view zone
*/
domNode: HTMLElement;
/**
* An optional dom node for the view zone that will be placed in the margin area.
*/
marginDomNode?: HTMLElement | null;
/**
* Callback which gives the relative top of the view zone as it appears (taking scrolling into account).
*/
onDomNodeTop?: (top: number) => void;
/**
* Callback which gives the height in pixels of the view zone.
*/
onComputedHeight?: (height: number) => void;
}
/**
* An accessor that allows for zones to be added or removed.
*/
export interface IViewZoneChangeAccessor {
/**
* Create a new view zone.
* @param zone Zone to create
* @return A unique identifier to the view zone.
*/
addZone(zone: IViewZone): string;
/**
* Remove a zone
* @param id A unique identifier to the view zone, as returned by the `addZone` call.
*/
removeZone(id: string): void;
/**
* Change a zone's position.
* The editor will rescan the `afterLineNumber` and `afterColumn` properties of a view zone.
*/
layoutZone(id: string): void;
}
/**
* A positioning preference for rendering content widgets.
*/
export const enum ContentWidgetPositionPreference {
/**
* Place the content widget exactly at a position
*/
EXACT,
/**
* Place the content widget above a position
*/
ABOVE,
/**
* Place the content widget below a position
*/
BELOW
}
/**
* A position for rendering content widgets.
*/
export interface IContentWidgetPosition {
/**
* Desired position which serves as an anchor for placing the content widget.
* The widget will be placed above, at, or below the specified position, based on the
* provided preference. The widget will always touch this position.
*
* Given sufficient horizontal space, the widget will be placed to the right of the
* passed in position. This can be tweaked by providing a `secondaryPosition`.
*
* @see preference
* @see secondaryPosition
*/
position: IPosition | null;
/**
* Optionally, a secondary position can be provided to further define the placing of
* the content widget. The secondary position must have the same line number as the
* primary position. If possible, the widget will be placed such that it also touches
* the secondary position.
*/
secondaryPosition?: IPosition | null;
/**
* Placement preference for position, in order of preference.
*/
preference: ContentWidgetPositionPreference[];
/**
* Placement preference when multiple view positions refer to the same (model) position.
* This plays a role when injected text is involved.
*/
positionAffinity?: PositionAffinity;
}
/**
* A content widget renders inline with the text and can be easily placed 'near' an editor position.
*/
export interface IContentWidget {
/**
* Render this content widget in a location where it could overflow the editor's view dom node.
*/
allowEditorOverflow?: boolean;
/**
* If true, this widget doesn't have a visual representation.
* The element will have display set to 'none'.
*/
useDisplayNone?: boolean;
/**
* Call preventDefault() on mousedown events that target the content widget.
*/
suppressMouseDown?: boolean;
/**
* Get a unique identifier of the content widget.
*/
getId(): string;
/**
* Get the dom node of the content widget.
*/
getDomNode(): HTMLElement;
/**
* Get the placement of the content widget.
* If null is returned, the content widget will be placed off screen.
*/
getPosition(): IContentWidgetPosition | null;
/**
* Optional function that is invoked before rendering
* the content widget. If a dimension is returned the editor will
* attempt to use it.
*/
beforeRender?(): IDimension | null;
/**
* Optional function that is invoked after rendering the content
* widget. Is being invoked with the selected position preference
* or `null` if not rendered.
*/
afterRender?(position: ContentWidgetPositionPreference | null, coordinate: IContentWidgetRenderedCoordinate | null): void;
}
/**
* Coordinatees passed in {@link IContentWidget.afterRender}
*/
export interface IContentWidgetRenderedCoordinate {
/**
* Top position relative to the editor content.
*/
readonly top: number;
/**
* Left position relative to the editor content.
*/
readonly left: number;
}
/**
* A positioning preference for rendering overlay widgets.
*/
export const enum OverlayWidgetPositionPreference {
/**
* Position the overlay widget in the top right corner
*/
TOP_RIGHT_CORNER,
/**
* Position the overlay widget in the bottom right corner
*/
BOTTOM_RIGHT_CORNER,
/**
* Position the overlay widget in the top center
*/
TOP_CENTER
}
/**
* Represents editor-relative coordinates of an overlay widget.
*/
export interface IOverlayWidgetPositionCoordinates {
/**
* The top position for the overlay widget, relative to the editor.
*/
top: number;
/**
* The left position for the overlay widget, relative to the editor.
*/
left: number;
}
/**
* A position for rendering overlay widgets.
*/
export interface IOverlayWidgetPosition {
/**
* The position preference for the overlay widget.
*/
preference: OverlayWidgetPositionPreference | IOverlayWidgetPositionCoordinates | null;
/**
* When set, stacks with other overlay widgets with the same preference,
* in an order determined by the ordinal value.
*/
stackOrdinal?: number;
}
/**
* An overlay widgets renders on top of the text.
*/
export interface IOverlayWidget {
/**
* Event fired when the widget layout changes.
*/
readonly onDidLayout?: Event<void>;
/**
* Render this overlay widget in a location where it could overflow the editor's view dom node.
*/
allowEditorOverflow?: boolean;
/**
* Get a unique identifier of the overlay widget.
*/
getId(): string;
/**
* Get the dom node of the overlay widget.
*/
getDomNode(): HTMLElement;
/**
* Get the placement of the overlay widget.
* If null is returned, the overlay widget is responsible to place itself.
*/
getPosition(): IOverlayWidgetPosition | null;
/**
* The editor will ensure that the scroll width is >= than this value.
*/
getMinContentWidthInPx?(): number;
}
/**
* A glyph margin widget renders in the editor glyph margin.
*/
export interface IGlyphMarginWidget {
/**
* Get a unique identifier of the glyph widget.
*/
getId(): string;
/**
* Get the dom node of the glyph widget.
*/
getDomNode(): HTMLElement;
/**
* Get the placement of the glyph widget.
*/
getPosition(): IGlyphMarginWidgetPosition;
}
/**
* A position for rendering glyph margin widgets.
*/
export interface IGlyphMarginWidgetPosition {
/**
* The glyph margin lane where the widget should be shown.
*/
lane: GlyphMarginLane;
/**
* The priority order of the widget, used for determining which widget
* to render when there are multiple.
*/
zIndex: number;
/**
* The editor range that this widget applies to.
*/
range: IRange;
}
/**
* Type of hit element with the mouse in the editor.
*/
export const enum MouseTargetType {
/**
* Mouse is on top of an unknown element.
*/
UNKNOWN,
/**
* Mouse is on top of the textarea used for input.
*/
TEXTAREA,
/**
* Mouse is on top of the glyph margin
*/
GUTTER_GLYPH_MARGIN,
/**
* Mouse is on top of the line numbers
*/
GUTTER_LINE_NUMBERS,
/**
* Mouse is on top of the line decorations
*/
GUTTER_LINE_DECORATIONS,
/**
* Mouse is on top of the whitespace left in the gutter by a view zone.
*/
GUTTER_VIEW_ZONE,
/**
* Mouse is on top of text in the content.
*/
CONTENT_TEXT,
/**
* Mouse is on top of empty space in the content (e.g. after line text or below last line)
*/
CONTENT_EMPTY,
/**
* Mouse is on top of a view zone in the content.
*/
CONTENT_VIEW_ZONE,
/**
* Mouse is on top of a content widget.
*/
CONTENT_WIDGET,
/**
* Mouse is on top of the decorations overview ruler.
*/
OVERVIEW_RULER,
/**
* Mouse is on top of a scrollbar.
*/
SCROLLBAR,
/**
* Mouse is on top of an overlay widget.
*/
OVERLAY_WIDGET,
/**
* Mouse is outside of the editor.
*/
OUTSIDE_EDITOR,
}
export interface IBaseMouseTarget {
/**
* The target element
*/
readonly element: HTMLElement | null;
/**
* The 'approximate' editor position
*/
readonly position: Position | null;
/**
* Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line).
*/
readonly mouseColumn: number;
/**
* The 'approximate' editor range
*/
readonly range: Range | null;
}
export interface IMouseTargetUnknown extends IBaseMouseTarget {
readonly type: MouseTargetType.UNKNOWN;
}
export interface IMouseTargetTextarea extends IBaseMouseTarget {
readonly type: MouseTargetType.TEXTAREA;
readonly position: null;
readonly range: null;
}
export interface IMouseTargetMarginData {
readonly isAfterLines: boolean;
readonly glyphMarginLeft: number;
readonly glyphMarginWidth: number;
readonly glyphMarginLane?: GlyphMarginLane;
readonly lineNumbersWidth: number;
readonly offsetX: number;
}
export interface IMouseTargetMargin extends IBaseMouseTarget {
readonly type: MouseTargetType.GUTTER_GLYPH_MARGIN | MouseTargetType.GUTTER_LINE_NUMBERS | MouseTargetType.GUTTER_LINE_DECORATIONS;
readonly position: Position;
readonly range: Range;
readonly detail: IMouseTargetMarginData;
}
export interface IMouseTargetViewZoneData {
readonly viewZoneId: string;
readonly positionBefore: Position | null;
readonly positionAfter: Position | null;
readonly position: Position;
readonly afterLineNumber: number;
}
export interface IMouseTargetViewZone extends IBaseMouseTarget {
readonly type: MouseTargetType.GUTTER_VIEW_ZONE | MouseTargetType.CONTENT_VIEW_ZONE;
readonly position: Position;
readonly range: Range;
readonly detail: IMouseTargetViewZoneData;
}
export interface IMouseTargetContentTextData {
readonly mightBeForeignElement: boolean;
/**
* @internal
*/
readonly injectedText: InjectedText | null;
}
export interface IMouseTargetContentText extends IBaseMouseTarget {
readonly type: MouseTargetType.CONTENT_TEXT;
readonly position: Position;
readonly range: Range;
readonly detail: IMouseTargetContentTextData;
}
export interface IMouseTargetContentEmptyData {
readonly isAfterLines: boolean;
readonly horizontalDistanceToText?: number;
}
export interface IMouseTargetContentEmpty extends IBaseMouseTarget {
readonly type: MouseTargetType.CONTENT_EMPTY;
readonly position: Position;
readonly range: Range;
readonly detail: IMouseTargetContentEmptyData;
}
export interface IMouseTargetContentWidget extends IBaseMouseTarget {
readonly type: MouseTargetType.CONTENT_WIDGET;
readonly position: null;
readonly range: null;
readonly detail: string;
}
export interface IMouseTargetOverlayWidget extends IBaseMouseTarget {
readonly type: MouseTargetType.OVERLAY_WIDGET;
readonly position: null;
readonly range: null;
readonly detail: string;
}
export interface IMouseTargetScrollbar extends IBaseMouseTarget {
readonly type: MouseTargetType.SCROLLBAR;
readonly position: Position;
readonly range: Range;
}
export interface IMouseTargetOverviewRuler extends IBaseMouseTarget {
readonly type: MouseTargetType.OVERVIEW_RULER;
}
export interface IMouseTargetOutsideEditor extends IBaseMouseTarget {
readonly type: MouseTargetType.OUTSIDE_EDITOR;
readonly outsidePosition: 'above' | 'below' | 'left' | 'right';
readonly outsideDistance: number;
}
/**
* Target hit with the mouse in the editor.
*/
export type IMouseTarget = (
IMouseTargetUnknown
| IMouseTargetTextarea
| IMouseTargetMargin
| IMouseTargetViewZone
| IMouseTargetContentText
| IMouseTargetContentEmpty
| IMouseTargetContentWidget
| IMouseTargetOverlayWidget
| IMouseTargetScrollbar
| IMouseTargetOverviewRuler
| IMouseTargetOutsideEditor
);
/**
* A mouse event originating from the editor.
*/
export interface IEditorMouseEvent {
readonly event: IMouseEvent;
readonly target: IMouseTarget;
}
export interface IPartialEditorMouseEvent {
readonly event: IMouseEvent;
readonly target: IMouseTarget | null;
}
/**
* A paste event originating from the editor.
*/
export interface IPasteEvent {
readonly range: Range;
readonly languageId: string | null;
readonly clipboardEvent?: ClipboardEvent;
}
/**
* @internal
*/
export interface PastePayload {
text: string;
pasteOnNewLine: boolean;
multicursorText: string[] | null;
mode: string | null;
clipboardEvent?: ClipboardEvent;
}
/**
* An overview ruler
* @internal
*/
export interface IOverviewRuler {
getDomNode(): HTMLElement;
dispose(): void;
setZones(zones: OverviewRulerZone[]): void;
setLayout(position: OverviewRulerPosition): void;
}
/**
* Editor aria options.
* @internal
*/
export interface IEditorAriaOptions {
activeDescendant: string | undefined;
role?: string;
}
export interface IDiffEditorConstructionOptions extends IDiffEditorOptions, IEditorConstructionOptions {
/**
* Place overflow widgets inside an external DOM node.
* Defaults to an internal DOM node.
*/
overflowWidgetsDomNode?: HTMLElement;
/**
* Aria label for original editor.
*/
originalAriaLabel?: string;
/**
* Aria label for modified editor.
*/
modifiedAriaLabel?: string;
}
/**
* A rich code editor.
*/
export interface ICodeEditor extends editorCommon.IEditor {
/**
* This editor is used as an alternative to an <input> box, i.e. as a simple widget.
* @internal
*/
readonly isSimpleWidget: boolean;
/**
* The context menu ID that should be used to lookup context menu actions.
* @internal
*/
readonly contextMenuId: MenuId;
/**
* The editor's scoped context key service.
* @internal
*/
readonly contextKeyService: IContextKeyService;
/**
* An event emitted when the content of the current model has changed.
* @event
*/
readonly onDidChangeModelContent: Event<IModelContentChangedEvent>;
/**
* An event emitted when the language of the current model has changed.
* @event
*/
readonly onDidChangeModelLanguage: Event<IModelLanguageChangedEvent>;
/**
* An event emitted when the language configuration of the current model has changed.
* @event
*/
readonly onDidChangeModelLanguageConfiguration: Event<IModelLanguageConfigurationChangedEvent>;
/**
* An event emitted when the options of the current model has changed.
* @event
*/
readonly onDidChangeModelOptions: Event<IModelOptionsChangedEvent>;
/**
* An event emitted when the configuration of the editor has changed. (e.g. `editor.updateOptions()`)
* @event
*/
readonly onDidChangeConfiguration: Event<ConfigurationChangedEvent>;
/**
* An event emitted when the cursor position has changed.
* @event
*/
readonly onDidChangeCursorPosition: Event<ICursorPositionChangedEvent>;
/**
* An event emitted when the cursor selection has changed.
* @event
*/
readonly onDidChangeCursorSelection: Event<ICursorSelectionChangedEvent>;
/**
* An event emitted when the model of this editor is about to change (e.g. from `editor.setModel()`).
* @event
*/
readonly onWillChangeModel: Event<editorCommon.IModelChangedEvent>;
/**
* An event emitted when the model of this editor has changed (e.g. `editor.setModel()`).
* @event
*/
readonly onDidChangeModel: Event<editorCommon.IModelChangedEvent>;
/**
* An event emitted when the decorations of the current model have changed.
* @event
*/
readonly onDidChangeModelDecorations: Event<IModelDecorationsChangedEvent>;
/**
* An event emitted when the tokens of the current model have changed.
* @internal
*/
readonly onDidChangeModelTokens: Event<IModelTokensChangedEvent>;
/**
* An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking).
* @event
*/
readonly onDidFocusEditorText: Event<void>;
/**
* An event emitted when the text inside this editor lost focus (i.e. cursor stops blinking).
* @event
*/
readonly onDidBlurEditorText: Event<void>;
/**
* An event emitted when the text inside this editor or an editor widget gained focus.
* @event
*/
readonly onDidFocusEditorWidget: Event<void>;
/**
* An event emitted when the text inside this editor or an editor widget lost focus.
* @event
*/
readonly onDidBlurEditorWidget: Event<void>;
/**
* An event emitted before interpreting typed characters (on the keyboard).
* @event
* @internal
*/
readonly onWillType: Event<string>;
/**
* An event emitted after interpreting typed characters (on the keyboard).
* @event
* @internal
*/
readonly onDidType: Event<string>;
/**
* Boolean indicating whether input is in composition
*/
readonly inComposition: boolean;
/**
* An event emitted after composition has started.
*/
readonly onDidCompositionStart: Event<void>;
/**
* An event emitted after composition has ended.
*/
readonly onDidCompositionEnd: Event<void>;
/**
* An event emitted when editing failed because the editor is read-only.
* @event
*/
readonly onDidAttemptReadOnlyEdit: Event<void>;
/**
* An event emitted when users paste text in the editor.
* @event
*/
readonly onDidPaste: Event<IPasteEvent>;
/**
* An event emitted before clipboard copy operation starts.
* @internal
* @event
*/
readonly onWillCopy: Event<IClipboardCopyEvent>;
/**
* An event emitted before clipboard cut operation starts.
* @internal
* @event
*/
readonly onWillCut: Event<IClipboardCopyEvent>;
/**
* An event emitted before clipboard paste operation starts.
* @internal
* @event
*/
readonly onWillPaste: Event<IClipboardPasteEvent>;
/**
* An event emitted on a "mouseup".
* @event
*/
readonly onMouseUp: Event<IEditorMouseEvent>;
/**
* An event emitted on a "mousedown".
* @event
*/
readonly onMouseDown: Event<IEditorMouseEvent>;
/**
* An event emitted on a "mousedrag".
* @internal
* @event
*/
readonly onMouseDrag: Event<IEditorMouseEvent>;
/**
* An event emitted on a "mousedrop".
* @internal
* @event
*/
readonly onMouseDrop: Event<IPartialEditorMouseEvent>;
/**
* An event emitted on a "mousedropcanceled".
* @internal
* @event
*/
readonly onMouseDropCanceled: Event<void>;
/**
* An event emitted when content is dropped into the editor.
* @internal
* @event
*/
readonly onDropIntoEditor: Event<{ readonly position: IPosition; readonly event: DragEvent }>;
/**
* An event emitted on a "contextmenu".
* @event
*/
readonly onContextMenu: Event<IEditorMouseEvent>;
/**
* An event emitted on a "mousemove".
* @event
*/
readonly onMouseMove: Event<IEditorMouseEvent>;
/**
* An event emitted on a "mouseleave".
* @event
*/
readonly onMouseLeave: Event<IPartialEditorMouseEvent>;
/**
* An event emitted on a "mousewheel"
* @event
* @internal
*/
readonly onMouseWheel: Event<IMouseWheelEvent>;
/**
* An event emitted on a "keyup".
* @event
*/
readonly onKeyUp: Event<IKeyboardEvent>;
/**
* An event emitted on a "keydown".
* @event
*/
readonly onKeyDown: Event<IKeyboardEvent>;
/**
* An event emitted when the layout of the editor has changed.
* @event
*/
readonly onDidLayoutChange: Event<EditorLayoutInfo>;
/**
* An event emitted when the content width or content height in the editor has changed.
* @event
*/
readonly onDidContentSizeChange: Event<editorCommon.IContentSizeChangedEvent>;
/**
* An event emitted when the scroll in the editor has changed.
* @event
*/
readonly onDidScrollChange: Event<editorCommon.IScrollEvent>;
/**
* An event emitted when hidden areas change in the editor (e.g. due to folding).
* @event
*/
readonly onDidChangeHiddenAreas: Event<void>;
/**
* An event emitted before an editor
* @internal
*/
readonly onWillTriggerEditorOperationEvent: Event<editorCommon.ITriggerEditorOperationEvent>;
/**
* Some editor operations fire multiple events at once.
* To allow users to react to multiple events fired by a single operation,
* the editor fires a begin update before the operation and an end update after the operation.
* Whenever the editor fires `onBeginUpdate`, it will also fire `onEndUpdate` once the operation finishes.
* Note that not all operations are bracketed by `onBeginUpdate` and `onEndUpdate`.
*/
readonly onBeginUpdate: Event<void>;
/**
* Fires after the editor completes the operation it fired `onBeginUpdate` for.
*/
readonly onEndUpdate: Event<void>;
readonly onDidChangeViewZones: Event<void>;
/**
* Saves current view state of the editor in a serializable object.
*/
saveViewState(): editorCommon.ICodeEditorViewState | null;
/**
* Restores the view state of the editor from a serializable object generated by `saveViewState`.
*/
restoreViewState(state: editorCommon.ICodeEditorViewState | null): void;
/**
* Returns true if the text inside this editor or an editor widget has focus.
*/
hasWidgetFocus(): boolean;
/**
* Get a contribution of this editor.
* @id Unique identifier of the contribution.
* @return The contribution or null if contribution not found.
*/
getContribution<T extends editorCommon.IEditorContribution>(id: string): T | null;
/**
* Execute `fn` with the editor's services.
* @internal
*/
invokeWithinContext<T>(fn: (accessor: ServicesAccessor) => T): T;
/**
* Type the getModel() of IEditor.
*/
getModel(): ITextModel | null;
/**
* Sets the current model attached to this editor.
* If the previous model was created by the editor via the value key in the options
* literal object, it will be destroyed. Otherwise, if the previous model was set
* via setModel, or the model key in the options literal object, the previous model
* will not be destroyed.
* It is safe to call setModel(null) to simply detach the current model from the editor.
*/
setModel(model: ITextModel | null): void;
/**
* Gets all the editor computed options.
*/
getOptions(): IComputedEditorOptions;
/**
* Gets a specific editor option.
*/
getOption<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T>;
/**
* Returns the editor's configuration (without any validation or defaults).
*/
getRawOptions(): IEditorOptions;
/**
* @internal
*/
getOverflowWidgetsDomNode(): HTMLElement | undefined;
/**
* @internal
*/
getConfiguredWordAtPosition(position: Position): IWordAtPosition | null;
/**
* An event emitted when line heights from decorations change
* @internal
* @event
*/
readonly onDidChangeLineHeight: Event<ModelLineHeightChangedEvent>;
/**
* An event emitted when the font of the editor has changed.
* @internal
* @event
*/
readonly onDidChangeFont: Event<ModelFontChangedEvent>;
/**
* Get value of the current model attached to this editor.
* @see {@link ITextModel.getValue}
*/
getValue(options?: { preserveBOM: boolean; lineEnding: string }): string;
/**
* Set the value of the current model attached to this editor.
* @see {@link ITextModel.setValue}
*/
setValue(newValue: string): void;
/**
* Get the width of the editor's content.
* This is information that is "erased" when computing `scrollWidth = Math.max(contentWidth, width)`
*/
getContentWidth(): number;
/**
* Get the scrollWidth of the editor's viewport.
*/
getScrollWidth(): number;
/**
* Get the scrollLeft of the editor's viewport.
*/
getScrollLeft(): number;
/**
* Get the height of the editor's content.
* This is information that is "erased" when computing `scrollHeight = Math.max(contentHeight, height)`
*/
getContentHeight(): number;
/**
* Get the scrollHeight of the editor's viewport.
*/
getScrollHeight(): number;
/**
* Get the scrollTop of the editor's viewport.
*/
getScrollTop(): number;
/**
* Change the scrollLeft of the editor's viewport.
*/
setScrollLeft(newScrollLeft: number, scrollType?: editorCommon.ScrollType): void;
/**
* Change the scrollTop of the editor's viewport.
*/
setScrollTop(newScrollTop: number, scrollType?: editorCommon.ScrollType): void;
/**
* Change the scroll position of the editor's viewport.
*/
setScrollPosition(position: editorCommon.INewScrollPosition, scrollType?: editorCommon.ScrollType): void;
/**
* Check if the editor is currently scrolling towards a different scroll position.
*/
hasPendingScrollAnimation(): boolean;
/**
* Get an action that is a contribution to this editor.
* @id Unique identifier of the contribution.
* @return The action or null if action not found.