@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,294 @@
1
+ import {
2
+ Config,
3
+ Grammar,
4
+ GrammarRegistry,
5
+ PointCompatible,
6
+ Range,
7
+ ScopeDescriptor,
8
+ TextBuffer
9
+ } from '../index';
10
+ import { CommentDelimiterSpec, WASMTreeSitterGrammar } from './wasm-tree-sitter-grammar';
11
+
12
+ type TransactionMetadata = {
13
+ /** How many atomic edits were made since the last clean tree. */
14
+ changeCount: number,
15
+ /**
16
+ * A single range that represents the extent of the changes made since the
17
+ * last clean tree.
18
+ */
19
+ range: Range | null,
20
+ /**
21
+ * How many times Pulsar requested auto-indent actions that this language
22
+ * mode couldn't fulfill atomically.
23
+ */
24
+ autoIndentRequests: number
25
+ };
26
+
27
+ type SuggestedIndentForBufferRowOptions = {
28
+ /**
29
+ * Whether to skip emitting the `did-suggest-indent` event. Defaults to
30
+ * `false`.
31
+ */
32
+ skipEvent?: boolean,
33
+ /**
34
+ * Whether to skip blank lines when looking for a comparison row. Defaults to
35
+ * `true`.
36
+ */
37
+ skipBlankLines?: boolean,
38
+ /**
39
+ * Whether to skip the second (dedent) phase of indentation hinting.
40
+ */
41
+ skipDedentCheck?: boolean,
42
+ /**
43
+ * Whether to account for the leading whitespace that already exists on a row
44
+ * when returning an indentation level. Defaults to `false`.
45
+ */
46
+ preserveLeadingWhitespace: boolean,
47
+
48
+ /** Undocumented: An internal cache used to reduce work. */
49
+ indentationLevels?: Map<number, number> | null,
50
+
51
+ /**
52
+ * Whether to force a re-parse of the tree if we think the tree is dirty.
53
+ * Defaults to `false`.
54
+ */
55
+ forceTreeParse?: boolean
56
+ };
57
+
58
+ export class WASMTreeSitterLanguageMode {
59
+ id: number;
60
+ buffer: TextBuffer;
61
+ grammar: WASMTreeSitterGrammar;
62
+ grammarRegistry: GrammarRegistry;
63
+ config: Config;
64
+
65
+ useAsyncParsing: boolean;
66
+ useAsyncIndent: boolean;
67
+
68
+ rootScopeDescriptor: ScopeDescriptor;
69
+
70
+ /** Destroy this language layer. */
71
+ destroy(): void;
72
+
73
+ getGrammar(): Grammar;
74
+
75
+ getLanguageId(): string;
76
+
77
+ getNonWordCharacters(pos: PointCompatible): string;
78
+
79
+ /**
80
+ * Resolves when all pending tree parses are finished — or immediately, if no
81
+ * parsing is currently underway.
82
+ *
83
+ * If a parse is underway, will resolve with metadata about that transaction
84
+ * that might be useful for the caller to know.
85
+ */
86
+ atTransactionEnd(): Promise<TransactionMetadata | void>;
87
+
88
+ /**
89
+ * Alias of {@link atTransactionEnd}; implemented for API compatibility with
90
+ * the legacy Tree-sitter language mode.
91
+ */
92
+ parseCompletePromise(): Promise<TransactionMetadata | void>;
93
+
94
+ /**
95
+ * Given a language string — a string that describes a language informally —
96
+ * determine the best match among active grammars.
97
+ *
98
+ * Consults grammars' `injectionRegex` properties and returns whichever one
99
+ * produces the longest match against the input.
100
+ */
101
+ grammarForLanguageString(languageString: string): WASMTreeSitterGrammar | null;
102
+
103
+ /**
104
+ * Add a listener for when this language mode first finishes parsing the
105
+ * buffer.
106
+ */
107
+ onDidTokenize(callback: () => void): Disposable;
108
+
109
+ /**
110
+ * Add a listener for when the syntax highlighting is updated for a given
111
+ * range of the buffer.
112
+ */
113
+ onDidChangeHighlighting(callback: (range: Range) => void): Disposable;
114
+
115
+ /**
116
+ * Behaves like {@link scopeDescriptorForPosition}, but returns a descriptor
117
+ * where the "scopes" are Tree-sitter node names.
118
+ *
119
+ * Useful for understanding Tree-sitter parsing or for writing syntax
120
+ * highlighting query files.
121
+ */
122
+ syntaxTreeScopeDescriptorForPosition(point: PointCompatible): ScopeDescriptor;
123
+
124
+ /**
125
+ * Returns the buffer range for the first scope to match the given scope
126
+ * selector, starting with the smallest scope and moving outward.
127
+ */
128
+ bufferRangeForScopeAtPosition(scopeSelector: string, point: PointCompatible): Range | undefined;
129
+
130
+ /**
131
+ * Returns the {@link ScopeDescriptor} for a given point in the buffer.
132
+ */
133
+ scopeDescriptorForPosition(point: PointCompatible): ScopeDescriptor;
134
+
135
+ // Syntax Tree APIs
136
+ /**
137
+ * Returns the smallest syntax node that contains the entire given range,
138
+ * optionally filtering by a predicate function.
139
+ */
140
+ getSyntaxNodeContainingRange(
141
+ range: Range,
142
+ where?: (node: Node, grammar: WASMTreeSitterGrammar) => boolean
143
+ ): Node | undefined;
144
+
145
+ /**
146
+ * Behaves like {@link getSyntaxNodeContainingRange}, but returns an object
147
+ * with `node` and `grammar` properties.
148
+ */
149
+ getSyntaxNodeAndGrammarContainingRange(
150
+ range: Range,
151
+ where?: (node: Node, grammar: WASMTreeSitterGrammar) => boolean
152
+ ): { node: Node, grammar: WASMTreeSitterGrammar } | { node: null, grammar: null };
153
+
154
+ /**
155
+ * Behaves like {@link getSyntaxNodeContainingRange}, but returns only the
156
+ * range of the returned node.
157
+ */
158
+ getRangeForSyntaxNodeContainingRange(
159
+ range: Range,
160
+ where?: (node: Node, grammar: WASMTreeSitterGrammar) => boolean
161
+ ): Range | undefined;
162
+
163
+ /**
164
+ * Returns the smallest syntax node at the given position, or the smallest
165
+ * node that matches the optional `where` predicate.
166
+ */
167
+ getSyntaxNodeAtPosition(
168
+ position: PointCompatible,
169
+ where?: (node: Node, grammar: WASMTreeSitterGrammar) => boolean
170
+ ): Node | undefined;
171
+
172
+ // Folds
173
+ /**
174
+ * Given a point, returns the range of the deepest fold that includes that
175
+ * point, or `null` if there are no such folds.
176
+ */
177
+ getFoldableRangeContainingPoint(point: PointCompatible): Range | null;
178
+
179
+ /**
180
+ * Return all foldable ranges in the buffer.
181
+ */
182
+ getFoldableRanges(): Range[];
183
+
184
+ /**
185
+ * Given a fold "depth," return all the ranges at that depth.
186
+ *
187
+ * This method is inaccurately named and is based on a legacy assumption that
188
+ * every nesting of folds carries an extra level of indentation.
189
+ *
190
+ * Instead, a level of `0` means "all folds that are not contained by any
191
+ * other" fold, a level of `1` means "all folds that are contained by
192
+ * exactly one other fold," and so on.
193
+ */
194
+ getFoldableRangesAtIndentLevel(desiredLevel: number): Range[];
195
+
196
+ /**
197
+ * Tests whether the buffer is foldable at the given row.
198
+ */
199
+ isFoldableAtRow(row: number): boolean;
200
+
201
+ /**
202
+ * Gets the foldable range at the given row, or `null` if the buffer is not
203
+ * foldable at that row.
204
+ */
205
+ getFoldRangeForRow(row: number): Range | null;
206
+
207
+ // Comments
208
+ /**
209
+ * Retrieves the relevant comment delimiters for the given grammar and buffer
210
+ * position.
211
+ */
212
+ commentStringsForPosition(position: PointCompatible): {
213
+ commentStartString: string,
214
+ commentEndString?: string,
215
+ commentDelimiters: CommentDelimiterSpec
216
+ };
217
+
218
+ /** Returns whether the entire given buffer row is commented out. */
219
+ isRowCommented(row: number): boolean;
220
+
221
+ // Auto-indent
222
+
223
+ /**
224
+ * Get the suggested indentation level for an existing line in the buffer.
225
+ *
226
+ * Returns a number, `null`, or a promise that will resolve with either a
227
+ * number or `undefined`.
228
+ *
229
+ * A returned number (or a promise that resolves to a number) represents a
230
+ * suggested indentation level.
231
+ *
232
+ * A return value of `null` means that the buffer cannot currently be
233
+ * analyzed (for instance, because it's not done with its initial parse).
234
+ *
235
+ * A return value of a promise that resolves to `undefined` means that we
236
+ * had to wait until the end of the transaction (for performance reasons) to
237
+ * make a suggestion, but the buffer changed too much in the interim for our
238
+ * suggestion to be valuable. This signals to Pulsar that the entire range of
239
+ * the transaction should be auto-indented instead.
240
+ */
241
+ suggestedIndentForBufferRow(
242
+ row: number,
243
+ tabLength: number,
244
+ options: SuggestedIndentForBufferRowOptions
245
+ ): number | null | Promise<number | undefined>;
246
+
247
+ /**
248
+ * Like {@link suggestedIndentForBufferRow}, but operates on a range of rows
249
+ * at once.
250
+ */
251
+ suggestedIndentForBufferRows(
252
+ startRow: number,
253
+ endRow: number,
254
+ tabLength: number,
255
+ options: SuggestedIndentForBufferRowOptions & {
256
+ /**
257
+ * Whether we're asking to auto-indent text that we just pasted. This
258
+ * triggers a slightly different mode in which only the first line
259
+ * produces a suggestion, and all subsequent lines merely preserve
260
+ * relative indentation levels within the pasted region.
261
+ */
262
+ isPastedText?: boolean
263
+ }
264
+ ): Map<number, number | null>;
265
+
266
+ /**
267
+ * Get the suggested indentation level for a line in the buffer on which the
268
+ * user is currently typing.
269
+ *
270
+ * This may return a different result from
271
+ * {@link suggestedIndentForBufferRow} in order to avoid unexpected changes
272
+ * in indentation. It may also return `undefined` if no change should be
273
+ * made.
274
+ */
275
+ suggestedIndentForEditedBufferRow (
276
+ row: number,
277
+ tabLength: number,
278
+ options: SuggestedIndentForBufferRowOptions
279
+ ): number | null | Promise<number | undefined>;
280
+
281
+ /**
282
+ * Get the suggested indentation level for a given line of text if it were
283
+ * inserted at the given row in the buffer.
284
+ *
285
+ * This exists for API compatibility, but this is not knowable in Tree-sitter
286
+ * before the content can be parsed; hence it delegates to
287
+ * {@link suggestedIndentForBufferRow}.
288
+ */
289
+ suggestedIndentForLineAtBufferRow(
290
+ row: number,
291
+ lineText: string,
292
+ tabLength: number
293
+ ): number | null | Promise<number | undefined>;
294
+ }
@@ -0,0 +1,117 @@
1
+ import { Disposable, Pane, PaneItemObservedEvent, TextEditor, TextEditorObservedEvent } from "../index";
2
+
3
+ // https://github.com/atom/atom/blob/master/src/workspace-center.js
4
+ /** The central container for the editor window capable of holding items. */
5
+ export interface WorkspaceCenter {
6
+ // Event Subscription
7
+ /**
8
+ * Invoke the given callback with all current and future text editors in the
9
+ * workspace center.
10
+ */
11
+ observeTextEditors(callback: (editor: TextEditor) => void): Disposable;
12
+
13
+ /**
14
+ * Invoke the given callback with all current and future panes items in the
15
+ * workspace center.
16
+ */
17
+ observePaneItems(callback: (item: object) => void): Disposable;
18
+
19
+ /** Invoke the given callback when the active pane item changes. */
20
+ onDidChangeActivePaneItem(callback: (item: object) => void): Disposable;
21
+
22
+ /** Invoke the given callback when the active pane item stops changing. */
23
+ onDidStopChangingActivePaneItem(callback: (item: object) => void): Disposable;
24
+
25
+ /**
26
+ * Invoke the given callback with the current active pane item and with all
27
+ * future active pane items in the workspace center.
28
+ */
29
+ observeActivePaneItem(callback: (item: object) => void): Disposable;
30
+
31
+ /** Invoke the given callback when a pane is added to the workspace center. */
32
+ onDidAddPane(callback: (event: { pane: Pane }) => void): Disposable;
33
+
34
+ /** Invoke the given callback before a pane is destroyed in the workspace center. */
35
+ onWillDestroyPane(callback: (event: { pane: Pane }) => void): Disposable;
36
+
37
+ /** Invoke the given callback when a pane is destroyed in the workspace center. */
38
+ onDidDestroyPane(callback: (event: { pane: Pane }) => void): Disposable;
39
+
40
+ /** Invoke the given callback with all current and future panes in the workspace center. */
41
+ observePanes(callback: (pane: Pane) => void): Disposable;
42
+
43
+ /** Invoke the given callback when the active pane changes. */
44
+ onDidChangeActivePane(callback: (pane: Pane) => void): Disposable;
45
+
46
+ /**
47
+ * Invoke the given callback with the current active pane and when the active
48
+ * pane changes.
49
+ */
50
+ observeActivePane(callback: (pane: Pane) => void): Disposable;
51
+
52
+ /**
53
+ * Invoke the given callback when a pane item is added to the workspace
54
+ * center.
55
+ */
56
+ onDidAddPaneItem(callback: (event: PaneItemObservedEvent) => void): Disposable;
57
+
58
+ /**
59
+ * Invoke the given callback when a pane item is about to be destroyed,
60
+ * before the user is prompted to save it.
61
+ *
62
+ * @param callback The function to be called before pane items are destroyed.
63
+ * If this function returns a Promise, then the item will not be destroyed
64
+ * until the promise resolves.
65
+ */
66
+ onWillDestroyPaneItem(callback: (event: PaneItemObservedEvent) => void | Promise<void>): Disposable;
67
+
68
+ /** Invoke the given callback when a pane item is destroyed. */
69
+ onDidDestroyPaneItem(callback: (event: PaneItemObservedEvent) => void): Disposable;
70
+
71
+ /**
72
+ * Invoke the given callback when a text editor is added to the workspace
73
+ * center.
74
+ */
75
+ onDidAddTextEditor(callback: (event: TextEditorObservedEvent) => void): Disposable;
76
+
77
+ // Pane Items
78
+ /** Get all pane items in the workspace center. */
79
+ getPaneItems(): object[];
80
+
81
+ /** Get the active Pane's active item. */
82
+ getActivePaneItem(): object | undefined;
83
+
84
+ /** Get all text editors in the workspace center. */
85
+ getTextEditors(): TextEditor[];
86
+
87
+ /** Get the active item if it is an TextEditor. */
88
+ getActiveTextEditor(): TextEditor | undefined;
89
+
90
+ /** Save all pane items. */
91
+ saveAll(): void;
92
+
93
+ // Panes
94
+ /** Get all panes in the workspace center. */
95
+ getPanes(): Pane[];
96
+
97
+ /** Get the active Pane. */
98
+ getActivePane(): Pane;
99
+
100
+ /** Make the next pane active. */
101
+ activateNextPane(): void;
102
+
103
+ /** Make the previous pane active. */
104
+ activatePreviousPane(): void;
105
+
106
+ /** Retrieve the Pane associated with the given URI. */
107
+ paneForURI(uri: string): Pane | undefined;
108
+
109
+ /** Retrieve the Pane associated with the given item. */
110
+ paneForItem(item: object): Pane | undefined;
111
+
112
+ /** Destroy (close) the active pane. */
113
+ destroyActivePane(): void;
114
+
115
+ /** Activate the active pane. */
116
+ activate(): void;
117
+ }