forked from thlorenz/brace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
3003 lines (2428 loc) · 95.7 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for Ace Ajax.org Cloud9 Editor
// Project: http://ace.ajax.org/
// Definitions by: Diullei Gomes <https://github.com/Diullei>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace AceAjax {
export interface Delta {
action: string;
range: Range;
text: string;
lines: string[];
}
export interface EditorCommand {
name:string;
bindKey:any;
exec: Function;
readOnly?: boolean;
}
export interface CommandManager {
byName: any;
commands: any;
platform: string;
addCommands(commands:EditorCommand[]): void;
addCommand(command:EditorCommand): void;
removeCommand: (command: EditorCommand, keepCommand?: boolean) => void
exec(name: string, editor: Editor, args: any): void;
}
export interface Annotation {
row: number;
column: number;
text: string;
type: string;
}
export interface TokenInfo {
value: string;
}
export interface Position {
row: number;
column: number;
}
export interface KeyBinding {
setDefaultHandler(kb: any): void;
setKeyboardHandler(kb: any): void;
addKeyboardHandler(kb: any, pos: any): void;
removeKeyboardHandler(kb: any): boolean;
getKeyboardHandler(): any;
onCommandKey(e: any, hashId: any, keyCode: any): void;
onTextInput(text: any): void;
}
export interface TextMode {
getTokenizer(): any;
toggleCommentLines(state: any, doc: any, startRow: any, endRow: any): void;
getNextLineIndent (state: any, line: any, tab: any): string;
checkOutdent(state: any, line: any, input: any): boolean;
autoOutdent(state: any, doc: any, row: any): void;
createWorker(session: any): any;
createModeDelegates (mapping: any): void;
transformAction(state: any, action: any, editor: any, session: any, param: any): any;
}
////////////////
/// Ace
////////////////
/**
* The main class acequired to set up an Ace instance in the browser.
**/
/**
* Provides access to acequire in packed noconflict mode
* @param moduleName
**/
export function acequire(moduleName: string): any;
/**
* Embeds the Ace editor into the DOM, at the element provided by `el`.
* @param el Either the id of an element, or the element itself
**/
export function edit(el: string): Editor;
/**
* Embeds the Ace editor into the DOM, at the element provided by `el`.
* @param el Either the id of an element, or the element itself
**/
export function edit(el: HTMLElement): Editor;
/**
* Creates a new [[EditSession]], and returns the associated [[Document]].
* @param text {:textParam}
* @param mode {:modeParam}
**/
export function createEditSession(text: Document, mode: TextMode): IEditSession;
/**
* Creates a new [[EditSession]], and returns the associated [[Document]].
* @param text {:textParam}
* @param mode {:modeParam}
**/
export function createEditSession(text: string, mode: TextMode): IEditSession;
////////////////
/// Anchor
////////////////
/**
* Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.
**/
export interface Anchor {
on(event: string, fn: (e: any) => any): void;
/**
* Returns an object identifying the `row` and `column` position of the current anchor.
**/
getPosition(): Position;
/**
* Returns the current document.
**/
getDocument(): Document;
/**
* Fires whenever the anchor position changes.
* Both of these objects have a `row` and `column` property corresponding to the position.
* Events that can trigger this function include [[Anchor.setPosition `setPosition()`]].
* @param e An object containing information about the anchor position. It has two properties:
* - `old`: An object describing the old Anchor position
* - `value`: An object describing the new Anchor position
**/
onChange(e: any): void;
/**
* Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped.
* @param row The row index to move the anchor to
* @param column The column index to move the anchor to
* @param noClip Identifies if you want the position to be clipped
**/
setPosition(row: number, column: number, noClip: boolean): void;
/**
* When called, the `'change'` event listener is removed.
**/
detach(): void;
}
var Anchor: {
/**
* Creates a new `Anchor` and associates it with a document.
* @param doc The document to associate with the anchor
* @param row The starting row position
* @param column The starting column position
**/
new(doc: Document, row: number, column: number): Anchor;
}
////////////////////////////////
/// BackgroundTokenizer
////////////////////////////////
/**
* Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use.
* If a certain row is changed, everything below that row is re-tokenized.
**/
export interface BackgroundTokenizer {
states: any[];
/**
* Sets a new tokenizer for this object.
* @param tokenizer The new tokenizer to use
**/
setTokenizer(tokenizer: Tokenizer): void;
/**
* Sets a new document to associate with this object.
* @param doc The new document to associate with
**/
setDocument(doc: Document): void;
/**
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
* @param firstRow The starting row region
* @param lastRow The final row region
**/
fireUpdateEvent(firstRow: number, lastRow: number): void;
/**
* Starts tokenizing at the row indicated.
* @param startRow The row to start at
**/
start(startRow: number): void;
/**
* Stops tokenizing.
**/
stop(): void;
/**
* Gives list of tokens of the row. (tokens are cached)
* @param row The row to get tokens at
**/
getTokens(row: number): TokenInfo[];
/**
* [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
* @param row The row to get state at
**/
getState(row: number): string;
}
var BackgroundTokenizer: {
/**
* Creates a new `BackgroundTokenizer` object.
* @param tokenizer The tokenizer to use
* @param editor The editor to associate with
**/
new(tokenizer: Tokenizer, editor: Editor): BackgroundTokenizer;
}
////////////////
/// Document
////////////////
/**
* Contains the text of the document. Document can be attached to several [[EditSession `EditSession`]]s.
* At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index.
**/
export interface Document {
on(event: string, fn: (e: any) => any): void;
/**
* Replaces all the lines in the current `Document` with the value of `text`.
* @param text The text to use
**/
setValue(text: string): void;
/**
* Returns all the lines in the document as a single string, split by the new line character.
**/
getValue(): string;
/**
* Creates a new `Anchor` to define a floating point in the document.
* @param row The row number to use
* @param column The column number to use
**/
createAnchor(row: number, column: number): void;
/**
* Returns the newline character that's being used, depending on the value of `newLineMode`.
**/
getNewLineCharacter(): string;
/**
* [Sets the new line mode.]{: #Document.setNewLineMode.desc}
* @param newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
**/
setNewLineMode(newLineMode: string): void;
/**
* [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode}
**/
getNewLineMode(): string;
/**
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
* @param text The text to check
**/
isNewLine(text: string): boolean;
/**
* Returns a verbatim copy of the given line as it is in the document
* @param row The row index to retrieve
**/
getLine(row: number): string;
/**
* Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
* @param firstRow The first row index to retrieve
* @param lastRow The final row index to retrieve
**/
getLines(firstRow: number, lastRow: number): string[];
/**
* Returns all lines in the document as string array. Warning: The caller should not modify this array!
**/
getAllLines(): string[];
/**
* Returns the number of rows in the document.
**/
getLength(): number;
/**
* [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc}
* @param range The range to work with
**/
getTextRange(range: Range): string;
/**
* Inserts a block of `text` and the indicated `position`.
* @param position The position to start inserting at
* @param text A chunk of text to insert
**/
insert(position: Position, text: string): any;
/**
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
* @param row The index of the row to insert at
* @param lines An array of strings
**/
insertLines(row: number, lines: string[]): any;
/**
* Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
* @param position The position to insert at
**/
insertNewLine(position: Position): any;
/**
* Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
* @param position The position to insert at
* @param text A chunk of text
**/
insertInLine(position: any, text: string): any;
/**
* Removes the `range` from the document.
* @param range A specified Range to remove
**/
remove(range: Range): any;
/**
* Removes the specified columns from the `row`. This method also triggers the `'change'` event.
* @param row The row to remove from
* @param startColumn The column to start removing at
* @param endColumn The column to stop removing at
**/
removeInLine(row: number, startColumn: number, endColumn: number): any;
/**
* Removes a range of full lines. This method also triggers the `'change'` event.
* @param firstRow The first row to be removed
* @param lastRow The last row to be removed
**/
removeLines(firstRow: number, lastRow: number): string[];
/**
* Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event.
* @param row The row to check
**/
removeNewLine(row: number): void;
/**
* Replaces a range in the document with the new `text`.
* @param range A specified Range to replace
* @param text The new text to use as a replacement
**/
replace(range: Range, text: string): any;
/**
* Applies all the changes previously accumulated. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
**/
applyDeltas(deltas: Delta[]): void;
/**
* Reverts any changes previously applied. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
**/
revertDeltas(deltas: Delta[]): void;
/**
* Converts an index position in a document to a `{row, column}` object.
* Index refers to the "absolute position" of a character in the document. For example:
* ```javascript
* var x = 0; // 10 characters, plus one for newline
* var y = -1;
* ```
* Here, `y` is an index 15: 11 characters for the first row, and 5 characters until `y` in the second.
* @param index An index to convert
* @param startRow=0 The row from which to start the conversion
**/
indexToPosition(index: number, startRow: number): Position;
/**
* Converts the `{row, column}` position in a document to the character's index.
* Index refers to the "absolute position" of a character in the document. For example:
* ```javascript
* var x = 0; // 10 characters, plus one for newline
* var y = -1;
* ```
* Here, `y` is an index 15: 11 characters for the first row, and 5 characters until `y` in the second.
* @param pos The `{row, column}` to convert
* @param startRow=0 The row from which to start the conversion
**/
positionToIndex(pos: Position, startRow: number): number;
}
var Document: {
/**
* Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
* @param text The starting text
**/
new(text?: string): Document;
/**
* Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
* @param text The starting text
**/
new(text?: string[]): Document;
}
////////////////////////////////
/// EditSession
////////////////////////////////
/**
* Stores all the data about [[Editor `Editor`]] state providing easy way to change editors state.
* `EditSession` can be attached to only one [[Document `Document`]]. Same `Document` can be attached to several `EditSession`s.
**/
export interface IEditSession {
selection: Selection;
bgTokenizer: BackgroundTokenizer;
doc: Document;
on(event: string, fn: (e: any) => any): void;
findMatchingBracket(position: Position): void;
addFold(text: string, range: Range): void;
getFoldAt(row: number, column: number): any;
removeFold(arg: any): void;
expandFold(arg: any): void;
foldAll(startRow?: number, endRow?: number, depth?: number): void
unfold(arg1: any, arg2: boolean): void;
screenToDocumentColumn(row: number, column: number): void;
getFoldDisplayLine(foldLine: any, docRow: number, docColumn: number): any;
getFoldsInRange(range: Range): any;
highlight(text: string): void;
/**
* Sets the `EditSession` to point to a new `Document`. If a `BackgroundTokenizer` exists, it also points to `doc`.
* @param doc The new `Document` to use
**/
setDocument(doc: Document): void;
/**
* Returns the `Document` associated with this session.
**/
getDocument(): Document;
/**
* undefined
* @param row The row to work with
**/
$resetRowCache(row: number): void;
/**
* Sets the session text.
* @param text The new text to place
**/
setValue(text: string): void;
setMode(mode: string): void;
/**
* Returns the current [[Document `Document`]] as a string.
**/
getValue(): string;
/**
* Returns the string of the current selection.
**/
getSelection(): Selection;
/**
* {:BackgroundTokenizer.getState}
* @param row The row to start at
**/
getState(row: number): string;
/**
* Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
* @param row The row to start at
**/
getTokens(row: number): TokenInfo[];
/**
* Returns an object indicating the token at the current row. The object has two properties: `index` and `start`.
* @param row The row number to retrieve from
* @param column The column number to retrieve from
**/
getTokenAt(row: number, column: number): TokenInfo;
/**
* Sets the undo manager.
* @param undoManager The new undo manager
**/
setUndoManager(undoManager: UndoManager): void;
/**
* Returns the current undo manager.
**/
getUndoManager(): UndoManager;
/**
* Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[EditSession.getTabSize `getTabSize()`]]): void; otherwise it's simply `'\t'`.
**/
getTabString(): string;
/**
* Pass `true` to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character (`'\t'`).
* @param useSoftTabs Value indicating whether or not to use soft tabs
**/
setUseSoftTabs(useSoftTabs: boolean): void;
/**
* Returns `true` if soft tabs are being used, `false` otherwise.
**/
getUseSoftTabs(): boolean;
/**
* Set the number of spaces that define a soft tab; for example, passing in `4` transforms the soft tabs to be equivalent to four spaces. This function also emits the `changeTabSize` event.
* @param tabSize The new tab size
**/
setTabSize(tabSize: number): void;
/**
* Returns the current tab size.
**/
getTabSize(): number;
/**
* Returns `true` if the character at the position is a soft tab.
* @param position The position to check
**/
isTabStop(position: any): boolean;
/**
* Pass in `true` to enable overwrites in your session, or `false` to disable.
* If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emites the `changeOverwrite` event.
* @param overwrite Defines wheter or not to set overwrites
**/
setOverwrite(overwrite: boolean): void;
/**
* Returns `true` if overwrites are enabled; `false` otherwise.
**/
getOverwrite(): boolean;
/**
* Sets the value of overwrite to the opposite of whatever it currently is.
**/
toggleOverwrite(): void;
/**
* Adds `className` to the `row`, to be used for CSS stylings and whatnot.
* @param row The row number
* @param className The class to add
**/
addGutterDecoration(row: number, className: string): void;
/**
* Removes `className` from the `row`.
* @param row The row number
* @param className The class to add
**/
removeGutterDecoration(row: number, className: string): void;
/**
* Returns an array of numbers, indicating which rows have breakpoints.
**/
getBreakpoints(): number[];
/**
* Sets a breakpoint on every row number given by `rows`. This function also emites the `'changeBreakpoint'` event.
* @param rows An array of row indices
**/
setBreakpoints(rows: any[]): void;
/**
* Removes all breakpoints on the rows. This function also emites the `'changeBreakpoint'` event.
**/
clearBreakpoints(): void;
/**
* Sets a breakpoint on the row number given by `rows`. This function also emites the `'changeBreakpoint'` event.
* @param row A row index
* @param className Class of the breakpoint
**/
setBreakpoint(row: number, className: string): void;
/**
* Removes a breakpoint on the row number given by `rows`. This function also emites the `'changeBreakpoint'` event.
* @param row A row index
**/
clearBreakpoint(row: number): void;
/**
* Adds a new marker to the given `Range`. If `inFront` is `true`, a front marker is defined, and the `'changeFrontMarker'` event fires; otherwise, the `'changeBackMarker'` event fires.
* @param range Define the range of the marker
* @param clazz Set the CSS class for the marker
* @param type Identify the type of the marker
* @param inFront Set to `true` to establish a front marker
**/
addMarker(range: Range, clazz: string, type: Function, inFront: boolean): number;
/**
* Adds a new marker to the given `Range`. If `inFront` is `true`, a front marker is defined, and the `'changeFrontMarker'` event fires; otherwise, the `'changeBackMarker'` event fires.
* @param range Define the range of the marker
* @param clazz Set the CSS class for the marker
* @param type Identify the type of the marker
* @param inFront Set to `true` to establish a front marker
**/
addMarker(range: Range, clazz: string, type: string, inFront: boolean): number;
/**
* Adds a dynamic marker to the session.
* @param marker object with update method
* @param inFront Set to `true` to establish a front marker
**/
addDynamicMarker(marker: any, inFront: boolean): void;
/**
* Removes the marker with the specified ID. If this marker was in front, the `'changeFrontMarker'` event is emitted. If the marker was in the back, the `'changeBackMarker'` event is emitted.
* @param markerId A number representing a marker
**/
removeMarker(markerId: number): void;
/**
* Returns an array containing the IDs of all the markers, either front or back.
* @param inFront If `true`, indicates you only want front markers; `false` indicates only back markers
**/
getMarkers(inFront: boolean): any[];
/**
* Sets annotations for the `EditSession`. This functions emits the `'changeAnnotation'` event.
* @param annotations A list of annotations
**/
setAnnotations(annotations: Annotation[]): void;
/**
* Returns the annotations for the `EditSession`.
**/
getAnnotations(): any;
/**
* Clears all the annotations for this session. This function also triggers the `'changeAnnotation'` event.
**/
clearAnnotations(): void;
/**
* If `text` contains either the newline (`\n`) or carriage-return ('\r') characters, `$autoNewLine` stores that value.
* @param text A block of text
**/
$detectNewLine(text: string): void;
/**
* Given a starting row and column, this method returns the `Range` of the first word boundary it finds.
* @param row The row to start at
* @param column The column to start at
**/
getWordRange(row: number, column: number): Range;
/**
* Gets the range of a word, including its right whitespace.
* @param row The row number to start from
* @param column The column number to start from
**/
getAWordRange(row: number, column: number): any;
/**
* {:Document.setNewLineMode.desc}
* @param newLineMode {:Document.setNewLineMode.param}
**/
setNewLineMode(newLineMode: string): void;
/**
* Returns the current new line mode.
**/
getNewLineMode(): string;
/**
* Identifies if you want to use a worker for the `EditSession`.
* @param useWorker Set to `true` to use a worker
**/
setUseWorker(useWorker: boolean): void;
/**
* Returns `true` if workers are being used.
**/
getUseWorker(): boolean;
/**
* Reloads all the tokens on the current session. This function calls [[BackgroundTokenizer.start `BackgroundTokenizer.start ()`]] to all the rows; it also emits the `'tokenizerUpdate'` event.
**/
onReloadTokenizer(): void;
/**
* Sets a new text mode for the `EditSession`. This method also emits the `'changeMode'` event. If a [[BackgroundTokenizer `BackgroundTokenizer`]] is set, the `'tokenizerUpdate'` event is also emitted.
* @param mode Set a new text mode
**/
$mode(mode: TextMode): void;
/**
* Returns the current text mode.
**/
getMode(): TextMode;
/**
* This function sets the scroll top value. It also emits the `'changeScrollTop'` event.
* @param scrollTop The new scroll top value
**/
setScrollTop(scrollTop: number): void;
/**
* [Returns the value of the distance between the top of the editor and the topmost part of the visible content.]{: #EditSession.getScrollTop}
**/
getScrollTop(): number;
/**
* [Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft}
**/
setScrollLeft(): void;
/**
* [Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft}
**/
getScrollLeft(): number;
/**
* Returns the width of the screen.
**/
getScreenWidth(): number;
/**
* Returns a verbatim copy of the given line as it is in the document
* @param row The row to retrieve from
**/
getLine(row: number): string;
/**
* Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
* @param firstRow The first row index to retrieve
* @param lastRow The final row index to retrieve
**/
getLines(firstRow: number, lastRow: number): string[];
/**
* Returns the number of rows in the document.
**/
getLength(): number;
/**
* {:Document.getTextRange.desc}
* @param range The range to work with
**/
getTextRange(range: Range): string;
/**
* Inserts a block of `text` and the indicated `position`.
* @param position The position {row, column} to start inserting at
* @param text A chunk of text to insert
**/
insert(position: Position, text: string): any;
/**
* Removes the `range` from the document.
* @param range A specified Range to remove
**/
remove(range: Range): any;
/**
* Reverts previous changes to your document.
* @param deltas An array of previous changes
* @param dontSelect [If `true`, doesn't select the range of where the change occured]{: #dontSelect}
**/
undoChanges(deltas: any[], dontSelect: boolean): Range;
/**
* Re-implements a previously undone change to your document.
* @param deltas An array of previous changes
* @param dontSelect {:dontSelect}
**/
redoChanges(deltas: any[], dontSelect: boolean): Range;
/**
* Enables or disables highlighting of the range where an undo occured.
* @param enable If `true`, selects the range of the reinserted change
**/
setUndoSelect(enable: boolean): void;
/**
* Replaces a range in the document with the new `text`.
* @param range A specified Range to replace
* @param text The new text to use as a replacement
**/
replace(range: Range, text: string): any;
/**
* Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this:
* ```json
* { row: newRowLocation, column: newColumnLocation }
* ```
* @param fromRange The range of text you want moved within the document
* @param toPosition The location (row and column) where you want to move the text to
**/
moveText(fromRange: Range, toPosition: any): Range;
/**
* Indents all the rows, from `startRow` to `endRow` (inclusive), by prefixing each row with the token in `indentString`.
* If `indentString` contains the `'\t'` character, it's replaced by whatever is defined by [[EditSession.getTabString `getTabString()`]].
* @param startRow Starting row
* @param endRow Ending row
* @param indentString The indent token
**/
indentRows(startRow: number, endRow: number, indentString: string): void;
/**
* Outdents all the rows defined by the `start` and `end` properties of `range`.
* @param range A range of rows
**/
outdentRows(range: Range): void;
/**
* Shifts all the lines in the document up one, starting from `firstRow` and ending at `lastRow`.
* @param firstRow The starting row to move up
* @param lastRow The final row to move up
**/
moveLinesUp(firstRow: number, lastRow: number): number;
/**
* Shifts all the lines in the document down one, starting from `firstRow` and ending at `lastRow`.
* @param firstRow The starting row to move down
* @param lastRow The final row to move down
**/
moveLinesDown(firstRow: number, lastRow: number): number;
/**
* Duplicates all the text between `firstRow` and `lastRow`.
* @param firstRow The starting row to duplicate
* @param lastRow The final row to duplicate
**/
duplicateLines(firstRow: number, lastRow: number): number;
/**
* Sets whether or not line wrapping is enabled. If `useWrapMode` is different than the current value, the `'changeWrapMode'` event is emitted.
* @param useWrapMode Enable (or disable) wrap mode
**/
setUseWrapMode(useWrapMode: boolean): void;
/**
* Returns `true` if wrap mode is being used; `false` otherwise.
**/
getUseWrapMode(): boolean;
/**
* Sets the boundaries of wrap. Either value can be `null` to have an unconstrained wrap, or, they can be the same number to pin the limit. If the wrap limits for `min` or `max` are different, this method also emits the `'changeWrapMode'` event.
* @param min The minimum wrap value (the left side wrap)
* @param max The maximum wrap value (the right side wrap)
**/
setWrapLimitRange(min: number, max: number): void;
/**
* This should generally only be called by the renderer when a resize is detected.
* @param desiredLimit The new wrap limit
**/
adjustWrapLimit(desiredLimit: number): boolean;
/**
* Returns the value of wrap limit.
**/
getWrapLimit(): number;
/**
* Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this:
* { min: wrapLimitRange_min, max: wrapLimitRange_max }
**/
getWrapLimitRange(): any;
/**
* Given a string, returns an array of the display characters, including tabs and spaces.
* @param str The string to check
* @param offset The value to start at
**/
$getDisplayTokens(str: string, offset: number): void;
/**
* Calculates the width of the string `str` on the screen while assuming that the string starts at the first column on the screen.
* @param str The string to calculate the screen width of
* @param maxScreenColumn
* @param screenColumn
**/
$getStringScreenWidth(str: string, maxScreenColumn: number, screenColumn: number): number[];
/**
* Returns number of screenrows in a wrapped line.
* @param row The row number to check
**/
getRowLength(row: number): number;
/**
* Returns the position (on screen) for the last character in the provided screen row.
* @param screenRow The screen row to check
**/
getScreenLastRowColumn(screenRow: number): number;
/**
* For the given document row and column, this returns the column position of the last screen row.
* @param docRow
* @param docColumn
**/
getDocumentLastRowColumn(docRow: number, docColumn: number): number;
/**
* For the given document row and column, this returns the document position of the last row.
* @param docRow
* @param docColumn
**/
getDocumentLastRowColumnPosition(docRow: number, docColumn: number): number;
/**
* For the given row, this returns the split data.
**/
getRowSplitData(): string;
/**
* The distance to the next tab stop at the specified screen column.
* @param screenColumn The screen column to check
**/
getScreenTabSize(screenColumn: number): number;
/**
* Converts characters coordinates on the screen to characters coordinates within the document. [This takes into account code folding, word wrap, tab size, and any other visual modifications.]{: #conversionConsiderations}
* @param screenRow The screen row to check
* @param screenColumn The screen column to check
**/
screenToDocumentPosition(screenRow: number, screenColumn: number): any;
/**
* Converts document coordinates to screen coordinates. {:conversionConsiderations}
* @param docRow The document row to check
* @param docColumn The document column to check
**/
documentToScreenPosition(docRow: number, docColumn: number): any;
/**
* For the given document row and column, returns the screen column.
* @param row