@pulsar-edit/types 1.128.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/.github/workflows/publish.yml +33 -0
  2. package/LICENSE.md +8 -0
  3. package/README.md +187 -0
  4. package/atom-i18n/config.d.ts +9 -0
  5. package/atom-i18n/index.d.ts +4 -0
  6. package/autocomplete-plus/config.d.ts +140 -0
  7. package/autocomplete-plus/index.d.ts +200 -0
  8. package/dependencies/event-kit/index.d.ts +143 -0
  9. package/dependencies/first-mate/index.d.ts +1 -0
  10. package/dependencies/first-mate/src/first-mate.d.ts +1 -0
  11. package/dependencies/first-mate/src/grammar.d.ts +119 -0
  12. package/dependencies/pathwatcher/index.d.ts +1 -0
  13. package/dependencies/pathwatcher/src/directory.d.ts +98 -0
  14. package/dependencies/pathwatcher/src/file.d.ts +115 -0
  15. package/dependencies/pathwatcher/src/main.d.ts +2 -0
  16. package/dependencies/service-hub/index.d.ts +3 -0
  17. package/dependencies/service-hub/src/consumer.d.ts +8 -0
  18. package/dependencies/service-hub/src/provider.d.ts +14 -0
  19. package/dependencies/service-hub/src/service-hub.d.ts +46 -0
  20. package/dependencies/service-hub/src/util.d.ts +1 -0
  21. package/dependencies/text-buffer/index.d.ts +1 -0
  22. package/dependencies/text-buffer/src/display-marker-layer.d.ts +182 -0
  23. package/dependencies/text-buffer/src/display-marker.d.ts +232 -0
  24. package/dependencies/text-buffer/src/helpers.d.ts +11 -0
  25. package/dependencies/text-buffer/src/marker-layer.d.ts +117 -0
  26. package/dependencies/text-buffer/src/marker.d.ts +207 -0
  27. package/dependencies/text-buffer/src/point.d.ts +102 -0
  28. package/dependencies/text-buffer/src/range.d.ts +141 -0
  29. package/dependencies/text-buffer/src/text-buffer.d.ts +759 -0
  30. package/index.d.ts +72 -0
  31. package/linter/config.d.ts +26 -0
  32. package/linter/index.d.ts +108 -0
  33. package/package.json +61 -0
  34. package/src/atom-environment.d.ts +361 -0
  35. package/src/branding.d.ts +19 -0
  36. package/src/buffered-node-process.d.ts +10 -0
  37. package/src/buffered-process.d.ts +88 -0
  38. package/src/clipboard.d.ts +14 -0
  39. package/src/color.d.ts +11 -0
  40. package/src/command-registry.d.ts +118 -0
  41. package/src/config-schema.d.ts +271 -0
  42. package/src/config.d.ts +168 -0
  43. package/src/context-menu-manager.d.ts +65 -0
  44. package/src/cursor.d.ts +252 -0
  45. package/src/decoration.d.ts +156 -0
  46. package/src/deserializer-manager.d.ts +15 -0
  47. package/src/dock.d.ts +121 -0
  48. package/src/get-window-load-settings.d.ts +26 -0
  49. package/src/git-repository.d.ts +174 -0
  50. package/src/grammar-registry.d.ts +241 -0
  51. package/src/gutter.d.ts +118 -0
  52. package/src/history-manager.d.ts +28 -0
  53. package/src/keymap-extensions.d.ts +190 -0
  54. package/src/language-mode.d.ts +314 -0
  55. package/src/layer-decoration.d.ts +31 -0
  56. package/src/menu-manager.d.ts +24 -0
  57. package/src/notification-manager.d.ts +37 -0
  58. package/src/notification.d.ts +79 -0
  59. package/src/other-types.d.ts +283 -0
  60. package/src/package-manager.d.ts +103 -0
  61. package/src/package.d.ts +33 -0
  62. package/src/pane.d.ts +604 -0
  63. package/src/panel.d.ts +38 -0
  64. package/src/path-watcher.d.ts +35 -0
  65. package/src/project.d.ts +110 -0
  66. package/src/scope-descriptor.d.ts +8 -0
  67. package/src/selection.d.ts +341 -0
  68. package/src/style-manager.d.ts +68 -0
  69. package/src/task.d.ts +38 -0
  70. package/src/text-editor-component.d.ts +15 -0
  71. package/src/text-editor-element.d.ts +48 -0
  72. package/src/text-editor-registry.d.ts +48 -0
  73. package/src/text-editor.d.ts +1416 -0
  74. package/src/theme-manager.d.ts +29 -0
  75. package/src/tooltip-manager.d.ts +42 -0
  76. package/src/tooltip.d.ts +63 -0
  77. package/src/ui.d.ts +101 -0
  78. package/src/view-registry.d.ts +34 -0
  79. package/src/wasm-tree-sitter-grammar.d.ts +305 -0
  80. package/src/wasm-tree-sitter-language-mode.d.ts +294 -0
  81. package/src/workspace-center.d.ts +117 -0
  82. package/src/workspace.d.ts +485 -0
  83. package/status-bar/config.d.ts +23 -0
  84. package/status-bar/index.d.ts +51 -0
  85. package/tool-bar/config.d.ts +20 -0
  86. package/tool-bar/index.d.ts +235 -0
  87. package/tsconfig.json +8 -0
@@ -0,0 +1,1416 @@
1
+ import {
2
+ BufferScanResult,
3
+ BufferStoppedChangingEvent,
4
+ ContextualBufferScanResult,
5
+ Cursor,
6
+ CursorPositionChangedEvent,
7
+ Decoration,
8
+ DecorationLayerOptions,
9
+ DecorationOptions,
10
+ DisplayMarker,
11
+ DisplayMarkerLayer,
12
+ Disposable,
13
+ EditorChangedEvent,
14
+ FindDisplayMarkerOptions,
15
+ Grammar,
16
+ Gutter,
17
+ GutterOptions,
18
+ LayerDecoration,
19
+ MarkerLayer,
20
+ Point,
21
+ PointCompatible,
22
+ Range,
23
+ RangeCompatible,
24
+ RangeLike,
25
+ ReadonlyEditOptions,
26
+ ScanContextOptions,
27
+ ScopeDescriptor,
28
+ Selection,
29
+ SelectionChangedEvent,
30
+ TextBuffer,
31
+ TextEditOptions,
32
+ TextEditorElement,
33
+ TextInsertionOptions,
34
+ } from "../index";
35
+ import { CommentDelimiterSpec } from "./wasm-tree-sitter-grammar";
36
+
37
+ /**
38
+ * This class represents all essential editing state for a single TextBuffer,
39
+ * including cursor and selection positions, folds, and soft wraps.
40
+ */
41
+ export class TextEditor {
42
+ readonly id: number;
43
+
44
+ // NOTE: Undocumented within the public API. Don't go down the rabbit hole.
45
+ constructor(options?: object);
46
+
47
+ /** Get the custom HTML element for the editor. */
48
+ getElement(): TextEditorElement;
49
+
50
+ /**
51
+ * Private: update various properties on the editor instance after creation.
52
+ *
53
+ * Returns a promise that resolves when the view layer is updated as a result
54
+ * of these property changes.
55
+ */
56
+ update(params: object): Promise<void>;
57
+
58
+ // Event Subscription
59
+ /** Calls your callback when the buffer's title has changed. */
60
+ onDidChangeTitle(callback: (title: string) => void): Disposable;
61
+
62
+ /** Calls your callback when the buffer's path, and therefore title, has changed. */
63
+ onDidChangePath(callback: (path: string) => void): Disposable;
64
+
65
+ /**
66
+ * Invoke the given callback synchronously when the content of the buffer
67
+ * changes.
68
+ */
69
+ onDidChange(callback: (event: EditorChangedEvent[]) => void): Disposable;
70
+
71
+ /**
72
+ * Invoke callback when the buffer's contents change. It is emit
73
+ * asynchronously 300ms after the last buffer change. This is a good place
74
+ * to handle changes to the buffer without compromising typing performance.
75
+ */
76
+ onDidStopChanging(callback: (event: BufferStoppedChangingEvent) => void): Disposable;
77
+
78
+ /**
79
+ * Calls your callback when a Cursor is moved. If there are multiple cursors,
80
+ * your callback will be called for each cursor.
81
+ */
82
+ onDidChangeCursorPosition(callback: (event: CursorPositionChangedEvent) => void): Disposable;
83
+
84
+ /** Calls your callback when a selection's screen range changes. */
85
+ onDidChangeSelectionRange(callback: (event: SelectionChangedEvent) => void): Disposable;
86
+
87
+ /** Invoke the given callback after the buffer is saved to disk. */
88
+ onDidSave(callback: (event: { path: string }) => void): Disposable;
89
+
90
+ /** Invoke the given callback when the editor is destroyed. */
91
+ onDidDestroy(callback: () => void): Disposable;
92
+
93
+ /** Retrieves the current TextBuffer. */
94
+ getBuffer(): TextBuffer;
95
+
96
+ /** Sets the read-only state for the editor. */
97
+ setReadOnly(readonly: boolean): void;
98
+
99
+ /** Whether or not this editor is in read-only mode. */
100
+ isReadOnly(): boolean;
101
+
102
+ /**
103
+ * Calls your callback when a Gutter is added to the editor. Immediately calls
104
+ * your callback for each existing gutter.
105
+ */
106
+ observeGutters(callback: (gutter: Gutter) => void): Disposable;
107
+
108
+ /** Calls your callback when a Gutter is added to the editor. */
109
+ onDidAddGutter(callback: (gutter: Gutter) => void): Disposable;
110
+
111
+ /** Calls your callback when a Gutter is removed from the editor. */
112
+ onDidRemoveGutter(callback: (name: string) => void): Disposable;
113
+
114
+ /** Calls your callback when soft wrap was enabled or disabled. */
115
+ onDidChangeSoftWrapped(callback: (softWrapped: boolean) => void): Disposable;
116
+
117
+ /** Calls your callback when the buffer's encoding has changed. */
118
+ onDidChangeEncoding(callback: (encoding: string) => void): Disposable;
119
+
120
+ /**
121
+ * Calls your callback when the grammar that interprets and colorizes the text
122
+ * has been changed. Immediately calls your callback with the current grammar.
123
+ */
124
+ observeGrammar(callback: (grammar: Grammar) => void): Disposable;
125
+
126
+ /**
127
+ * Calls your callback when the grammar that interprets and colorizes the text
128
+ * has been changed.
129
+ */
130
+ onDidChangeGrammar(callback: (grammar: Grammar) => void): Disposable;
131
+
132
+ /** Calls your callback when the result of ::isModified changes. */
133
+ onDidChangeModified(callback: (modified: boolean) => void): Disposable;
134
+
135
+ /**
136
+ * Calls your callback when the buffer's underlying file changes on disk at a
137
+ * moment when the result of ::isModified is true.
138
+ */
139
+ onDidConflict(callback: () => void): Disposable;
140
+
141
+ /** Calls your callback before text has been inserted. */
142
+ onWillInsertText(callback: (event: { text: string; cancel(): void }) => void): Disposable;
143
+
144
+ /** Calls your callback after text has been inserted. */
145
+ onDidInsertText(callback: (event: { text: string }) => void): Disposable;
146
+
147
+ /**
148
+ * Calls your callback when a Cursor is added to the editor. Immediately calls
149
+ * your callback for each existing cursor.
150
+ */
151
+ observeCursors(callback: (cursor: Cursor) => void): Disposable;
152
+
153
+ /** Calls your callback when a Cursor is added to the editor. */
154
+ onDidAddCursor(callback: (cursor: Cursor) => void): Disposable;
155
+
156
+ /** Calls your callback when a Cursor is removed from the editor. */
157
+ onDidRemoveCursor(callback: (cursor: Cursor) => void): Disposable;
158
+
159
+ /**
160
+ * Calls your callback when a Selection is added to the editor. Immediately
161
+ * calls your callback for each existing selection.
162
+ */
163
+ observeSelections(callback: (selection: Selection) => void): Disposable;
164
+
165
+ /** Calls your callback when a Selection is added to the editor. */
166
+ onDidAddSelection(callback: (selection: Selection) => void): Disposable;
167
+
168
+ /** Calls your callback when a Selection is removed from the editor. */
169
+ onDidRemoveSelection(callback: (selection: Selection) => void): Disposable;
170
+
171
+ /**
172
+ * Calls your callback with each Decoration added to the editor. Calls your
173
+ * callback immediately for any existing decorations.
174
+ */
175
+ observeDecorations(callback: (decoration: Decoration) => void): Disposable;
176
+
177
+ /** Calls your callback when a Decoration is added to the editor. */
178
+ onDidAddDecoration(callback: (decoration: Decoration) => void): Disposable;
179
+
180
+ /** Calls your callback when a Decoration is removed from the editor. */
181
+ onDidRemoveDecoration(callback: (decoration: Decoration) => void): Disposable;
182
+
183
+ /** Calls your callback when the placeholder text is changed. */
184
+ onDidChangePlaceholderText(callback: (placeholderText: string) => void): Disposable;
185
+
186
+ // File Details
187
+ /**
188
+ * Get the editor's title for display in other parts of the UI such as the
189
+ * tabs.
190
+ *
191
+ * If the editor's buffer is saved, its title is the file name. If it is
192
+ * unsaved, its title is "untitled".
193
+ */
194
+ getTitle(): string;
195
+
196
+ /**
197
+ * Get unique title for display in other parts of the UI, such as the window
198
+ * title.
199
+ *
200
+ * If the editor's buffer is unsaved, its title is "untitled."
201
+ *
202
+ * If the editor's buffer is saved, its unique title is formatted as one of
203
+ * the following:
204
+ *
205
+ * "" when it is the only editing buffer with this file name.
206
+ * " — " when other buffers have this file name.
207
+ */
208
+ getLongTitle(): string;
209
+
210
+ /** Return the string path of this editor's text buffer. */
211
+ getPath(): string | undefined;
212
+
213
+ /** Return boolean true if this editor has been modified. */
214
+ isModified(): boolean;
215
+
216
+ /** Return boolean true if this editor has no content. */
217
+ isEmpty(): boolean;
218
+
219
+ /** Return true if this editor has not yet been destroyed. */
220
+ isAlive(): boolean;
221
+
222
+ /** Returns the string character set encoding of this editor's text buffer. */
223
+ getEncoding(): string;
224
+
225
+ /** Set the character set encoding to use in this editor's text buffer. */
226
+ setEncoding(encoding: string): void;
227
+
228
+ // File Operations
229
+ /**
230
+ * Saves the editor's text buffer.
231
+ *
232
+ * See {@link TextBuffer#save}.
233
+ */
234
+ save(): Promise<void>;
235
+
236
+ /**
237
+ * Saves the editor's text buffer as the given path.
238
+ *
239
+ * See {@link TextBuffer#saveAs} for more details.
240
+ */
241
+ saveAs(filePath: string): Promise<void>;
242
+
243
+ // Reading Text
244
+ /** Returns a string representing the entire contents of the editor. */
245
+ getText(): string;
246
+
247
+ /** Get the text in the given range in buffer coordinates. */
248
+ getTextInBufferRange(range: RangeCompatible): string;
249
+
250
+ /** Returns a number representing the number of lines in the buffer. */
251
+ getLineCount(): number;
252
+
253
+ /**
254
+ * Returns a number representing the number of screen lines in the editor.
255
+ *
256
+ * This accounts for folds.
257
+ */
258
+ getScreenLineCount(): number;
259
+
260
+ /**
261
+ * Returns a number representing the last zero-indexed buffer row number of
262
+ * the editor.
263
+ */
264
+ getLastBufferRow(): number;
265
+
266
+ /**
267
+ * Returns a number representing the last zero-indexed screen row number of
268
+ * the editor.
269
+ */
270
+ getLastScreenRow(): number;
271
+
272
+ /**
273
+ * Returns a string representing the contents of the line at the given
274
+ * buffer row.
275
+ */
276
+ lineTextForBufferRow(bufferRow: number): string;
277
+
278
+ /**
279
+ * Returns a string representing the contents of the line at the given
280
+ * screen row.
281
+ */
282
+ lineTextForScreenRow(screenRow: number): string;
283
+
284
+ /**
285
+ * Get the range of the paragraph surrounding the most recently added cursor.
286
+ */
287
+ getCurrentParagraphBufferRange(): Range;
288
+
289
+ // Mutating Text
290
+ /** Replaces the entire contents of the buffer with the given string. */
291
+ setText(text: string, options?: ReadonlyEditOptions): void;
292
+
293
+ /** Set the text in the given Range in buffer coordinates. */
294
+ setTextInBufferRange(range: RangeCompatible, text: string, options?: TextEditOptions & ReadonlyEditOptions): Range;
295
+
296
+ /** For each selection, replace the selected text with the given text. */
297
+ insertText(text: string, options?: TextInsertionOptions & ReadonlyEditOptions): Range | false;
298
+
299
+ /** For each selection, replace the selected text with a newline. */
300
+ insertNewline(options?: ReadonlyEditOptions): void;
301
+
302
+ /**
303
+ * For each selection, if the selection is empty, delete the character
304
+ * following the cursor. Otherwise delete the selected text.
305
+ */
306
+ delete(options?: ReadonlyEditOptions): void;
307
+
308
+ /**
309
+ * For each selection, if the selection is empty, delete the character
310
+ * preceding the cursor. Otherwise delete the selected text.
311
+ */
312
+ backspace(options?: ReadonlyEditOptions): void;
313
+
314
+ /**
315
+ * Mutate the text of all the selections in a single transaction. All the
316
+ * changes made inside the given function can be reverted with a single call
317
+ * to {@link undo}.
318
+ */
319
+ mutateSelectedText(fn: (selection: Selection, index: number) => void): void;
320
+
321
+ /**
322
+ * For each selection, transpose the selected text.
323
+ * If the selection is empty, the characters preceding and following the cursor
324
+ * are swapped. Otherwise, the selected characters are reversed.
325
+ */
326
+ transpose(options?: ReadonlyEditOptions): void;
327
+
328
+ /**
329
+ * Convert the selected text to upper case.
330
+ * For each selection, if the selection is empty, converts the containing word
331
+ * to upper case. Otherwise convert the selected text to upper case.
332
+ */
333
+ upperCase(options?: ReadonlyEditOptions): void;
334
+
335
+ /**
336
+ * Convert the selected text to lower case.
337
+ * For each selection, if the selection is empty, converts the containing word
338
+ * to upper case. Otherwise convert the selected text to upper case.
339
+ */
340
+ lowerCase(options?: ReadonlyEditOptions): void;
341
+
342
+ /**
343
+ * Toggle line comments for rows intersecting selections.
344
+ * If the current grammar doesn't support comments, does nothing.
345
+ */
346
+ toggleLineCommentsInSelection(options?: ReadonlyEditOptions): void;
347
+
348
+ /** For each cursor, insert a newline at beginning the following line. */
349
+ insertNewlineBelow(options?: ReadonlyEditOptions): void;
350
+
351
+ /** For each cursor, insert a newline at the end of the preceding line. */
352
+ insertNewlineAbove(options?: ReadonlyEditOptions): void;
353
+
354
+ /**
355
+ * For each selection, if the selection is empty, delete all characters of the
356
+ * containing word that precede the cursor. Otherwise delete the selected text.
357
+ */
358
+ deleteToBeginningOfWord(options?: ReadonlyEditOptions): void;
359
+
360
+ /**
361
+ * Similar to {@link deleteToBeginningOfWord}, but deletes only back to the
362
+ * previous word boundary.
363
+ */
364
+ deleteToPreviousWordBoundary(options?: ReadonlyEditOptions): void;
365
+
366
+ /**
367
+ * Similar to {@link deleteToEndOfWord}, but deletes only up to the next word
368
+ * boundary.
369
+ */
370
+ deleteToNextWordBoundary(options?: ReadonlyEditOptions): void;
371
+
372
+ /**
373
+ * For each selection, if the selection is empty, delete all characters of
374
+ * the containing subword following the cursor. Otherwise delete the selected
375
+ * text.
376
+ */
377
+ deleteToBeginningOfSubword(options?: ReadonlyEditOptions): void;
378
+
379
+ /**
380
+ * For each selection, if the selection is empty, delete all characters of
381
+ * the containing subword following the cursor. Otherwise delete the selected
382
+ * text.
383
+ */
384
+ deleteToEndOfSubword(options?: ReadonlyEditOptions): void;
385
+
386
+ /**
387
+ * For each selection, if the selection is empty, delete all characters of
388
+ * the containing line that precede the cursor. Otherwise delete the selected
389
+ * text.
390
+ */
391
+ deleteToBeginningOfLine(options?: ReadonlyEditOptions): void;
392
+
393
+ /**
394
+ * For each selection, if the selection is not empty, deletes the selection
395
+ * otherwise, deletes all characters of the containing line following the
396
+ * cursor.
397
+ *
398
+ * If the cursor is already at the end of the line, deletes the following
399
+ * newline.
400
+ */
401
+ deleteToEndOfLine(options?: ReadonlyEditOptions): void;
402
+
403
+ /**
404
+ * For each selection, if the selection is empty, delete all characters of
405
+ * the containing word following the cursor. Otherwise delete the selected
406
+ * text.
407
+ */
408
+ deleteToEndOfWord(options?: ReadonlyEditOptions): void;
409
+
410
+ /** Delete all lines intersecting selections. */
411
+ deleteLine(options?: ReadonlyEditOptions): void;
412
+
413
+ // History
414
+ /** Undo the last change. */
415
+ undo(options?: ReadonlyEditOptions): void;
416
+
417
+ /** Redo the last change. */
418
+ redo(options?: ReadonlyEditOptions): void;
419
+
420
+ /**
421
+ * Batch multiple operations as a single undo/redo step.
422
+ *
423
+ * Any group of operations that are logically grouped from the perspective of
424
+ * undoing and redoing should be performed in a transaction. If you want to
425
+ * abort the transaction, call {@link abortTransaction} to terminate the
426
+ * function's execution and revert any changes performed up to the abortion.
427
+ */
428
+ transact(fn: () => void): void;
429
+ /**
430
+ * Batch multiple operations as a single undo/redo step.
431
+ *
432
+ * Any group of operations that are logically grouped from the perspective of
433
+ * undoing and redoing should be performed in a transaction. If you want to
434
+ * abort the transaction, call {@link abortTransaction} to terminate the
435
+ * function's execution and revert any changes performed up to the abortion.
436
+ */
437
+ transact(groupingInterval: number, fn: () => void): void;
438
+
439
+ /**
440
+ * Abort an open transaction, undoing any operations performed so far within
441
+ * the transaction.
442
+ */
443
+ abortTransaction(): void;
444
+
445
+ /**
446
+ * Create a pointer to the current state of the buffer for use with
447
+ * {@link revertToCheckpoint} and {@link groupChangesSinceCheckpoint}.
448
+ */
449
+ createCheckpoint(): number;
450
+
451
+ /**
452
+ * Revert the buffer to the state it was in when the given checkpoint was
453
+ * created.
454
+ *
455
+ * The redo stack will be empty following this operation, so changes since
456
+ * the checkpoint will be lost. If the given checkpoint is no longer present
457
+ * in the undo history, no changes will be made to the buffer and this method
458
+ * will return `false`.
459
+ */
460
+ revertToCheckpoint(checkpoint: number): boolean;
461
+
462
+ /**
463
+ * Group all changes since the given checkpoint into a single transaction for
464
+ * purposes of undo/redo.
465
+ *
466
+ * If the given checkpoint is no longer present in the undo history, no
467
+ * grouping will be performed and this method will return false.
468
+ */
469
+ groupChangesSinceCheckpoint(checkpoint: number): boolean;
470
+
471
+ // TextEditor Coordinates
472
+ /** Convert a position in buffer-coordinates to screen-coordinates. */
473
+ screenPositionForBufferPosition(
474
+ bufferPosition: PointCompatible,
475
+ options?: { clipDirection?: "backward" | "forward" | "closest" | undefined },
476
+ ): Point;
477
+
478
+ /** Convert a position in screen-coordinates to buffer-coordinates. */
479
+ bufferPositionForScreenPosition(
480
+ bufferPosition: PointCompatible,
481
+ options?: { clipDirection?: "backward" | "forward" | "closest" | undefined },
482
+ ): Point;
483
+
484
+ /** Convert a range in buffer-coordinates to screen-coordinates. */
485
+ screenRangeForBufferRange(bufferRange: RangeCompatible): Range;
486
+
487
+ /** Convert a range in screen-coordinates to buffer-coordinates. */
488
+ bufferRangeForScreenRange(screenRange: RangeCompatible): Range;
489
+
490
+ /** Clip the given Point to a valid position in the buffer. */
491
+ clipBufferPosition(bufferPosition: PointCompatible): Point;
492
+
493
+ /**
494
+ * Clip the start and end of the given range to valid positions in the
495
+ * buffer. See {@link clipBufferPosition} for more information.
496
+ */
497
+ clipBufferRange(range: RangeCompatible): Range;
498
+
499
+ /** Clip the given Point to a valid position on screen. */
500
+ clipScreenPosition(
501
+ screenPosition: PointCompatible,
502
+ options?: { clipDirection?: "backward" | "forward" | "closest" | undefined },
503
+ ): Point;
504
+
505
+ /**
506
+ * Clip the start and end of the given range to valid positions on screen.
507
+ * See {@link clipScreenPosition} for more information.
508
+ */
509
+ clipScreenRange(
510
+ range: RangeCompatible,
511
+ options?: { clipDirection?: "backward" | "forward" | "closest" | undefined },
512
+ ): Range;
513
+
514
+ // Decorations
515
+ /**
516
+ * Add a decoration that tracks a DisplayMarker. When the marker moves, is
517
+ * invalidated, or is destroyed, the decoration will be updated to reflect
518
+ * the marker's state.
519
+ */
520
+ decorateMarker(marker: DisplayMarker, decorationParams: DecorationOptions): Decoration;
521
+
522
+ /**
523
+ * Add a decoration to every marker in the given marker layer. Can be used to
524
+ * decorate a large number of markers without having to create and manage
525
+ * many individual decorations.
526
+ */
527
+ decorateMarkerLayer(
528
+ markerLayer: MarkerLayer | DisplayMarkerLayer,
529
+ decorationParams: DecorationLayerOptions,
530
+ ): LayerDecoration;
531
+
532
+ /** Get all decorations. */
533
+ getDecorations(propertyFilter?: DecorationOptions): Decoration[];
534
+
535
+ /** Get all decorations of type 'line'. */
536
+ getLineDecorations(propertyFilter?: DecorationOptions): Decoration[];
537
+
538
+ /** Get all decorations of type 'line-number'. */
539
+ getLineNumberDecorations(propertyFilter?: DecorationOptions): Decoration[];
540
+
541
+ /** Get all decorations of type 'highlight'. */
542
+ getHighlightDecorations(propertyFilter?: DecorationOptions): Decoration[];
543
+
544
+ /** Get all decorations of type 'overlay'. */
545
+ getOverlayDecorations(propertyFilter?: DecorationOptions): Decoration[];
546
+
547
+ // Markers
548
+ /**
549
+ * Create a marker on the default marker layer with the given range in buffer
550
+ * coordinates.
551
+ *
552
+ * This marker will maintain its logical location as the buffer is changed,
553
+ * so if you mark a particular word, the marker will remain over that word
554
+ * even if the word's location in the buffer changes.
555
+ */
556
+ markBufferRange(
557
+ range: RangeCompatible,
558
+ properties?: {
559
+ maintainHistory?: boolean | undefined;
560
+ reversed?: boolean | undefined;
561
+ invalidate?: "never" | "surround" | "overlap" | "inside" | "touch" | undefined;
562
+ },
563
+ ): DisplayMarker;
564
+
565
+ /**
566
+ * Create a marker on the default marker layer with the given range in screen
567
+ * coordinates.
568
+ *
569
+ * This marker will maintain its logical location as the buffer is changed,
570
+ * so if you mark a particular word, the marker will remain over that word
571
+ * even if the word's location in the buffer changes.
572
+ */
573
+ markScreenRange(
574
+ range: RangeCompatible,
575
+ properties?: {
576
+ maintainHistory?: boolean | undefined;
577
+ reversed?: boolean | undefined;
578
+ invalidate?: "never" | "surround" | "overlap" | "inside" | "touch" | undefined;
579
+ },
580
+ ): DisplayMarker;
581
+
582
+ /**
583
+ * Create a marker on the default marker layer with the given buffer position
584
+ * and no tail. To group multiple markers together in their own private
585
+ * layer, see {@link addMarkerLayer}.
586
+ */
587
+ markBufferPosition(
588
+ bufferPosition: PointCompatible,
589
+ options?: {
590
+ invalidate?: "never" | "surround" | "overlap" | "inside" | "touch" | undefined;
591
+ },
592
+ ): DisplayMarker;
593
+
594
+ /**
595
+ * Create a marker on the default marker layer with the given screen position
596
+ * and no tail. To group multiple markers together in their own private
597
+ * layer, see {@link addMarkerLayer}.
598
+ */
599
+ markScreenPosition(
600
+ screenPosition: PointCompatible,
601
+ options?: {
602
+ invalidate?: "never" | "surround" | "overlap" | "inside" | "touch" | undefined;
603
+ clipDirection?: "backward" | "forward" | "closest" | undefined;
604
+ },
605
+ ): DisplayMarker;
606
+
607
+ /**
608
+ * Find all DisplayMarkers on the default marker layer that match the given properties.
609
+ *
610
+ * This method finds markers based on the given properties. Markers can be
611
+ * associated with custom properties that will be compared with basic
612
+ * equality. In addition, there are several special properties that will be
613
+ * compared with the range of the markers rather than their properties.
614
+ */
615
+ findMarkers(properties: FindDisplayMarkerOptions): DisplayMarker[];
616
+
617
+ /** Create a marker layer to group related markers. */
618
+ addMarkerLayer(
619
+ options?: { maintainHistory?: boolean | undefined; persistent?: boolean | undefined },
620
+ ): DisplayMarkerLayer;
621
+
622
+ /** Get a DisplayMarkerLayer by id. */
623
+ getMarkerLayer(id: number): DisplayMarkerLayer | undefined;
624
+
625
+ /**
626
+ * Get the default DisplayMarkerLayer.
627
+ *
628
+ * All marker APIs not tied to an explicit layer interact with this default
629
+ * layer.
630
+ */
631
+ getDefaultMarkerLayer(): DisplayMarkerLayer;
632
+
633
+ /** Get the DisplayMarker on the default layer for the given marker id. */
634
+ getMarker(id: number): DisplayMarker;
635
+
636
+ /**
637
+ * Get all DisplayMarkers on the default marker layer.
638
+ *
639
+ * Consider using {@link findMarkers}.
640
+ */
641
+ getMarkers(): DisplayMarker[];
642
+
643
+ /** Get the number of markers in the default marker layer. */
644
+ getMarkerCount(): number;
645
+
646
+ // Cursors
647
+ /**
648
+ * Get the position of the most recently added cursor in buffer coordinates.
649
+ */
650
+ getCursorBufferPosition(): Point;
651
+
652
+ /** Get the position of all the cursor positions in buffer coordinates. */
653
+ getCursorBufferPositions(): Point[];
654
+
655
+ /**
656
+ * Move the cursor to the given position in buffer coordinates.
657
+ *
658
+ * If there are multiple cursors, they will be consolidated to a single
659
+ * cursor.
660
+ */
661
+ setCursorBufferPosition(position: PointCompatible, options?: { autoscroll?: boolean | undefined }): void;
662
+
663
+ /** Get a {@link Cursor} at the given screen coordinates, if one exists. */
664
+ getCursorAtScreenPosition(position: PointCompatible): Cursor | undefined;
665
+
666
+ /**
667
+ * Get the position of the most recently added cursor in screen coordinates.
668
+ */
669
+ getCursorScreenPosition(): Point;
670
+
671
+ /** Get the positions of all the cursors in screen coordinates. */
672
+ getCursorScreenPositions(): Point[];
673
+
674
+ /**
675
+ * Move the cursor to the given position in screen coordinates.
676
+ *
677
+ * If there are multiple cursors, they will be consolidated to a single
678
+ * cursor.
679
+ */
680
+ setCursorScreenPosition(position: PointCompatible, options?: { autoscroll?: boolean | undefined }): void;
681
+
682
+ /** Add a cursor at the given position in buffer coordinates. */
683
+ addCursorAtBufferPosition(bufferPosition: PointCompatible, options?: { autoscroll?: boolean | undefined }): Cursor;
684
+
685
+ /** Add a cursor at the position in screen coordinates. */
686
+ addCursorAtScreenPosition(screenPosition: PointCompatible): Cursor;
687
+
688
+ /** Returns a boolean indicating whether or not there are multiple cursors. */
689
+ hasMultipleCursors(): boolean;
690
+
691
+ /** Move every cursor up one row in screen coordinates. */
692
+ moveUp(lineCount?: number): void;
693
+
694
+ /** Move every cursor down one row in screen coordinates. */
695
+ moveDown(lineCount?: number): void;
696
+
697
+ /** Move every cursor left one column. */
698
+ moveLeft(columnCount?: number): void;
699
+
700
+ /** Move every cursor right one column. */
701
+ moveRight(columnCount?: number): void;
702
+
703
+ /** Move every cursor to the beginning of its line in buffer coordinates. */
704
+ moveToBeginningOfLine(): void;
705
+
706
+ /** Move every cursor to the beginning of its line in screen coordinates. */
707
+ moveToBeginningOfScreenLine(): void;
708
+
709
+ /** Move every cursor to the first non-whitespace character of its line. */
710
+ moveToFirstCharacterOfLine(): void;
711
+
712
+ /** Move every cursor to the end of its line in buffer coordinates. */
713
+ moveToEndOfLine(): void;
714
+
715
+ /** Move every cursor to the end of its line in screen coordinates. */
716
+ moveToEndOfScreenLine(): void;
717
+
718
+ /** Move every cursor to the beginning of its surrounding word. */
719
+ moveToBeginningOfWord(): void;
720
+
721
+ /** Move every cursor to the end of its surrounding word. */
722
+ moveToEndOfWord(): void;
723
+
724
+ /**
725
+ * Move every cursor to the top of the buffer.
726
+ *
727
+ * If there are multiple cursors, they will be merged into a single cursor.
728
+ */
729
+ moveToTop(): void;
730
+
731
+ /**
732
+ * Move every cursor to the bottom of the buffer.
733
+ *
734
+ * If there are multiple cursors, they will be merged into a single cursor.
735
+ */
736
+ moveToBottom(): void;
737
+
738
+ /** Move every cursor to the beginning of the next word. */
739
+ moveToBeginningOfNextWord(): void;
740
+
741
+ /** Move every cursor to the previous word boundary. */
742
+ moveToPreviousWordBoundary(): void;
743
+
744
+ /** Move every cursor to the next word boundary. */
745
+ moveToNextWordBoundary(): void;
746
+
747
+ /** Move every cursor to the previous subword boundary. */
748
+ moveToPreviousSubwordBoundary(): void;
749
+
750
+ /** Move every cursor to the next subword boundary. */
751
+ moveToNextSubwordBoundary(): void;
752
+
753
+ /** Move every cursor to the beginning of the next paragraph. */
754
+ moveToBeginningOfNextParagraph(): void;
755
+
756
+ /** Move every cursor to the beginning of the previous paragraph. */
757
+ moveToBeginningOfPreviousParagraph(): void;
758
+
759
+ /** Returns the most recently added Cursor. */
760
+ getLastCursor(): Cursor;
761
+
762
+ /** Returns the word surrounding the most recently added cursor. */
763
+ getWordUnderCursor(options?: {
764
+ wordRegex?: RegExp | undefined;
765
+ includeNonWordCharacters?: boolean | undefined;
766
+ allowPrevious?: boolean | undefined;
767
+ }): string;
768
+
769
+ /** Get an Array of all Cursors. */
770
+ getCursors(): Cursor[];
771
+
772
+ /**
773
+ * Get all cursors, ordered by their position in the buffer instead of the
774
+ * order in which they were added.
775
+ */
776
+ getCursorsOrderedByBufferPosition(): Cursor[];
777
+
778
+ // Selections
779
+ /** Get the selected text of the most recently added selection. */
780
+ getSelectedText(): string;
781
+
782
+ /**
783
+ * Get the {@link Range} of the most recently added selection in buffer
784
+ * coordinates.
785
+ */
786
+ getSelectedBufferRange(): Range;
787
+
788
+ /**
789
+ * Get the {@link Range}s of all selections in buffer coordinates.
790
+ *
791
+ * The ranges are sorted by when the selections were added, most recent at
792
+ * the end.
793
+ */
794
+ getSelectedBufferRanges(): Range[];
795
+
796
+ /**
797
+ * Set the selected range in buffer coordinates. If there are multiple
798
+ * selections, they are reduced to a single selection with the given range.
799
+ */
800
+ setSelectedBufferRange(
801
+ bufferRange: RangeCompatible,
802
+ options?: { reversed?: boolean | undefined; preserveFolds?: boolean | undefined },
803
+ ): void;
804
+
805
+ /**
806
+ * Set the selected ranges in buffer coordinates. If there are multiple
807
+ * selections, they are replaced by new selections with the given ranges.
808
+ */
809
+ setSelectedBufferRanges(
810
+ bufferRanges: readonly RangeCompatible[],
811
+ options?: { reversed?: boolean | undefined; preserveFolds?: boolean | undefined },
812
+ ): void;
813
+
814
+ /**
815
+ * Get the {@link Range} of the most recently added selection in screen
816
+ * coordinates.
817
+ */
818
+ getSelectedScreenRange(): Range;
819
+
820
+ /**
821
+ * Get the {@link Range}s of all selections in screen coordinates.
822
+ *
823
+ * The ranges are sorted by when the selections were added, most recent at
824
+ * the end.
825
+ */
826
+ getSelectedScreenRanges(): Range[];
827
+
828
+ /**
829
+ * Set the selected range in screen coordinates.
830
+ *
831
+ * If there are multiple selections, they are reduced to a single selection
832
+ * with the given range.
833
+ */
834
+ setSelectedScreenRange(screenRange: RangeCompatible, options?: { reversed?: boolean | undefined }): void;
835
+
836
+ /**
837
+ * Set the selected ranges in screen coordinates.
838
+ *
839
+ * If there are multiple selections, they are replaced by new selections with
840
+ * the given ranges.
841
+ */
842
+ setSelectedScreenRanges(
843
+ screenRanges: readonly RangeCompatible[],
844
+ options?: { reversed?: boolean | undefined },
845
+ ): void;
846
+
847
+ /** Add a selection for the given range in buffer coordinates. */
848
+ addSelectionForBufferRange(
849
+ bufferRange: RangeCompatible,
850
+ options?: { reversed?: boolean | undefined; preserveFolds?: boolean | undefined },
851
+ ): Selection;
852
+
853
+ /** Add a selection for the given range in screen coordinates. */
854
+ addSelectionForScreenRange(
855
+ screenRange: RangeCompatible,
856
+ options?: { reversed?: boolean | undefined; preserveFolds?: boolean | undefined },
857
+ ): Selection;
858
+
859
+ /**
860
+ * Select from the current cursor position to the given position in buffer
861
+ * coordinates.
862
+ *
863
+ * This method may merge selections that end up intersecting.
864
+ */
865
+ selectToBufferPosition(position: PointCompatible): void;
866
+
867
+ /**
868
+ * Select from the current cursor position to the given position in screen
869
+ * coordinates.
870
+ *
871
+ * This method may merge selections that end up intersecting.
872
+ */
873
+ selectToScreenPosition(position: PointCompatible): void;
874
+
875
+ /**
876
+ * Move the cursor of each selection one character upward while preserving
877
+ * the selection's tail position.
878
+ *
879
+ * This method may merge selections that end up intersecting.
880
+ */
881
+ selectUp(rowCount?: number): void;
882
+
883
+ /**
884
+ * Move the cursor of each selection one character downward while preserving
885
+ * the selection's tail position.
886
+ *
887
+ * This method may merge selections that end up intersecting.
888
+ */
889
+ selectDown(rowCount?: number): void;
890
+
891
+ /**
892
+ * Move the cursor of each selection one character leftward while preserving
893
+ * the selection's tail position.
894
+ *
895
+ * This method may merge selections that end up intersecting.
896
+ */
897
+ selectLeft(columnCount?: number): void;
898
+
899
+ /**
900
+ * Move the cursor of each selection one character rightward while preserving
901
+ * the selection's tail position.
902
+ *
903
+ * This method may merge selections that end up intersecting.
904
+ */
905
+ selectRight(columnCount?: number): void;
906
+
907
+ /**
908
+ * Select from the top of the buffer to the end of the last selection in the
909
+ * buffer.
910
+ *
911
+ * This method merges multiple selections into a single selection.
912
+ */
913
+ selectToTop(): void;
914
+
915
+ /**
916
+ * Selects from the top of the first selection in the buffer to the end of
917
+ * the buffer.
918
+ *
919
+ * This method merges multiple selections into a single selection.
920
+ */
921
+ selectToBottom(): void;
922
+
923
+ /**
924
+ * Select all text in the buffer.
925
+ *
926
+ * This method merges multiple selections into a single selection.
927
+ */
928
+ selectAll(): void;
929
+
930
+ /**
931
+ * Move the cursor of each selection to the beginning of its line while
932
+ * preserving the selection's tail position.
933
+ *
934
+ * This method may merge selections that end up intersecting.
935
+ */
936
+ selectToBeginningOfLine(): void;
937
+
938
+ /**
939
+ * Move the cursor of each selection to the first non-whitespace character of
940
+ * its line while preserving the selection's tail position.
941
+ *
942
+ * If the cursor is already on the first character of the line, move it to
943
+ * the beginning of the line. This method may merge selections that end up
944
+ * intersecting.
945
+ */
946
+ selectToFirstCharacterOfLine(): void;
947
+
948
+ /**
949
+ * Move the cursor of each selection to the end of its line while preserving
950
+ * the selection's tail position.
951
+ *
952
+ * This method may merge selections that end up intersecting.
953
+ */
954
+ selectToEndOfLine(): void;
955
+
956
+ /**
957
+ * Expand selections to the beginning of their containing word.
958
+ *
959
+ * Operates on all selections. Moves the cursor to the beginning of the
960
+ * containing word while preserving the selection's tail position.
961
+ */
962
+ selectToBeginningOfWord(): void;
963
+
964
+ /**
965
+ * Expand selections to the end of their containing word.
966
+ *
967
+ * Operates on all selections. Moves the cursor to the end of the containing
968
+ * word while preserving the selection's tail position.
969
+ */
970
+ selectToEndOfWord(): void;
971
+
972
+ /**
973
+ * For each cursor, select the containing line.
974
+ *
975
+ * This method merges selections on successive lines.
976
+ */
977
+ selectLinesContainingCursors(): void;
978
+
979
+ /** Select the word surrounding each cursor. */
980
+ selectWordsContainingCursors(): void;
981
+
982
+ /**
983
+ * For each selection, move its cursor to the preceding subword boundary
984
+ * while maintaining the selection's tail position.
985
+ *
986
+ * This method may merge selections that end up intersecting.
987
+ */
988
+ selectToPreviousSubwordBoundary(): void;
989
+
990
+ /**
991
+ * For each selection, move its cursor to the next subword boundary while
992
+ * maintaining the selection's tail position.
993
+ *
994
+ * This method may merge selections that end up intersecting.
995
+ */
996
+ selectToNextSubwordBoundary(): void;
997
+
998
+ /**
999
+ * For each selection, move its cursor to the preceding word boundary while
1000
+ * maintaining the selection's tail position.
1001
+ *
1002
+ * This method may merge selections that end up intersecting.
1003
+ */
1004
+ selectToPreviousWordBoundary(): void;
1005
+
1006
+ /**
1007
+ * For each selection, move its cursor to the next word boundary while
1008
+ * maintaining the selection's tail position.
1009
+ *
1010
+ * This method may merge selections that end up intersecting.
1011
+ */
1012
+ selectToNextWordBoundary(): void;
1013
+
1014
+ /**
1015
+ * Expand selections to the beginning of the next word.
1016
+ *
1017
+ * Operates on all selections. Moves the cursor to the beginning of the next
1018
+ * word while preserving the selection's tail position.
1019
+ */
1020
+ selectToBeginningOfNextWord(): void;
1021
+
1022
+ /**
1023
+ * Expand selections to the beginning of the next paragraph.
1024
+ *
1025
+ * Operates on all selections. Moves the cursor to the beginning of the next
1026
+ * paragraph while preserving the selection's tail position.
1027
+ */
1028
+ selectToBeginningOfNextParagraph(): void;
1029
+
1030
+ /**
1031
+ * Expand selections to the beginning of the next paragraph.
1032
+ *
1033
+ * Operates on all selections. Moves the cursor to the beginning of the next
1034
+ * paragraph while preserving the selection's tail position.
1035
+ */
1036
+ selectToBeginningOfPreviousParagraph(): void;
1037
+
1038
+ /** For each selection, select the syntax node that contains that selection. */
1039
+ selectLargerSyntaxNode(): void;
1040
+
1041
+ /**
1042
+ * Undo the effect of a preceding call to {@link selectLargerSyntaxNode},
1043
+ * narrowing the selection in the process.
1044
+ */
1045
+ selectSmallerSyntaxNode(): void;
1046
+
1047
+ /** Select the range of the given marker if it is valid. */
1048
+ selectMarker(marker: DisplayMarker): Range | undefined;
1049
+
1050
+ /** Get the most recently added Selection. */
1051
+ getLastSelection(): Selection;
1052
+
1053
+ /** Get current Selections. */
1054
+ getSelections(): Selection[];
1055
+
1056
+ /**
1057
+ * Get all Selections, ordered by their position in the buffer instead of the
1058
+ * order in which they were added.
1059
+ */
1060
+ getSelectionsOrderedByBufferPosition(): Selection[];
1061
+
1062
+ // NOTE: this calls into Selection::intersectsBufferRange, which itself calls
1063
+ // into Range::intersectsWith. Range::intersectsWith is one of the few functions
1064
+ // which does NOT take a range-compatible array.
1065
+ /** Determine if a given range in buffer coordinates intersects a selection. */
1066
+ selectionIntersectsBufferRange(bufferRange: RangeLike): boolean;
1067
+
1068
+ // Searching and Replacing
1069
+ /**
1070
+ * Scan regular expression matches in the entire buffer, calling the given
1071
+ * iterator function on each match.
1072
+ *
1073
+ * ::scan functions as the replace method as well via the replace.
1074
+ */
1075
+ scan(regex: RegExp, options: ScanContextOptions, iterator: (params: ContextualBufferScanResult) => void): void;
1076
+
1077
+ /**
1078
+ * Scan regular expression matches in the entire buffer, calling the given
1079
+ * iterator function on each match.
1080
+ *
1081
+ * ::scan functions as the replace method as well via the replace.
1082
+ */
1083
+ scan(regex: RegExp, iterator: (params: BufferScanResult) => void): void;
1084
+
1085
+ /**
1086
+ * Scan regular expression matches in a given range, calling the given
1087
+ * iterator. function on each match.
1088
+ */
1089
+ scanInBufferRange(regex: RegExp, range: RangeCompatible, iterator: (params: BufferScanResult) => void): void;
1090
+
1091
+ /**
1092
+ * Scan regular expression matches in a given range in reverse order, calling
1093
+ * the given iterator function on each match.
1094
+ */
1095
+ backwardsScanInBufferRange(
1096
+ regex: RegExp,
1097
+ range: RangeCompatible,
1098
+ iterator: (params: BufferScanResult) => void,
1099
+ ): void;
1100
+
1101
+ // Tab Behavior
1102
+ /** Return whether soft tabs are enabled for this editor. */
1103
+ getSoftTabs(): boolean;
1104
+
1105
+ /** Enable or disable soft tabs for this editor. */
1106
+ setSoftTabs(softTabs: boolean): void;
1107
+
1108
+ /** Toggle soft tabs for this editor. */
1109
+ toggleSoftTabs(): boolean;
1110
+
1111
+ /** Get the on-screen length of tab characters. */
1112
+ getTabLength(): number;
1113
+
1114
+ /**
1115
+ * Set the on-screen length of tab characters. Setting this to a number will
1116
+ * override the editor.tabLength setting.
1117
+ */
1118
+ setTabLength(tabLength: number): void;
1119
+
1120
+ /** Determine if the buffer uses hard or soft tabs. */
1121
+ usesSoftTabs(): boolean | undefined;
1122
+
1123
+ /**
1124
+ * Get the text representing a single level of indent.
1125
+ *
1126
+ * If soft tabs are enabled, the text is composed of N spaces, where N is the
1127
+ * tab length. Otherwise the text is a tab character (`\t`).
1128
+ */
1129
+ getTabText(): string;
1130
+
1131
+ // Soft Wrap Behavior
1132
+ /** Return whether lines in this editor are soft-wrapped. */
1133
+ isSoftWrapped(): boolean;
1134
+
1135
+ /** Enable or disable soft wrapping for this editor. */
1136
+ setSoftWrapped(softWrapped: boolean): boolean;
1137
+
1138
+ /** Toggle soft wrapping for this editor. */
1139
+ toggleSoftWrapped(): boolean;
1140
+
1141
+ /** Gets the column at which column will soft wrap. */
1142
+ getSoftWrapColumn(): number;
1143
+
1144
+ // Indentation
1145
+ /**
1146
+ * Get the indentation level of the given buffer row.
1147
+ *
1148
+ * Determines how deeply the given row is indented based on the soft tabs and
1149
+ * tab length settings of this editor. Note that if soft tabs are enabled and
1150
+ * the tab length is 2, a row with 4 leading spaces would have an indentation
1151
+ * level of 2.
1152
+ */
1153
+ indentationForBufferRow(bufferRow: number): number;
1154
+
1155
+ /**
1156
+ * Set the indentation level for the given buffer row.
1157
+ *
1158
+ * Inserts or removes hard tabs or spaces based on the soft tabs and tab
1159
+ * length settings of this editor in order to bring it to the given
1160
+ * indentation level. Note that if soft tabs are enabled and the tab length
1161
+ * is 2, a row with 4 leading spaces would have an indentation level of 2.
1162
+ */
1163
+ setIndentationForBufferRow(
1164
+ bufferRow: number,
1165
+ newLevel: number,
1166
+ options?: { preserveLeadingWhitespace?: boolean | undefined },
1167
+ ): void;
1168
+
1169
+ /** Indent rows intersecting selections by one level. */
1170
+ indentSelectedRows(options?: ReadonlyEditOptions): void;
1171
+
1172
+ /** Outdent rows intersecting selections by one level. */
1173
+ outdentSelectedRows(options?: ReadonlyEditOptions): void;
1174
+
1175
+ /**
1176
+ * Get the indentation level of the given line of text.
1177
+ *
1178
+ * Determines how deeply the given line is indented based on the soft tabs
1179
+ * and tab length settings of this editor. Note that if soft tabs are enabled
1180
+ * and the tab length is 2, a row with 4 leading spaces would have an
1181
+ * indentation level of 2.
1182
+ */
1183
+ indentLevelForLine(line: string): number;
1184
+
1185
+ /**
1186
+ * Indent rows intersecting selections based on the grammar's suggested
1187
+ * indent level.
1188
+ */
1189
+ autoIndentSelectedRows(options?: ReadonlyEditOptions): void;
1190
+
1191
+ // Grammars
1192
+ /** Get the current {@link Grammar} of this editor. */
1193
+ getGrammar(): Grammar;
1194
+
1195
+ /**
1196
+ * Set the current {@link Grammar} of this editor.
1197
+ *
1198
+ * Assigning a grammar will cause the editor to re-tokenize based on the new
1199
+ * grammar.
1200
+ *
1201
+ * @deprecated Assign a language mode from {@link TextBuffer}.
1202
+ */
1203
+ setGrammar(grammar: Grammar): void;
1204
+
1205
+ // Managing Syntax Scopes
1206
+ /**
1207
+ * Returns a ScopeDescriptor that includes this editor's language.
1208
+ * e.g. [".source.ruby"], or [".source.coffee"].
1209
+ */
1210
+ getRootScopeDescriptor(): ScopeDescriptor;
1211
+
1212
+ /**
1213
+ * Get the syntactic scope descriptor for the given position in buffer
1214
+ * coordinates.
1215
+ */
1216
+ scopeDescriptorForBufferPosition(bufferPosition: PointCompatible): ScopeDescriptor;
1217
+
1218
+ /**
1219
+ * If using a Tree-sitter language mode, returns a scope descriptor where
1220
+ * the "scopes" are Tree-sitter node names.
1221
+ *
1222
+ * If using a TextMate language mode, falls back to
1223
+ * {@link scopeDescriptorForBufferPosition}.
1224
+ */
1225
+ syntaxTreeScopeDescriptorForBufferPosition(bufferPosition: PointCompatible): ScopeDescriptor;
1226
+
1227
+ /**
1228
+ * Get the range in buffer coordinates of all tokens surrounding the cursor
1229
+ * that match the given scope selector.
1230
+ */
1231
+ bufferRangeForScopeAtCursor(scopeSelector: string): Range;
1232
+
1233
+ /** Determine if the given row is entirely a comment. */
1234
+ isBufferRowCommented(bufferRow: number): boolean;
1235
+
1236
+ // Clipboard Operations
1237
+ /** For each selection, copy the selected text. */
1238
+ copySelectedText(): void;
1239
+
1240
+ /** For each selection, cut the selected text. */
1241
+ cutSelectedText(options?: ReadonlyEditOptions): void;
1242
+
1243
+ /**
1244
+ * For each selection, replace the selected text with the contents of the
1245
+ * clipboard.
1246
+ *
1247
+ * If the clipboard contains the same number of selections as the current
1248
+ * editor, each selection will be replaced with the content of the
1249
+ * corresponding clipboard selection text.
1250
+ */
1251
+ pasteText(options?: TextInsertionOptions & ReadonlyEditOptions): void;
1252
+
1253
+ /**
1254
+ * For each selection, if the selection is empty, cut all characters of the
1255
+ * containing screen line following the cursor; otherwise cut the selected
1256
+ * text.
1257
+ */
1258
+ cutToEndOfLine(options?: ReadonlyEditOptions): void;
1259
+
1260
+ /**
1261
+ * For each selection, if the selection is empty, cut all characters of the
1262
+ * containing buffer line following the cursor; otherwise cut the selected
1263
+ * text.
1264
+ */
1265
+ cutToEndOfBufferLine(options?: ReadonlyEditOptions): void;
1266
+
1267
+ // Folds
1268
+ /**
1269
+ * Fold the most recent cursor's row based on its indentation level.
1270
+ *
1271
+ * The fold will extend from the nearest preceding line with a lower
1272
+ * indentation level up to the nearest following row with a lower indentation
1273
+ * level.
1274
+ */
1275
+ foldCurrentRow(): void;
1276
+
1277
+ /** Unfold the most recent cursor's row by one level. */
1278
+ unfoldCurrentRow(): void;
1279
+
1280
+ /**
1281
+ * Fold the given row in buffer coordinates based on its indentation level.
1282
+ *
1283
+ * If the given row is foldable, the fold will begin there. Otherwise, it
1284
+ * will begin at the first foldable row preceding the given row.
1285
+ */
1286
+ foldBufferRow(bufferRow: number): void;
1287
+
1288
+ /** Unfold all folds containing the given row in buffer coordinates. */
1289
+ unfoldBufferRow(bufferRow: number): void;
1290
+
1291
+ /** For each selection, fold the rows it intersects. */
1292
+ foldSelectedLines(): void;
1293
+
1294
+ /** Fold all foldable lines. */
1295
+ foldAll(): void;
1296
+
1297
+ /** Unfold all existing folds. */
1298
+ unfoldAll(): void;
1299
+
1300
+ /**
1301
+ * Fold all foldable lines at the given indent level.
1302
+ *
1303
+ * @param level A zero-indexed number.
1304
+ */
1305
+ foldAllAtIndentLevel(level: number): void;
1306
+
1307
+ /**
1308
+ * Determine whether the given row in buffer coordinates is foldable.
1309
+ *
1310
+ * A foldable row is a row that starts a row range that can be folded.
1311
+ */
1312
+ isFoldableAtBufferRow(bufferRow: number): boolean;
1313
+
1314
+ /**
1315
+ * Determine whether the given row in screen coordinates is foldable.
1316
+ *
1317
+ * A foldable row is a row that starts a row range that can be folded.
1318
+ */
1319
+ isFoldableAtScreenRow(bufferRow: number): boolean;
1320
+
1321
+ /**
1322
+ * Fold the given buffer row if it isn't currently folded, and unfold it
1323
+ * otherwise.
1324
+ */
1325
+ toggleFoldAtBufferRow(bufferRow: number): void;
1326
+
1327
+ /** Determine whether the most recently added cursor's row is folded. */
1328
+ isFoldedAtCursorRow(): boolean;
1329
+
1330
+ /** Determine whether the given row in buffer coordinates is folded. */
1331
+ isFoldedAtBufferRow(bufferRow: number): boolean;
1332
+
1333
+ /** Determine whether the given row in screen coordinates is folded. */
1334
+ isFoldedAtScreenRow(screenRow: number): boolean;
1335
+
1336
+ // Gutters
1337
+ /** Add a custom Gutter. */
1338
+ addGutter(options: GutterOptions): Gutter;
1339
+
1340
+ /** Get this editor's gutters. */
1341
+ getGutters(): Gutter[];
1342
+
1343
+ /** Get the gutter with the given name. */
1344
+ gutterWithName(name: string): Gutter | null;
1345
+
1346
+ // Scrolling the TextEditor
1347
+ /**
1348
+ * Scroll the editor to reveal the most recently added cursor if it is
1349
+ * off-screen.
1350
+ */
1351
+ scrollToCursorPosition(options?: { center?: boolean | undefined }): void;
1352
+
1353
+ /** Scrolls the editor to the given buffer position. */
1354
+ scrollToBufferPosition(
1355
+ bufferPosition: PointCompatible,
1356
+ options?: { center?: boolean | undefined }
1357
+ ): void;
1358
+
1359
+ /** Scrolls the editor to the given screen position. */
1360
+ scrollToScreenPosition(
1361
+ screenPosition: PointCompatible,
1362
+ options?: { center?: boolean | undefined }
1363
+ ): void;
1364
+
1365
+ // TextEditor Rendering
1366
+ /** Retrieves the rendered line height in pixels. */
1367
+ getLineHeightInPixels(): number;
1368
+
1369
+ /** Retrieves the greyed out placeholder of a mini editor. */
1370
+ getPlaceholderText(): string;
1371
+
1372
+ /**
1373
+ * Set the greyed out placeholder of a mini editor.
1374
+ *
1375
+ * Placeholder text will be displayed when the editor has no content.
1376
+ */
1377
+ setPlaceholderText(placeholderText: string): void;
1378
+
1379
+ /** Undocumented: Buffer range for syntax scope at position */
1380
+ bufferRangeForScopeAtPosition(scope: string, point: PointCompatible): Range;
1381
+
1382
+ /** Undocumented: Get syntax token at buffer position */
1383
+ tokenForBufferPosition(pos: PointCompatible): { value: string; scopes: string[] };
1384
+
1385
+ /**
1386
+ * Experimental: Get the characters that are *not* considered part of
1387
+ * words, for the purpose of word-based cursor movements.
1388
+ */
1389
+ getNonWordCharacters(pos: PointCompatible): string;
1390
+
1391
+ /** Undocumented: Destroy the editor. */
1392
+ destroy(): void;
1393
+
1394
+ /** Undocumented: Return whether the editor is destroyed. */
1395
+ isDestroyed(): boolean;
1396
+
1397
+ /**
1398
+ * Given a point in the buffer, retrieves the correct comment delimiters for
1399
+ * that context.
1400
+ *
1401
+ * Pulsar allows language bundles to define comment delimiters in several
1402
+ * places. For instance, a grammar author may place delimiter metadata in the
1403
+ * grammar definition file, or as scope-specific settings in the ordinary
1404
+ * config system — or a combination of the two.
1405
+ *
1406
+ * In some languages, comment delimiters vary based on context. (For
1407
+ * instance, line comments cannot always be used in JavaScript JSX blocks, so
1408
+ * block comments are much safer.) This method will look for any such
1409
+ * overrides and return what it thinks are the best delimiters to use at a
1410
+ * given point.
1411
+ *
1412
+ * Some languages don't specify all their delimiters in their configuration,
1413
+ * but this method will return all the information that it can discern.
1414
+ */
1415
+ getCommentDelimitersForBufferPosition(pos: PointCompatible): CommentDelimiterSpec;
1416
+ }