@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
package/src/pane.d.ts ADDED
@@ -0,0 +1,604 @@
1
+ import { Disposable, TextEditor, ViewModel, Workspace } from "../index";
2
+
3
+ /** Anything that can be rendered as a member of a {@link Pane}. */
4
+ export type PaneItem = AbstractPaneItem | HTMLElement;
5
+
6
+ type PaneItemLocation = 'left' | 'right' | 'bottom' | 'center';
7
+ type PaneItemSerializer = { deserializer: string } & Record<string, unknown>;
8
+ type PaneItemFileFilter = { name: string, extensions: string[] };
9
+
10
+ /**
11
+ * Properties to apply to the save dialog:
12
+ *
13
+ * * `showHiddenFiles`: Show hidden files in the dialog.
14
+ * * `createDirectory` (macOS): Allow creating new directories from the dialog.
15
+ * * `treatPackageAsDirectory` (macOS): Treat packages, such as `.app` folders,
16
+ * as directories instead of files.
17
+ * * `showOverwriteConfirmation` (Linux): Ensures the user will be prompted for
18
+ * confirmation if they choose a file that already exists.
19
+ * * `dontAddToRecent` (Windows): Do not add the item being saved to the
20
+ * recent documents list.
21
+ */
22
+ type PaneItemSaveDialogProperty = |
23
+ 'showHiddenFiles' |
24
+ 'createDirectory' |
25
+ 'treatPackageAsDirectory' |
26
+ 'showOverwriteConfirmation' |
27
+ 'dontAddToRecent';
28
+
29
+ /**
30
+ * Options for a save dialog.
31
+ */
32
+ type PaneItemSaveDialogOptions = {
33
+ /**
34
+ * The dialog title. Cannot be displayed on some Linux desktop environments.
35
+ */
36
+ title?: string,
37
+
38
+ /**
39
+ * Absolute directory path, absolute file path, or file name to use by
40
+ * default.
41
+ */
42
+ defaultPath?: string,
43
+
44
+ /**
45
+ * Custom label for the confirmation button of the dialog. When left empty,
46
+ * the default label will be used.
47
+ */
48
+ buttonLabel?: string,
49
+
50
+ /**
51
+ * Filters to apply to the save dialog. When present, will show only the
52
+ * specified file extensions.
53
+ */
54
+ filters?: PaneItemFileFilter[],
55
+
56
+ /**
57
+ * Message to display above text fields. Only applies on macOS.
58
+ */
59
+ message?: string,
60
+
61
+ /**
62
+ * Custom label for the text displayed in front of the filename text field.
63
+ * Only applies on macOS.
64
+ */
65
+ nameFieldLabel?: string,
66
+
67
+ /**
68
+ * Whether to show the tags input box. Only applies on macOS. Defaults to
69
+ * `true`.
70
+ */
71
+ showsTagField?: boolean,
72
+
73
+ /**
74
+ * Apply properties to the dialog. See {@link PaneItemSaveDialogProperty}.
75
+ */
76
+ properties?: PaneItemSaveDialogProperty[]
77
+ };
78
+
79
+ /**
80
+ * An interface implemented by “view model”–style pane items as opposed to bare
81
+ * DOM nodes.
82
+ *
83
+ * Pane items observe a very loose interface in which nearly all methods are
84
+ * optional, but it is very useful to implement all the methods that are
85
+ * appropriate for your view. Each one grants a certain automatic behavior or
86
+ * privilege.
87
+ */
88
+ interface AbstractPaneItem extends ViewModel {
89
+ // Required methods
90
+ /**
91
+ * Return the title of the pane item.
92
+ *
93
+ * Implement this method for your pane item’s title to be reflected in the
94
+ * tab bar, the window title, and other places.
95
+ */
96
+ getTitle(): string;
97
+
98
+ /**
99
+ * Return the element that should be used for your pane item’s view.
100
+ *
101
+ * If you elect not to return a bare element to represent your pane item,
102
+ * this method must exist and must return an element.
103
+ */
104
+ getElement(): HTMLElement;
105
+
106
+ // Optional methods
107
+
108
+ /**
109
+ * Return the URI associated with the item.
110
+ *
111
+ * URIs are useful for pane items to have, and mandatory if a pane item wants
112
+ * to serialize itself so that it can survive an editor relaunch or window
113
+ * reload.
114
+ *
115
+ * Pane items with URIs can be operated on more flexibly with API methods.
116
+ * For instance: {@link Workspace#hide} accepts a pane item, but can also
117
+ * accept a string URI.
118
+ *
119
+ * URIs are not required to be unique. For instance: since a pane item may
120
+ * be copied, two copies of the same pane item will usually have the same
121
+ * URI.
122
+ *
123
+ * If a pane item exists because an opener function acted on a given URI
124
+ * (see {@link Workspace#addOpener}), that pane item should implement this
125
+ * method and return the original URI that was used to open the pane item.
126
+ */
127
+ getURI?(): string;
128
+
129
+ /**
130
+ * Destroy the pane item.
131
+ *
132
+ * If this method exists, it will be called by the workspace when the item is
133
+ * removed from its current pane.
134
+ */
135
+ destroy?(): unknown;
136
+
137
+ /**
138
+ * Register a callback to be invoked when your pane item is destroyed.
139
+ *
140
+ * If you implement `destroy`, you should also implement this method.
141
+ *
142
+ * Must return a {@link Disposable}.
143
+ */
144
+ onDidDestroy?(callback): Disposable;
145
+
146
+ /**
147
+ * Indicate whether this pane has already been destroyed.
148
+ *
149
+ * If this method returns `true`, this pane item may no longer be added to
150
+ * any {@link Pane}.
151
+ */
152
+ isDestroyed?(): boolean;
153
+
154
+ /**
155
+ * Serialize the state of the item.
156
+ *
157
+ * Must return an object that can be passed to {@link JSON.stringify}. The
158
+ * state should include a field called `deserializer` that names a
159
+ * deserializer declared in your `package.json`. This method is invoked on
160
+ * items when serializing the workspace so that they can be restored to the
161
+ * same location after a relaunch or window reload.
162
+ */
163
+ serialize?(): PaneItemSerializer;
164
+
165
+ /**
166
+ * Register a callback to be invoked when your pane item’s title changes.
167
+ *
168
+ * If this method exists, the workspace will use it to subscribe to title
169
+ * updates for your pane item. This method must return a {@link Disposable}.
170
+ *
171
+ * If your pane item‘s title won’t change after creation, you do not need to
172
+ * implement this method.
173
+ */
174
+ onDidChangeTitle?(callback: (newTitle: string) => unknown): Disposable;
175
+
176
+ /**
177
+ * Return the “long” title of the pane item.
178
+ *
179
+ * If present, this method will be called when it needs a longer version of
180
+ * your pane item’s title — for instance, when setting the window title, or
181
+ * when more than one tab has the same name and disambiguation is needed.
182
+ */
183
+ getLongTitle?(): string;
184
+
185
+ /**
186
+ * Return the name of an icon.
187
+ *
188
+ * If this method is defined and returns a string, the item’s tab element
189
+ * will include the specified icon.
190
+ *
191
+ * The icon name should be “bare” and should not begin with `icon-`.
192
+ */
193
+ getIconName?(): string;
194
+
195
+ /**
196
+ * Register a callback to be notified when the item’s icon changes.
197
+ *
198
+ * If this method exists, it will be called by the workspace. This method
199
+ * must return a {@link Disposable}.
200
+ *
201
+ * If your pane item’s icon will not change after creation, you do not need
202
+ * to implement this method.
203
+ */
204
+ onDidChangeIcon?(callback: (newIcon: string) => unknown): Disposable;
205
+
206
+ /**
207
+ * Tell the workspace where your item should be opened in absence of a user
208
+ * override. Items can appear in the center or in a dock on the left, right,
209
+ * or bottom of the workspace.
210
+ *
211
+ * When this method is not defined, `center` is the default pane item
212
+ * location.
213
+ */
214
+ getDefaultLocation?(): PaneItemLocation;
215
+
216
+ /**
217
+ * Tell the workspace where this item can be moved. Must return an array
218
+ * containing one or more {@link PaneItemLocation}s; any valid values omitted
219
+ * from that array will not be allowed to contain this pane item.
220
+ */
221
+ getAllowedLocations?(): PaneItemLocation[];
222
+
223
+ /**
224
+ * Tell the workspace whether or not this item may be closed by the user by
225
+ * clicking an `x` on its tab.
226
+ *
227
+ * Use of this feature is discouraged unless there’s a very good reason not
228
+ * to allow users to close your item. Items may be made permanent _only_ when
229
+ * they are contained in docks; pane items in the workspace center may always
230
+ * be removed.
231
+ *
232
+ * Note that it is still currently possible to close dock items via the
233
+ * “Close Pane” option in the context menu and via Pulsar APIs, so you should
234
+ * still be prepared to handle your dock items being destroyed by the user
235
+ * even if you implement this method.
236
+ */
237
+ isPermanentDockItem?(): boolean
238
+
239
+ /**
240
+ * Save the item.
241
+ *
242
+ * Implement this method if your pane item should respond to the `core:save`
243
+ * command.
244
+ *
245
+ * This method is invoked only when your pane item implements the
246
+ * {@link getURI} method; otherwise, {@link saveAs} will be called instead.
247
+ *
248
+ * This method is allowed to go asynchronous if needed.
249
+ */
250
+ save?(): void | Promise<void>;
251
+
252
+ /**
253
+ * Save the item to the specified path.
254
+ *
255
+ * Implement this method if your pane item should respond to the
256
+ * `core:save-as` command. The path returned by {@link getPath}, if any, will
257
+ * be used as the initial location for the “save as” dialog.
258
+ *
259
+ * This method is allowed to go asynchronous if needed.
260
+ */
261
+ save?(filePath: string): void | Promise<void>;
262
+
263
+ /**
264
+ * Return the local path associated with this item.
265
+ *
266
+ * This is used to set the initial location of the “save as” dialog.
267
+ */
268
+ getPath?(): string;
269
+
270
+ /**
271
+ * Return options for a save dialog that is invoked on this pane item.
272
+ *
273
+ * When this method is present, it will be used when a “save” or “save as”
274
+ * dialog is shown. If this method returns an object with a `defaultPath`
275
+ * property, it will be used instead of the return value of {@link getPath}.
276
+ *
277
+ * The full list of options is defined by Electron; consult
278
+ * https://www.electronjs.org/docs/latest/api/dialog#dialogshowsavedialogwindow-options.
279
+ */
280
+ getSaveDialogOptions?(): PaneItemSaveDialogOptions;
281
+
282
+ /**
283
+ * Return whether the item is “modified” — i.e., is changed from its
284
+ * representation on disk.
285
+ *
286
+ * If this method is implemented and returns `true`, your pane item’s tab
287
+ * will indicate this modified state the same way it does for a modified
288
+ * buffer.
289
+ */
290
+ isModified?(): boolean
291
+
292
+ /**
293
+ * Register a callback to be notified when the item’s “modified” status
294
+ * changes. Must return a {@link Disposable}.
295
+ *
296
+ * If you implement {@link isModified}, you should also implement this
297
+ * method. When this method exists, the workspace will automatically call it
298
+ * so it can subscribe to changes in your item’s “modified” status.
299
+ */
300
+ onDidChangeModified?(callback: (newModified: boolean) => unknown): Disposable
301
+
302
+ /**
303
+ * Create a copy of the current pane item.
304
+ *
305
+ * Certain workspace commands will implicitly copy a pane item when creating
306
+ * a new split. If you define this method, your pane items can be copied in
307
+ * the same manner as editor pane items and others.
308
+ */
309
+ copy?(): AbstractPaneItem;
310
+
311
+ /**
312
+ * Report the pane’s preferred height.
313
+ *
314
+ * If this item is displayed in the bottom {@link Dock}, the workspace will
315
+ * call this method when the dock changes from hidden to visible. Once the
316
+ * dock has been resized by the user, the height they set will override this
317
+ * value.
318
+ */
319
+ getPreferredHeight?(): number;
320
+
321
+ /**
322
+ * Report the pane’s preferred width.
323
+ *
324
+ * If this item is displayed in the left or right {@link Dock}, the workspace
325
+ * will call this method when that dock changes from hidden to visible. Once
326
+ * that dock has been resized by the user, the width they set will override
327
+ * this value.
328
+ */
329
+ getPreferredWidth?(): number;
330
+
331
+ /**
332
+ * Register a callback to be notified when this pane item should no longer be
333
+ * considered “pending.” Must return a {@link Disposable}.
334
+ *
335
+ * If the workspace is configured to use pending pane items, it will
336
+ * use this method to find out when the pane item feels it should lose its
337
+ * pending status and be promoted to a “regular” pane item.
338
+ */
339
+ onDidTerminatePendingState?(callback: () => unknown): Disposable;
340
+
341
+ /**
342
+ * Return whether Pulsar should prompt the user to save this item when the
343
+ * user closes or reloads the window.
344
+ *
345
+ * The logic for whether to prompt to save this item is unconnected to any
346
+ * other pane item logic. For instance: the workspace will not use the
347
+ * “modified” status of the item to decide whether to prompt, even when
348
+ * {@link isModified} is implemented; but you are, of course, free to reuse
349
+ * `isModified` within your `shouldPromptToSave` implementation if
350
+ * appropriate.
351
+ */
352
+ shouldPromptToSave?(): boolean;
353
+
354
+
355
+ /**
356
+ * Register a callback to be notified when a {@link TextEditor} embedded
357
+ * within this pane item is created or changed.
358
+ *
359
+ * This method is used by the `find-and-replace` package. Finding text within
360
+ * the active pane item typically only works when that item is a
361
+ * {@link TextEditor}… but if your view embeds its own `TextEditor`,
362
+ * implementing this method allows “Find in Current Buffer” to work correctly
363
+ * even on your custom pane item.
364
+ *
365
+ * Matches will be highlighted and shortcuts like “Find Next” and “Find
366
+ * Previous” will move to the correct positions, even if your editor is
367
+ * read-only.
368
+ *
369
+ * You must also, of course, do the work of invoking these callbacks when you
370
+ * attach or reattatch an editor to your view.
371
+ */
372
+ observeEmbeddedTextEditor?(
373
+ callback: (editor: TextEditor) => unknown
374
+ ): Disposable;
375
+ }
376
+
377
+ /** A container for presenting content in the center of the workspace. */
378
+ export interface Pane {
379
+ // Event Subscription
380
+ /** Invoke the given callback when the pane resizes. */
381
+ onDidChangeFlexScale(callback: (flexScale: number) => void): Disposable;
382
+
383
+ /** Invoke the given callback with the current and future values of ::getFlexScale. */
384
+ observeFlexScale(callback: (flexScale: number) => void): Disposable;
385
+
386
+ /** Invoke the given callback when the pane is activated. */
387
+ onDidActivate(callback: () => void): Disposable;
388
+
389
+ /** Invoke the given callback before the pane is destroyed. */
390
+ onWillDestroy(callback: () => void): Disposable;
391
+
392
+ /** Invoke the given callback when the pane is destroyed. */
393
+ onDidDestroy(callback: () => void): Disposable;
394
+
395
+ /** Invoke the given callback when the value of the ::isActive property changes. */
396
+ onDidChangeActive(callback: (active: boolean) => void): Disposable;
397
+
398
+ /**
399
+ * Invoke the given callback with the current and future values of the ::isActive
400
+ * property.
401
+ */
402
+ observeActive(callback: (active: boolean) => void): Disposable;
403
+
404
+ /** Invoke the given callback when an item is added to the pane. */
405
+ onDidAddItem(callback: (event: PaneListItemShiftedEvent) => void): Disposable;
406
+
407
+ /** Invoke the given callback when an item is removed from the pane. */
408
+ onDidRemoveItem(callback: (event: PaneListItemShiftedEvent) => void): Disposable;
409
+
410
+ /** Invoke the given callback before an item is removed from the pane. */
411
+ onWillRemoveItem(callback: (event: PaneListItemShiftedEvent) => void): Disposable;
412
+
413
+ /** Invoke the given callback when an item is moved within the pane. */
414
+ onDidMoveItem(callback: (event: PaneItemMovedEvent) => void): Disposable;
415
+
416
+ /** Invoke the given callback with all current and future items. */
417
+ observeItems(callback: (item: PaneItem) => void): Disposable;
418
+
419
+ /** Invoke the given callback when the value of ::getActiveItem changes. */
420
+ onDidChangeActiveItem(callback: (activeItem: PaneItem) => void): Disposable;
421
+
422
+ /**
423
+ * Invoke the given callback when {@link activateNextRecentlyUsedItem} has
424
+ * been called, either initiating or continuing a forward MRU traversal of
425
+ * pane items.
426
+ */
427
+ onChooseNextMRUItem(callback: (nextRecentlyUsedItem: PaneItem) => void): Disposable;
428
+
429
+ /**
430
+ * Invoke the given callback when {@link activatePreviousRecentlyUsedItem}
431
+ * has been called, either initiating or continuing a reverse MRU traversal
432
+ * of pane items.
433
+ */
434
+ onChooseLastMRUItem(callback: (previousRecentlyUsedItem: PaneItem) => void): Disposable;
435
+
436
+ /**
437
+ * Invoke the given callback when ::moveActiveItemToTopOfStack has been called,
438
+ * terminating an MRU traversal of pane items and moving the current active item
439
+ * to the top of the stack. Typically bound to a modifier (e.g. CTRL) key up event.
440
+ */
441
+ onDoneChoosingMRUItem(callback: () => void): Disposable;
442
+
443
+ /** Invoke the given callback with the current and future values of ::getActiveItem. */
444
+ observeActiveItem(callback: (activeItem: PaneItem) => void): Disposable;
445
+
446
+ /** Invoke the given callback before items are destroyed. */
447
+ onWillDestroyItem(callback: (event: PaneListItemShiftedEvent) => void): Disposable;
448
+
449
+ // Items
450
+ /** Get the items in this pane. */
451
+ getItems(): PaneItem[];
452
+
453
+ /** Get the active pane item in this pane. */
454
+ getActiveItem(): PaneItem;
455
+
456
+ /** Return the item at the given index. */
457
+ itemAtIndex(index: number): PaneItem | undefined;
458
+
459
+ /** Makes the next item active. */
460
+ activateNextItem(): void;
461
+
462
+ /** Makes the previous item active. */
463
+ activatePreviousItem(): void;
464
+
465
+ /** Move the active tab to the right. */
466
+ moveItemRight(): void;
467
+
468
+ /** Move the active tab to the left. */
469
+ moveItemLeft(): void;
470
+
471
+ /** Get the index of the active item. */
472
+ getActiveItemIndex(): number;
473
+
474
+ /** Activate the item at the given index. */
475
+ activateItemAtIndex(index: number): void;
476
+
477
+ /** Make the given item active, causing it to be displayed by the pane's view. */
478
+ activateItem(item: PaneItem, options?: { pending: boolean }): void;
479
+
480
+ /** Add the given item to the pane. */
481
+ addItem(item: PaneItem, options?: { index?: number | undefined; pending?: boolean | undefined }): PaneItem;
482
+
483
+ /** Add the given items to the pane. */
484
+ addItems(items: PaneItem[], index?: number): PaneItem[];
485
+
486
+ /** Move the given item to the given index. */
487
+ moveItem(item: PaneItem, index: number): void;
488
+
489
+ /** Move the given item to the given index on another pane. */
490
+ moveItemToPane(item: PaneItem, pane: Pane, index: number): void;
491
+
492
+ /** Destroy the active item and activate the next item. */
493
+ destroyActiveItem(): Promise<boolean>;
494
+
495
+ /** Destroy the given item. */
496
+ destroyItem(item: PaneItem, force?: boolean): Promise<boolean>;
497
+
498
+ /** Destroy all items. */
499
+ destroyItems(): Promise<boolean[]>;
500
+
501
+ /** Destroy all items except for the active item. */
502
+ destroyInactiveItems(): Promise<boolean[]>;
503
+
504
+ /** Save the active item. */
505
+ saveActiveItem<T = void>(nextAction?: (error?: Error) => T): Promise<T> | undefined;
506
+
507
+ /**
508
+ * Prompt the user for a location and save the active item with the path
509
+ * they select.
510
+ */
511
+ saveActiveItemAs<T = void>(nextAction?: (error?: Error) => T): Promise<T> | undefined;
512
+
513
+ /** Save the given item. */
514
+ saveItem<T = void>(item: PaneItem, nextAction?: (error?: Error) => T): Promise<T> | undefined;
515
+
516
+ /**
517
+ * Prompt the user for a location and save the active item with the path
518
+ * they select.
519
+ */
520
+ saveItemAs<T = void>(item: PaneItem, nextAction?: (error?: Error) => T): Promise<T> | undefined;
521
+
522
+ /** Save all items. */
523
+ saveItems(): void;
524
+
525
+ /** Return the first item that matches the given URI or undefined if none exists. */
526
+ itemForURI(uri: string): PaneItem | undefined;
527
+
528
+ /** Activate the first item that matches the given URI. */
529
+ activateItemForURI(uri: string): boolean;
530
+
531
+ // Lifecycle
532
+ /** Determine whether the pane is active. */
533
+ isActive(): boolean;
534
+
535
+ /** Makes this pane the active pane, causing it to gain focus. */
536
+ activate(): void;
537
+
538
+ /** Close the pane and destroy all its items. */
539
+ destroy(): void;
540
+
541
+ /** Determine whether this pane has been destroyed. */
542
+ isDestroyed(): boolean;
543
+
544
+ // Splitting
545
+ /** Creat a new pane to the left of this pane. */
546
+ splitLeft(params?: { items?: PaneItem[] | undefined; copyActiveItem?: boolean | undefined }): Pane;
547
+
548
+ /** Creat a new pane to the right of this pane. */
549
+ splitRight(params?: { items?: PaneItem[] | undefined; copyActiveItem?: boolean | undefined }): Pane;
550
+
551
+ /** Create a new pane above the receiver. */
552
+ splitUp(params?: { items?: PaneItem[] | undefined; copyActiveItem?: boolean | undefined }): Pane;
553
+
554
+ /** Create a new pane below the receiver. */
555
+ splitDown(params?: { items?: PaneItem[] | undefined; copyActiveItem?: boolean | undefined }): Pane;
556
+
557
+ // Pending items
558
+
559
+ /** Retrieve this pane's pending item, if any. */
560
+ getPendingItem(): PaneItem | null;
561
+
562
+ /**
563
+ * Set this pane's pending item.
564
+ *
565
+ * Will replace any other pending item that may be present in this pane.
566
+ */
567
+ setPendingItem(item: PaneItem | null): void;
568
+
569
+ /**
570
+ * Clear this pane's pending item, if any.
571
+ *
572
+ * If a pending pane item exists, it will implicitly be closed.
573
+ */
574
+ clearPendingItem(): void;
575
+ }
576
+
577
+ export interface PaneListItemShiftedEvent {
578
+ /** The pane item that was added or removed. */
579
+ item: PaneItem;
580
+
581
+ /** A number indicating where the item is located. */
582
+ index: number;
583
+ }
584
+
585
+ export interface PaneItemMovedEvent {
586
+ /** The removed pane item. */
587
+ item: PaneItem;
588
+
589
+ /** A number indicating where the item was located. */
590
+ oldIndex: number;
591
+
592
+ /** A number indicating where the item is now located. */
593
+ newIndex: number;
594
+ }
595
+
596
+ export interface PaneItemObservedEvent {
597
+ item: PaneItem;
598
+ pane: Pane;
599
+ index: number;
600
+ }
601
+
602
+ export interface PaneItemOpenedEvent extends PaneItemObservedEvent {
603
+ uri: string;
604
+ }
package/src/panel.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ import { Disposable, Workspace } from "../index";
2
+
3
+ /**
4
+ * A container representing a panel on the edges of the editor window. You
5
+ * should not create a Panel directly; instead use
6
+ * {@link Workspace#addTopPanel} and friends to add panels.
7
+ */
8
+ export interface Panel<T = object> {
9
+ /** Whether or not the Panel is visible. */
10
+ readonly visible: boolean;
11
+
12
+ // Construction and Destruction
13
+ /** Destroy and remove this panel from the UI. */
14
+ destroy(): void;
15
+
16
+ // Event Subscription
17
+ /** Invoke the given callback when the pane hidden or shown. */
18
+ onDidChangeVisible(callback: (visible: boolean) => void): Disposable;
19
+
20
+ /** Invoke the given callback when the pane is destroyed. */
21
+ onDidDestroy(callback: (panel: Panel<T>) => void): Disposable;
22
+
23
+ // Panel Details
24
+ /** Returns the panel's item. */
25
+ getItem(): T;
26
+
27
+ /** Returns a number indicating this panel's priority. */
28
+ getPriority(): number;
29
+
30
+ /** Returns a boolean true when the panel is visible. */
31
+ isVisible(): boolean;
32
+
33
+ /** Hide this panel. */
34
+ hide(): void;
35
+
36
+ /** Show this panel. */
37
+ show(): void;
38
+ }
@@ -0,0 +1,35 @@
1
+ import { Disposable, DisposableLike, FilesystemChangeEvent } from "../index";
2
+
3
+ /** Manage a subscription to filesystem events that occur beneath a root directory. */
4
+ export interface PathWatcher extends DisposableLike {
5
+ /**
6
+ * Return a Promise that will resolve when the underlying native watcher is
7
+ * ready to begin sending events.
8
+ */
9
+ getStartPromise(): Promise<void>;
10
+
11
+ /** Invokes a function when any errors related to this watcher are reported. */
12
+ onDidError(callback: (error: Error) => void): Disposable;
13
+
14
+ /**
15
+ * Unsubscribe all subscribers from filesystem events. Native resources will be
16
+ * released asynchronously, but this watcher will stop broadcasting events
17
+ * immediately.
18
+ */
19
+ dispose(): void;
20
+ }
21
+
22
+ interface PathWatcherOptions {
23
+ // No options currently defined.
24
+ }
25
+
26
+ /**
27
+ * Invoke a callback with each filesystem event that occurs beneath a specified path.
28
+ * If you only need to watch events within the project's root paths, use
29
+ * Project::onDidChangeFiles instead.
30
+ */
31
+ export function watchPath(
32
+ rootPath: string,
33
+ options: PathWatcherOptions,
34
+ eventCallback: (events: FilesystemChangeEvent) => void,
35
+ ): Promise<PathWatcher>;