@opensumi/sumi 2.12.1-next-079c1930

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 (37) hide show
  1. package/README.md +1 -0
  2. package/build.ts +18 -0
  3. package/index.d.ts +5 -0
  4. package/manifest.json +414 -0
  5. package/package.json +18 -0
  6. package/sumi-browser.d.ts +273 -0
  7. package/sumi-worker/sumi-worker.d.ts +2788 -0
  8. package/sumi-worker/worker.command.d.ts +86 -0
  9. package/sumi-worker/worker.comments.d.ts +273 -0
  10. package/sumi-worker/worker.doc.d.ts +356 -0
  11. package/sumi-worker/worker.editor.d.ts +725 -0
  12. package/sumi-worker/worker.extensions.d.ts +63 -0
  13. package/sumi-worker/worker.language.d.ts +2220 -0
  14. package/sumi-worker/worker.window.d.ts +318 -0
  15. package/sumi-worker.d.ts +7 -0
  16. package/sumi.d.ts +822 -0
  17. package/vscode/typings/vscode.authentication.d.ts +231 -0
  18. package/vscode/typings/vscode.command.d.ts +86 -0
  19. package/vscode/typings/vscode.comments.d.ts +292 -0
  20. package/vscode/typings/vscode.d.ts +3789 -0
  21. package/vscode/typings/vscode.debug.d.ts +684 -0
  22. package/vscode/typings/vscode.doc.d.ts +272 -0
  23. package/vscode/typings/vscode.editor.d.ts +1017 -0
  24. package/vscode/typings/vscode.env.d.ts +153 -0
  25. package/vscode/typings/vscode.extension.d.ts +67 -0
  26. package/vscode/typings/vscode.language.d.ts +2630 -0
  27. package/vscode/typings/vscode.message.d.ts +195 -0
  28. package/vscode/typings/vscode.proposed.d.ts +662 -0
  29. package/vscode/typings/vscode.quickpick.d.ts +491 -0
  30. package/vscode/typings/vscode.scm.d.ts +254 -0
  31. package/vscode/typings/vscode.tasks.d.ts +676 -0
  32. package/vscode/typings/vscode.theme.d.ts +370 -0
  33. package/vscode/typings/vscode.window.d.ts +870 -0
  34. package/vscode/typings/vscode.workspace.d.ts +664 -0
  35. package/vscode/typings-pending/vscode.d.ts +27 -0
  36. package/vscode/typings-pending/vscode.proposed.d.ts +3 -0
  37. package/vscode.d.ts +23 -0
@@ -0,0 +1,356 @@
1
+ declare module 'sumi-worker' {
2
+ /**
3
+ * Represents a text document, such as a source file. Text documents have
4
+ * [lines](#TextLine) and knowledge about an underlying resource like a file.
5
+ */
6
+ export interface TextDocument {
7
+
8
+ /**
9
+ * The associated uri for this document.
10
+ *
11
+ * *Note* that most documents use the `file`-scheme, which means they are files on disk. However, **not** all documents are
12
+ * saved on disk and therefore the `scheme` must be checked before trying to access the underlying file or siblings on disk.
13
+ *
14
+ * @see [FileSystemProvider](#FileSystemProvider)
15
+ * @see [TextDocumentContentProvider](#TextDocumentContentProvider)
16
+ */
17
+ readonly uri: Uri;
18
+
19
+ /**
20
+ * The file system path of the associated resource. Shorthand
21
+ * notation for [TextDocument.uri.fsPath](#TextDocument.uri). Independent of the uri scheme.
22
+ */
23
+ readonly fileName: string;
24
+
25
+ /**
26
+ * Is this document representing an untitled file which has never been saved yet. *Note* that
27
+ * this does not mean the document will be saved to disk, use [`uri.scheme`](#Uri.scheme)
28
+ * to figure out where a document will be [saved](#FileSystemProvider), e.g. `file`, `ftp` etc.
29
+ */
30
+ readonly isUntitled: boolean;
31
+
32
+ /**
33
+ * The identifier of the language associated with this document.
34
+ */
35
+ readonly languageId: string;
36
+
37
+ /**
38
+ * The version number of this document (it will strictly increase after each
39
+ * change, including undo/redo).
40
+ */
41
+ readonly version: number;
42
+
43
+ /**
44
+ * `true` if there are unpersisted changes.
45
+ */
46
+ readonly isDirty: boolean;
47
+
48
+ /**
49
+ * `true` if the document have been closed. A closed document isn't synchronized anymore
50
+ * and won't be re-used when the same resource is opened again.
51
+ */
52
+ readonly isClosed: boolean;
53
+
54
+ /**
55
+ * Save the underlying file.
56
+ *
57
+ * @return A promise that will resolve to true when the file
58
+ * has been saved. If the file was not dirty or the save failed,
59
+ * will return false.
60
+ */
61
+ save(): Thenable<boolean>;
62
+
63
+ /**
64
+ * The [end of line](#EndOfLine) sequence that is predominately
65
+ * used in this document.
66
+ */
67
+ readonly eol: EndOfLine;
68
+
69
+ /**
70
+ * The number of lines in this document.
71
+ */
72
+ readonly lineCount: number;
73
+
74
+ /**
75
+ * Returns a text line denoted by the position. Note
76
+ * that the returned object is *not* live and changes to the
77
+ * document are not reflected.
78
+ *
79
+ * The position will be [adjusted](#TextDocument.validatePosition).
80
+ *
81
+ * @see [TextDocument.lineAt](#TextDocument.lineAt)
82
+ * @param position A position.
83
+ * @return A [line](#TextLine).
84
+ */
85
+ lineAt(position: Position | number): TextLine;
86
+
87
+ /**
88
+ * Converts the position to a zero-based offset.
89
+ *
90
+ * The position will be [adjusted](#TextDocument.validatePosition).
91
+ *
92
+ * @param position A position.
93
+ * @return A valid zero-based offset.
94
+ */
95
+ offsetAt(position: Position): number;
96
+
97
+ /**
98
+ * Converts a zero-based offset to a position.
99
+ *
100
+ * @param offset A zero-based offset.
101
+ * @return A valid [position](#Position).
102
+ */
103
+ positionAt(offset: number): Position;
104
+
105
+ /**
106
+ * Get the text of this document. A substring can be retrieved by providing
107
+ * a range. The range will be [adjusted](#TextDocument.validateRange).
108
+ *
109
+ * @param range Include only the text included by the range.
110
+ * @return The text inside the provided range or the entire text.
111
+ */
112
+ getText(range?: Range): string;
113
+
114
+ /**
115
+ * Get a word-range at the given position. By default words are defined by
116
+ * common separators, like space, -, _, etc. In addition, per language custom
117
+ * [word definitions](#LanguageConfiguration.wordPattern) can be defined. It
118
+ * is also possible to provide a custom regular expression.
119
+ *
120
+ * * *Note 1:* A custom regular expression must not match the empty string and
121
+ * if it does, it will be ignored.
122
+ * * *Note 2:* A custom regular expression will fail to match multiline strings
123
+ * and in the name of speed regular expressions should not match words with
124
+ * spaces. Use [`TextLine.text`](#TextLine.text) for more complex, non-wordy, scenarios.
125
+ *
126
+ * The position will be [adjusted](#TextDocument.validatePosition).
127
+ *
128
+ * @param position A position.
129
+ * @param regex Optional regular expression that describes what a word is.
130
+ * @return A range spanning a word, or `undefined`.
131
+ */
132
+ getWordRangeAtPosition(position: Position, regex?: RegExp): Range | undefined;
133
+
134
+ /**
135
+ * Ensure a range is completely contained in this document.
136
+ *
137
+ * @param range A range.
138
+ * @return The given range or a new, adjusted range.
139
+ */
140
+ validateRange(range: Range): Range;
141
+
142
+ /**
143
+ * Ensure a position is contained in the range of this document.
144
+ *
145
+ * @param position A position.
146
+ * @return The given position or a new, adjusted position.
147
+ */
148
+ validatePosition(position: Position): Position;
149
+ }
150
+
151
+ export namespace workspace {
152
+ /**
153
+ * Opens a document. Will return early if this document is already open. Otherwise
154
+ * the document is loaded and the [didOpen](#workspace.onDidOpenTextDocument)-event fires.
155
+ *
156
+ * The document is denoted by an [uri](#Uri). Depending on the [scheme](#Uri.scheme) the
157
+ * following rules apply:
158
+ * * `file`-scheme: Open a file on disk, will be rejected if the file does not exist or cannot be loaded.
159
+ * * `untitled`-scheme: A new file that should be saved on disk, e.g. `untitled:c:\frodo\new.js`. The language
160
+ * will be derived from the file name.
161
+ * * For all other schemes the registered text document content [providers](#TextDocumentContentProvider) are consulted.
162
+ *
163
+ * *Note* that the lifecycle of the returned document is owned by the editor and not by the extension. That means an
164
+ * [`onDidClose`](#workspace.onDidCloseTextDocument)-event can occur at any time after opening it.
165
+ *
166
+ * @param uri Identifies the resource to open.
167
+ * @return A promise that resolves to a [document](#TextDocument).
168
+ * @Owner 木农
169
+ *
170
+ * A short-hand for `openTextDocument(Uri.file(fileName))`.
171
+ *
172
+ * @see [openTextDocument](#openTextDocument)
173
+ * @param fileName A name of a file on disk.
174
+ * @return A promise that resolves to a [document](#TextDocument).
175
+ */
176
+ export function openTextDocument(fileName: string | Uri): Thenable<TextDocument>;
177
+
178
+ /**
179
+ * Opens an untitled text document. The editor will prompt the user for a file
180
+ * path when the document is to be saved. The `options` parameter allows to
181
+ * specify the *language* and/or the *content* of the document.
182
+ *
183
+ * @param options Options to control how the document will be created.
184
+ * @return A promise that resolves to a [document](#TextDocument).
185
+ */
186
+ export function openTextDocument(options?: { language?: string; content?: string; }): Thenable<TextDocument>;
187
+
188
+ /**
189
+ * An event that is emitted when a [text document](#TextDocument) is opened or when the language id
190
+ * of a text document [has been changed](#languages.setTextDocumentLanguage).
191
+ *
192
+ * To add an event listener when a visible text document is opened, use the [TextEditor](#TextEditor) events in the
193
+ * [window](#window) namespace. Note that:
194
+ *
195
+ * - The event is emitted before the [document](#TextDocument) is updated in the
196
+ * [active text editor](#window.activeTextEditor)
197
+ * - When a [text document](#TextDocument) is already open (e.g.: open in another [visible text editor](#window.visibleTextEditors)) this event is not emitted
198
+ *
199
+ */
200
+ export const onDidOpenTextDocument: Event<TextDocument>;
201
+
202
+ /**
203
+ * An event that is emitted when a [text document](#TextDocument) is disposed or when the language id
204
+ * of a text document [has been changed](#languages.setTextDocumentLanguage).
205
+ *
206
+ * To add an event listener when a visible text document is closed, use the [TextEditor](#TextEditor) events in the
207
+ * [window](#window) namespace. Note that this event is not emitted when a [TextEditor](#TextEditor) is closed
208
+ * but the document remains open in another [visible text editor](#window.visibleTextEditors).
209
+ */
210
+ export const onDidCloseTextDocument: Event<TextDocument>;
211
+
212
+ /**
213
+ * An event that is emitted when a [text document](#TextDocument) is changed. This usually happens
214
+ * when the [contents](#TextDocument.getText) changes but also when other things like the
215
+ * [dirty](#TextDocument.isDirty)-state changes.
216
+ */
217
+ export const onDidChangeTextDocument: Event<TextDocumentChangeEvent>;
218
+
219
+ /**
220
+ * An event that is emitted when a [text document](#TextDocument) will be saved to disk.
221
+ *
222
+ * *Note 1:* Subscribers can delay saving by registering asynchronous work. For the sake of data integrity the editor
223
+ * might save without firing this event. For instance when shutting down with dirty files.
224
+ *
225
+ * *Note 2:* Subscribers are called sequentially and they can [delay](#TextDocumentWillSaveEvent.waitUntil) saving
226
+ * by registering asynchronous work. Protection against misbehaving listeners is implemented as such:
227
+ * * there is an overall time budget that all listeners share and if that is exhausted no further listener is called
228
+ * * listeners that take a long time or produce errors frequently will not be called anymore
229
+ *
230
+ * The current thresholds are 1.5 seconds as overall time budget and a listener can misbehave 3 times before being ignored.
231
+ */
232
+ export const onWillSaveTextDocument: Event<TextDocumentWillSaveEvent>;
233
+
234
+ /**
235
+ * An event that is emitted when a [text document](#TextDocument) is saved to disk.
236
+ */
237
+ export const onDidSaveTextDocument: Event<TextDocument>;
238
+
239
+ /**
240
+ * All text documents currently known to the system.
241
+ * @Owner 木农
242
+ */
243
+ export const textDocuments: TextDocument[];
244
+
245
+ /**
246
+ * Register a text document content provider.
247
+ *
248
+ * Only one provider can be registered per scheme.
249
+ *
250
+ * @param scheme The uri-scheme to register for.
251
+ * @param provider A content provider.
252
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
253
+ */
254
+ export function registerTextDocumentContentProvider(scheme: string, provider: TextDocumentContentProvider): Disposable;
255
+
256
+ }
257
+
258
+ /**
259
+ * A text document content provider allows to add readonly documents
260
+ * to the editor, such as source from a dll or generated html from md.
261
+ *
262
+ * Content providers are [registered](#workspace.registerTextDocumentContentProvider)
263
+ * for a [uri-scheme](#Uri.scheme). When a uri with that scheme is to
264
+ * be [loaded](#workspace.openTextDocument) the content provider is
265
+ * asked.
266
+ */
267
+ export interface TextDocumentContentProvider {
268
+
269
+ /**
270
+ * An event to signal a resource has changed.
271
+ */
272
+ onDidChange?: Event<Uri>;
273
+
274
+ /**
275
+ * Provide textual content for a given uri.
276
+ *
277
+ * The editor will use the returned string-content to create a readonly
278
+ * [document](#TextDocument). Resources allocated should be released when
279
+ * the corresponding document has been [closed](#workspace.onDidCloseTextDocument).
280
+ *
281
+ * **Note**: The contents of the created [document](#TextDocument) might not be
282
+ * identical to the provided text due to end-of-line-sequence normalization.
283
+ *
284
+ * @param uri An uri which scheme matches the scheme this provider was [registered](#workspace.registerTextDocumentContentProvider) for.
285
+ * @param token A cancellation token.
286
+ * @return A string or a thenable that resolves to such.
287
+ */
288
+ provideTextDocumentContent(uri: Uri, token: CancellationToken): ProviderResult<string>;
289
+ }
290
+
291
+ /**
292
+ * An event describing an individual change in the text of a [document](#TextDocument).
293
+ */
294
+ export interface TextDocumentContentChangeEvent {
295
+ /**
296
+ * The range that got replaced.
297
+ */
298
+ range: Range;
299
+ /**
300
+ * The offset of the range that got replaced.
301
+ */
302
+ rangeOffset: number;
303
+ /**
304
+ * The length of the range that got replaced.
305
+ */
306
+ rangeLength: number;
307
+ /**
308
+ * The new text for the range.
309
+ */
310
+ text: string;
311
+ }
312
+
313
+ /**
314
+ * An event that is fired when a [document](#TextDocument) will be saved.
315
+ *
316
+ * To make modifications to the document before it is being saved, call the
317
+ * [`waitUntil`](#TextDocumentWillSaveEvent.waitUntil)-function with a thenable
318
+ * that resolves to an array of [text edits](#TextEdit).
319
+ */
320
+ export interface TextDocumentWillSaveEvent {
321
+
322
+ /**
323
+ * The document that will be saved.
324
+ */
325
+ readonly document: TextDocument;
326
+
327
+ /**
328
+ * The reason why save was triggered.
329
+ */
330
+ readonly reason: TextDocumentSaveReason;
331
+
332
+ /**
333
+ * Allows to pause the event loop and to apply [pre-save-edits](#TextEdit).
334
+ * Edits of subsequent calls to this function will be applied in order. The
335
+ * edits will be *ignored* if concurrent modifications of the document happened.
336
+ *
337
+ * *Note:* This function can only be called during event dispatch and not
338
+ * in an asynchronous manner:
339
+ *
340
+ * ```ts
341
+ * workspace.onWillSaveTextDocument(event => {
342
+ * // async, will *throw* an error
343
+ * setTimeout(() => event.waitUntil(promise));
344
+ *
345
+ * // sync, OK
346
+ * event.waitUntil(promise);
347
+ * })
348
+ * ```
349
+ *
350
+ * @param thenable A thenable that resolves to [pre-save-edits](#TextEdit).
351
+ */
352
+ waitUntil(thenable: Thenable<TextEdit[]> | Thenable<any>): void;
353
+
354
+ }
355
+
356
+ }