@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.
- package/README.md +1 -0
- package/build.ts +18 -0
- package/index.d.ts +5 -0
- package/manifest.json +414 -0
- package/package.json +18 -0
- package/sumi-browser.d.ts +273 -0
- package/sumi-worker/sumi-worker.d.ts +2788 -0
- package/sumi-worker/worker.command.d.ts +86 -0
- package/sumi-worker/worker.comments.d.ts +273 -0
- package/sumi-worker/worker.doc.d.ts +356 -0
- package/sumi-worker/worker.editor.d.ts +725 -0
- package/sumi-worker/worker.extensions.d.ts +63 -0
- package/sumi-worker/worker.language.d.ts +2220 -0
- package/sumi-worker/worker.window.d.ts +318 -0
- package/sumi-worker.d.ts +7 -0
- package/sumi.d.ts +822 -0
- package/vscode/typings/vscode.authentication.d.ts +231 -0
- package/vscode/typings/vscode.command.d.ts +86 -0
- package/vscode/typings/vscode.comments.d.ts +292 -0
- package/vscode/typings/vscode.d.ts +3789 -0
- package/vscode/typings/vscode.debug.d.ts +684 -0
- package/vscode/typings/vscode.doc.d.ts +272 -0
- package/vscode/typings/vscode.editor.d.ts +1017 -0
- package/vscode/typings/vscode.env.d.ts +153 -0
- package/vscode/typings/vscode.extension.d.ts +67 -0
- package/vscode/typings/vscode.language.d.ts +2630 -0
- package/vscode/typings/vscode.message.d.ts +195 -0
- package/vscode/typings/vscode.proposed.d.ts +662 -0
- package/vscode/typings/vscode.quickpick.d.ts +491 -0
- package/vscode/typings/vscode.scm.d.ts +254 -0
- package/vscode/typings/vscode.tasks.d.ts +676 -0
- package/vscode/typings/vscode.theme.d.ts +370 -0
- package/vscode/typings/vscode.window.d.ts +870 -0
- package/vscode/typings/vscode.workspace.d.ts +664 -0
- package/vscode/typings-pending/vscode.d.ts +27 -0
- package/vscode/typings-pending/vscode.proposed.d.ts +3 -0
- package/vscode.d.ts +23 -0
|
@@ -0,0 +1,725 @@
|
|
|
1
|
+
declare module 'sumi-worker' {
|
|
2
|
+
/**
|
|
3
|
+
* Represents sources that can cause [selection change events](#window.onDidChangeTextEditorSelection).
|
|
4
|
+
*/
|
|
5
|
+
export enum TextEditorSelectionChangeKind {
|
|
6
|
+
/**
|
|
7
|
+
* Selection changed due to typing in the editor.
|
|
8
|
+
*/
|
|
9
|
+
Keyboard = 1,
|
|
10
|
+
/**
|
|
11
|
+
* Selection change due to clicking in the editor.
|
|
12
|
+
*/
|
|
13
|
+
Mouse = 2,
|
|
14
|
+
/**
|
|
15
|
+
* Selection changed because a command ran.
|
|
16
|
+
*/
|
|
17
|
+
Command = 3,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents an event describing the change in a [text editor's selections](#TextEditor.selections).
|
|
22
|
+
*/
|
|
23
|
+
export interface TextEditorSelectionChangeEvent {
|
|
24
|
+
/**
|
|
25
|
+
* The [text editor](#TextEditor) for which the selections have changed.
|
|
26
|
+
*/
|
|
27
|
+
readonly textEditor: TextEditor;
|
|
28
|
+
/**
|
|
29
|
+
* The new value for the [text editor's selections](#TextEditor.selections).
|
|
30
|
+
*/
|
|
31
|
+
readonly selections: ReadonlyArray<Selection>;
|
|
32
|
+
/**
|
|
33
|
+
* The [change kind](#TextEditorSelectionChangeKind) which has triggered this
|
|
34
|
+
* event. Can be `undefined`.
|
|
35
|
+
*/
|
|
36
|
+
readonly kind?: TextEditorSelectionChangeKind;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Represents an event describing the change in a [text editor's visible ranges](#TextEditor.visibleRanges).
|
|
41
|
+
*/
|
|
42
|
+
export interface TextEditorVisibleRangesChangeEvent {
|
|
43
|
+
/**
|
|
44
|
+
* The [text editor](#TextEditor) for which the visible ranges have changed.
|
|
45
|
+
*/
|
|
46
|
+
readonly textEditor: TextEditor;
|
|
47
|
+
/**
|
|
48
|
+
* The new value for the [text editor's visible ranges](#TextEditor.visibleRanges).
|
|
49
|
+
*/
|
|
50
|
+
readonly visibleRanges: ReadonlyArray<Range>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Represents an event describing the change in a [text editor's options](#TextEditor.options).
|
|
55
|
+
*/
|
|
56
|
+
export interface TextEditorOptionsChangeEvent {
|
|
57
|
+
/**
|
|
58
|
+
* The [text editor](#TextEditor) for which the options have changed.
|
|
59
|
+
*/
|
|
60
|
+
readonly textEditor: TextEditor;
|
|
61
|
+
/**
|
|
62
|
+
* The new value for the [text editor's options](#TextEditor.options).
|
|
63
|
+
*/
|
|
64
|
+
readonly options: TextEditorOptions;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Represents an event describing the change of a [text editor's view column](#TextEditor.viewColumn).
|
|
69
|
+
*/
|
|
70
|
+
export interface TextEditorViewColumnChangeEvent {
|
|
71
|
+
/**
|
|
72
|
+
* The [text editor](#TextEditor) for which the view column has changed.
|
|
73
|
+
*/
|
|
74
|
+
readonly textEditor: TextEditor;
|
|
75
|
+
/**
|
|
76
|
+
* The new value for the [text editor's view column](#TextEditor.viewColumn).
|
|
77
|
+
*/
|
|
78
|
+
readonly viewColumn: ViewColumn;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Rendering style of the cursor.
|
|
83
|
+
*/
|
|
84
|
+
export enum TextEditorCursorStyle {
|
|
85
|
+
/**
|
|
86
|
+
* Render the cursor as a vertical thick line.
|
|
87
|
+
*/
|
|
88
|
+
Line = 1,
|
|
89
|
+
/**
|
|
90
|
+
* Render the cursor as a block filled.
|
|
91
|
+
*/
|
|
92
|
+
Block = 2,
|
|
93
|
+
/**
|
|
94
|
+
* Render the cursor as a thick horizontal line.
|
|
95
|
+
*/
|
|
96
|
+
Underline = 3,
|
|
97
|
+
/**
|
|
98
|
+
* Render the cursor as a vertical thin line.
|
|
99
|
+
*/
|
|
100
|
+
LineThin = 4,
|
|
101
|
+
/**
|
|
102
|
+
* Render the cursor as a block outlined.
|
|
103
|
+
*/
|
|
104
|
+
BlockOutline = 5,
|
|
105
|
+
/**
|
|
106
|
+
* Render the cursor as a thin horizontal line.
|
|
107
|
+
*/
|
|
108
|
+
UnderlineThin = 6,
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Rendering style of the line numbers.
|
|
113
|
+
*/
|
|
114
|
+
export enum TextEditorLineNumbersStyle {
|
|
115
|
+
/**
|
|
116
|
+
* Do not render the line numbers.
|
|
117
|
+
*/
|
|
118
|
+
Off = 0,
|
|
119
|
+
/**
|
|
120
|
+
* Render the line numbers.
|
|
121
|
+
*/
|
|
122
|
+
On = 1,
|
|
123
|
+
/**
|
|
124
|
+
* Render the line numbers with values relative to the primary cursor location.
|
|
125
|
+
*/
|
|
126
|
+
Relative = 2,
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Represents a [text editor](#TextEditor)'s [options](#TextEditor.options).
|
|
131
|
+
*/
|
|
132
|
+
export interface TextEditorOptions {
|
|
133
|
+
/**
|
|
134
|
+
* The size in spaces a tab takes. This is used for two purposes:
|
|
135
|
+
* - the rendering width of a tab character;
|
|
136
|
+
* - the number of spaces to insert when [insertSpaces](#TextEditorOptions.insertSpaces) is true.
|
|
137
|
+
*
|
|
138
|
+
* When getting a text editor's options, this property will always be a number (resolved).
|
|
139
|
+
* When setting a text editor's options, this property is optional and it can be a number or `"auto"`.
|
|
140
|
+
*/
|
|
141
|
+
tabSize?: number | string;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* When pressing Tab insert [n](#TextEditorOptions.tabSize) spaces.
|
|
145
|
+
* When getting a text editor's options, this property will always be a boolean (resolved).
|
|
146
|
+
* When setting a text editor's options, this property is optional and it can be a boolean or `"auto"`.
|
|
147
|
+
*/
|
|
148
|
+
insertSpaces?: boolean | string;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The rendering style of the cursor in this editor.
|
|
152
|
+
* When getting a text editor's options, this property will always be present.
|
|
153
|
+
* When setting a text editor's options, this property is optional.
|
|
154
|
+
*/
|
|
155
|
+
cursorStyle?: TextEditorCursorStyle;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Render relative line numbers w.r.t. the current line number.
|
|
159
|
+
* When getting a text editor's options, this property will always be present.
|
|
160
|
+
* When setting a text editor's options, this property is optional.
|
|
161
|
+
*/
|
|
162
|
+
lineNumbers?: TextEditorLineNumbersStyle;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Represents a handle to a set of decorations
|
|
167
|
+
* sharing the same [styling options](#DecorationRenderOptions) in a [text editor](#TextEditor).
|
|
168
|
+
*
|
|
169
|
+
* To get an instance of a `TextEditorDecorationType` use
|
|
170
|
+
* [createTextEditorDecorationType](#window.createTextEditorDecorationType).
|
|
171
|
+
*/
|
|
172
|
+
export interface TextEditorDecorationType {
|
|
173
|
+
/**
|
|
174
|
+
* Internal representation of the handle.
|
|
175
|
+
*/
|
|
176
|
+
readonly key: string;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Remove this decoration type and all decorations on all text editors using it.
|
|
180
|
+
*/
|
|
181
|
+
dispose(): void;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Represents different [reveal](#TextEditor.revealRange) strategies in a text editor.
|
|
186
|
+
*/
|
|
187
|
+
export enum TextEditorRevealType {
|
|
188
|
+
/**
|
|
189
|
+
* The range will be revealed with as little scrolling as possible.
|
|
190
|
+
*/
|
|
191
|
+
Default = 0,
|
|
192
|
+
/**
|
|
193
|
+
* The range will always be revealed in the center of the viewport.
|
|
194
|
+
*/
|
|
195
|
+
InCenter = 1,
|
|
196
|
+
/**
|
|
197
|
+
* If the range is outside the viewport, it will be revealed in the center of the viewport.
|
|
198
|
+
* Otherwise, it will be revealed with as little scrolling as possible.
|
|
199
|
+
*/
|
|
200
|
+
InCenterIfOutsideViewport = 2,
|
|
201
|
+
/**
|
|
202
|
+
* The range will always be revealed at the top of the viewport.
|
|
203
|
+
*/
|
|
204
|
+
AtTop = 3,
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Represents different positions for rendering a decoration in an [overview ruler](#DecorationRenderOptions.overviewRulerLane).
|
|
209
|
+
* The overview ruler supports three lanes.
|
|
210
|
+
*/
|
|
211
|
+
export enum OverviewRulerLane {
|
|
212
|
+
Left = 1,
|
|
213
|
+
Center = 2,
|
|
214
|
+
Right = 4,
|
|
215
|
+
Full = 7,
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Describes the behavior of decorations when typing/editing at their edges.
|
|
220
|
+
*/
|
|
221
|
+
export enum DecorationRangeBehavior {
|
|
222
|
+
/**
|
|
223
|
+
* The decoration's range will widen when edits occur at the start or end.
|
|
224
|
+
*/
|
|
225
|
+
OpenOpen = 0,
|
|
226
|
+
/**
|
|
227
|
+
* The decoration's range will not widen when edits occur at the start of end.
|
|
228
|
+
*/
|
|
229
|
+
ClosedClosed = 1,
|
|
230
|
+
/**
|
|
231
|
+
* The decoration's range will widen when edits occur at the start, but not at the end.
|
|
232
|
+
*/
|
|
233
|
+
OpenClosed = 2,
|
|
234
|
+
/**
|
|
235
|
+
* The decoration's range will widen when edits occur at the end, but not at the start.
|
|
236
|
+
*/
|
|
237
|
+
ClosedOpen = 3,
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Represents options to configure the behavior of showing a [document](#TextDocument) in an [editor](#TextEditor).
|
|
242
|
+
*/
|
|
243
|
+
export interface TextDocumentShowOptions {
|
|
244
|
+
/**
|
|
245
|
+
* An optional view column in which the [editor](#TextEditor) should be shown.
|
|
246
|
+
* The default is the [active](#ViewColumn.Active), other values are adjusted to
|
|
247
|
+
* be `Min(column, columnCount + 1)`, the [active](#ViewColumn.Active)-column is
|
|
248
|
+
* not adjusted. Use [`ViewColumn.Beside`](#ViewColumn.Beside) to open the
|
|
249
|
+
* editor to the side of the currently active one.
|
|
250
|
+
*/
|
|
251
|
+
viewColumn?: ViewColumn;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* An optional flag that when `true` will stop the [editor](#TextEditor) from taking focus.
|
|
255
|
+
*/
|
|
256
|
+
preserveFocus?: boolean;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* An optional flag that controls if an [editor](#TextEditor)-tab will be replaced
|
|
260
|
+
* with the next editor or if it will be kept.
|
|
261
|
+
*/
|
|
262
|
+
preview?: boolean;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* An optional selection to apply for the document in the [editor](#TextEditor).
|
|
266
|
+
*/
|
|
267
|
+
selection?: Range;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Represents rendering styles for a [text editor decoration](#TextEditorDecorationType).
|
|
272
|
+
*/
|
|
273
|
+
export interface DecorationRenderOptions
|
|
274
|
+
extends ThemableDecorationRenderOptions {
|
|
275
|
+
/**
|
|
276
|
+
* Should the decoration be rendered also on the whitespace after the line text.
|
|
277
|
+
* Defaults to `false`.
|
|
278
|
+
*/
|
|
279
|
+
isWholeLine?: boolean;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Customize the growing behavior of the decoration when edits occur at the edges of the decoration's range.
|
|
283
|
+
* Defaults to `DecorationRangeBehavior.OpenOpen`.
|
|
284
|
+
*/
|
|
285
|
+
rangeBehavior?: DecorationRangeBehavior;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* The position in the overview ruler where the decoration should be rendered.
|
|
289
|
+
*/
|
|
290
|
+
overviewRulerLane?: OverviewRulerLane;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Overwrite options for light themes.
|
|
294
|
+
*/
|
|
295
|
+
light?: ThemableDecorationRenderOptions;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Overwrite options for dark themes.
|
|
299
|
+
*/
|
|
300
|
+
dark?: ThemableDecorationRenderOptions;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Represents options for a specific decoration in a [decoration set](#TextEditorDecorationType).
|
|
305
|
+
*/
|
|
306
|
+
export interface DecorationOptions {
|
|
307
|
+
/**
|
|
308
|
+
* Range to which this decoration is applied. The range must not be empty.
|
|
309
|
+
*/
|
|
310
|
+
range: Range;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* A message that should be rendered when hovering over the decoration.
|
|
314
|
+
*/
|
|
315
|
+
hoverMessage?: MarkedString | MarkedString[];
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Render options applied to the current decoration. For performance reasons, keep the
|
|
319
|
+
* number of decoration specific options small, and use decoration types wherever possible.
|
|
320
|
+
*/
|
|
321
|
+
renderOptions?: DecorationInstanceRenderOptions;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export interface ThemableDecorationInstanceRenderOptions {
|
|
325
|
+
/**
|
|
326
|
+
* Defines the rendering options of the attachment that is inserted before the decorated text.
|
|
327
|
+
*/
|
|
328
|
+
before?: ThemableDecorationAttachmentRenderOptions;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Defines the rendering options of the attachment that is inserted after the decorated text.
|
|
332
|
+
*/
|
|
333
|
+
after?: ThemableDecorationAttachmentRenderOptions;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export interface DecorationInstanceRenderOptions
|
|
337
|
+
extends ThemableDecorationInstanceRenderOptions {
|
|
338
|
+
/**
|
|
339
|
+
* Overwrite options for light themes.
|
|
340
|
+
*/
|
|
341
|
+
light?: ThemableDecorationInstanceRenderOptions;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Overwrite options for dark themes.
|
|
345
|
+
*/
|
|
346
|
+
dark?: ThemableDecorationInstanceRenderOptions;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Represents an editor that is attached to a [document](#TextDocument).
|
|
351
|
+
*/
|
|
352
|
+
export interface TextEditor {
|
|
353
|
+
/**
|
|
354
|
+
* The document associated with this text editor. The document will be the same for the entire lifetime of this text editor.
|
|
355
|
+
*/
|
|
356
|
+
readonly document: TextDocument;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* The primary selection on this text editor. Shorthand for `TextEditor.selections[0]`.
|
|
360
|
+
*/
|
|
361
|
+
selection: Selection;
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* The selections in this text editor. The primary selection is always at index 0.
|
|
365
|
+
*/
|
|
366
|
+
selections: Selection[];
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* The current visible ranges in the editor (vertically).
|
|
370
|
+
* This accounts only for vertical scrolling, and not for horizontal scrolling.
|
|
371
|
+
*/
|
|
372
|
+
readonly visibleRanges: Range[];
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Text editor options.
|
|
376
|
+
*/
|
|
377
|
+
options: TextEditorOptions;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* The column in which this editor shows. Will be `undefined` in case this
|
|
381
|
+
* isn't one of the main editors, e.g. an embedded editor, or when the editor
|
|
382
|
+
* column is larger than three.
|
|
383
|
+
*/
|
|
384
|
+
viewColumn?: ViewColumn;
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Perform an edit on the document associated with this text editor.
|
|
388
|
+
*
|
|
389
|
+
* The given callback-function is invoked with an [edit-builder](#TextEditorEdit) which must
|
|
390
|
+
* be used to make edits. Note that the edit-builder is only valid while the
|
|
391
|
+
* callback executes.
|
|
392
|
+
*
|
|
393
|
+
* @param callback A function which can create edits using an [edit-builder](#TextEditorEdit).
|
|
394
|
+
* @param options The undo/redo behavior around this edit. By default, undo stops will be created before and after this edit.
|
|
395
|
+
* @return A promise that resolves with a value indicating if the edits could be applied.
|
|
396
|
+
*/
|
|
397
|
+
edit(
|
|
398
|
+
callback: (editBuilder: TextEditorEdit) => void,
|
|
399
|
+
options?: { undoStopBefore: boolean; undoStopAfter: boolean },
|
|
400
|
+
): Thenable<boolean>;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Insert a [snippet](#SnippetString) and put the editor into snippet mode. "Snippet mode"
|
|
404
|
+
* means the editor adds placeholders and additional cursors so that the user can complete
|
|
405
|
+
* or accept the snippet.
|
|
406
|
+
*
|
|
407
|
+
* @param snippet The snippet to insert in this edit.
|
|
408
|
+
* @param location Position or range at which to insert the snippet, defaults to the current editor selection or selections.
|
|
409
|
+
* @param options The undo/redo behavior around this edit. By default, undo stops will be created before and after this edit.
|
|
410
|
+
* @return A promise that resolves with a value indicating if the snippet could be inserted. Note that the promise does not signal
|
|
411
|
+
* that the snippet is completely filled-in or accepted.
|
|
412
|
+
*/
|
|
413
|
+
insertSnippet(
|
|
414
|
+
snippet: SnippetString,
|
|
415
|
+
location?:
|
|
416
|
+
| Position
|
|
417
|
+
| Range
|
|
418
|
+
| ReadonlyArray<Position>
|
|
419
|
+
| ReadonlyArray<Range>,
|
|
420
|
+
options?: { undoStopBefore: boolean; undoStopAfter: boolean },
|
|
421
|
+
): Thenable<boolean>;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Adds a set of decorations to the text editor. If a set of decorations already exists with
|
|
425
|
+
* the given [decoration type](#TextEditorDecorationType), they will be replaced.
|
|
426
|
+
*
|
|
427
|
+
* @see [createTextEditorDecorationType](#window.createTextEditorDecorationType).
|
|
428
|
+
*
|
|
429
|
+
* @param decorationType A decoration type.
|
|
430
|
+
* @param rangesOrOptions Either [ranges](#Range) or more detailed [options](#DecorationOptions).
|
|
431
|
+
*/
|
|
432
|
+
setDecorations(
|
|
433
|
+
decorationType: TextEditorDecorationType,
|
|
434
|
+
rangesOrOptions: Range[] | DecorationOptions[],
|
|
435
|
+
): void;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Scroll as indicated by `revealType` in order to reveal the given range.
|
|
439
|
+
*
|
|
440
|
+
* @param range A range.
|
|
441
|
+
* @param revealType The scrolling strategy for revealing `range`.
|
|
442
|
+
*/
|
|
443
|
+
revealRange(range: Range, revealType?: TextEditorRevealType): void;
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* ~~Show the text editor.~~
|
|
447
|
+
*
|
|
448
|
+
* @deprecated Use [window.showTextDocument](#window.showTextDocument) instead.
|
|
449
|
+
*
|
|
450
|
+
* @param column The [column](#ViewColumn) in which to show this editor.
|
|
451
|
+
* This method shows unexpected behavior and will be removed in the next major update.
|
|
452
|
+
*/
|
|
453
|
+
show(column?: ViewColumn): void;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* ~~Hide the text editor.~~
|
|
457
|
+
*
|
|
458
|
+
* @deprecated Use the command `workbench.action.closeActiveEditor` instead.
|
|
459
|
+
* This method shows unexpected behavior and will be removed in the next major update.
|
|
460
|
+
*/
|
|
461
|
+
hide(): void;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export interface TextEditorEdit {
|
|
465
|
+
/**
|
|
466
|
+
* Replace a certain text region with a new value.
|
|
467
|
+
* You can use \r\n or \n in `value` and they will be normalized to the current [document](#TextDocument).
|
|
468
|
+
*
|
|
469
|
+
* @param location The range this operation should remove.
|
|
470
|
+
* @param value The new text this operation should insert after removing `location`.
|
|
471
|
+
*/
|
|
472
|
+
replace(location: Position | Range | Selection, value: string): void;
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Insert text at a location.
|
|
476
|
+
* You can use \r\n or \n in `value` and they will be normalized to the current [document](#TextDocument).
|
|
477
|
+
* Although the equivalent text edit can be made with [replace](#TextEditorEdit.replace), `insert` will produce a different resulting selection (it will get moved).
|
|
478
|
+
*
|
|
479
|
+
* @param location The position where the new text should be inserted.
|
|
480
|
+
* @param value The new text this operation should insert.
|
|
481
|
+
*/
|
|
482
|
+
insert(location: Position, value: string): void;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Delete a certain text region.
|
|
486
|
+
*
|
|
487
|
+
* @param location The range this operation should remove.
|
|
488
|
+
*/
|
|
489
|
+
delete(location: Range | Selection): void;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Set the end of line sequence.
|
|
493
|
+
*
|
|
494
|
+
* @param endOfLine The new end of line for the [document](#TextDocument).
|
|
495
|
+
*/
|
|
496
|
+
setEndOfLine(endOfLine: EndOfLine): void;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Denotes a location of an editor in the window. Editors can be arranged in a grid
|
|
501
|
+
* and each column represents one editor location in that grid by counting the editors
|
|
502
|
+
* in order of their appearance.
|
|
503
|
+
*/
|
|
504
|
+
export enum ViewColumn {
|
|
505
|
+
/**
|
|
506
|
+
* A *symbolic* editor column representing the currently active column. This value
|
|
507
|
+
* can be used when opening editors, but the *resolved* [viewColumn](#TextEditor.viewColumn)-value
|
|
508
|
+
* of editors will always be `One`, `Two`, `Three`,... or `undefined` but never `Active`.
|
|
509
|
+
*/
|
|
510
|
+
Active = -1,
|
|
511
|
+
/**
|
|
512
|
+
* A *symbolic* editor column representing the column to the side of the active one. This value
|
|
513
|
+
* can be used when opening editors, but the *resolved* [viewColumn](#TextEditor.viewColumn)-value
|
|
514
|
+
* of editors will always be `One`, `Two`, `Three`,... or `undefined` but never `Beside`.
|
|
515
|
+
*/
|
|
516
|
+
Beside = -2,
|
|
517
|
+
/**
|
|
518
|
+
* The first editor column.
|
|
519
|
+
*/
|
|
520
|
+
One = 1,
|
|
521
|
+
/**
|
|
522
|
+
* The second editor column.
|
|
523
|
+
*/
|
|
524
|
+
Two = 2,
|
|
525
|
+
/**
|
|
526
|
+
* The third editor column.
|
|
527
|
+
*/
|
|
528
|
+
Three = 3,
|
|
529
|
+
/**
|
|
530
|
+
* The fourth editor column.
|
|
531
|
+
*/
|
|
532
|
+
Four = 4,
|
|
533
|
+
/**
|
|
534
|
+
* The fifth editor column.
|
|
535
|
+
*/
|
|
536
|
+
Five = 5,
|
|
537
|
+
/**
|
|
538
|
+
* The sixth editor column.
|
|
539
|
+
*/
|
|
540
|
+
Six = 6,
|
|
541
|
+
/**
|
|
542
|
+
* The seventh editor column.
|
|
543
|
+
*/
|
|
544
|
+
Seven = 7,
|
|
545
|
+
/**
|
|
546
|
+
* The eighth editor column.
|
|
547
|
+
*/
|
|
548
|
+
Eight = 8,
|
|
549
|
+
/**
|
|
550
|
+
* The ninth editor column.
|
|
551
|
+
*/
|
|
552
|
+
Nine = 9,
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
export namespace workspace {
|
|
556
|
+
/**
|
|
557
|
+
* Make changes to one or many resources or create, delete, and rename resources as defined by the given
|
|
558
|
+
* [workspace edit](#WorkspaceEdit).
|
|
559
|
+
*
|
|
560
|
+
* All changes of a workspace edit are applied in the same order in which they have been added. If
|
|
561
|
+
* multiple textual inserts are made at the same position, these strings appear in the resulting text
|
|
562
|
+
* in the order the 'inserts' were made. Invalid sequences like 'delete file a' -> 'insert text in file a'
|
|
563
|
+
* cause failure of the operation.
|
|
564
|
+
*
|
|
565
|
+
* When applying a workspace edit that consists only of text edits an 'all-or-nothing'-strategy is used.
|
|
566
|
+
* A workspace edit with resource creations or deletions aborts the operation, e.g. consecutive edits will
|
|
567
|
+
* not be attempted, when a single edit fails.
|
|
568
|
+
*
|
|
569
|
+
* @param edit A workspace edit.
|
|
570
|
+
* @return A thenable that resolves when the edit could be applied.
|
|
571
|
+
* @Owner 吭头
|
|
572
|
+
*/
|
|
573
|
+
export function applyEdit(edit: WorkspaceEdit): Thenable<boolean>;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
export namespace window {
|
|
577
|
+
/**
|
|
578
|
+
* The currently active editor or `undefined`. The active editor is the one
|
|
579
|
+
* that currently has focus or, when none has focus, the one that has changed
|
|
580
|
+
* input most recently.
|
|
581
|
+
*/
|
|
582
|
+
export let activeTextEditor: TextEditor | undefined;
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* The currently visible editors or an empty array.
|
|
586
|
+
*/
|
|
587
|
+
export let visibleTextEditors: TextEditor[];
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* An [event](#Event) which fires when the [active editor](#window.activeTextEditor)
|
|
591
|
+
* has changed. *Note* that the event also fires when the active editor changes
|
|
592
|
+
* to `undefined`.
|
|
593
|
+
*/
|
|
594
|
+
export const onDidChangeActiveTextEditor: Event<TextEditor | undefined>;
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* An [event](#Event) which fires when the array of [visible editors](#window.visibleTextEditors)
|
|
598
|
+
* has changed.
|
|
599
|
+
*/
|
|
600
|
+
export const onDidChangeVisibleTextEditors: Event<TextEditor[]>;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* An [event](#Event) which fires when the selection in an editor has changed.
|
|
604
|
+
*/
|
|
605
|
+
export const onDidChangeTextEditorSelection: Event<TextEditorSelectionChangeEvent>;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* An [event](#Event) which fires when the visible ranges of an editor has changed.
|
|
609
|
+
*/
|
|
610
|
+
export const onDidChangeTextEditorVisibleRanges: Event<TextEditorVisibleRangesChangeEvent>;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* An [event](#Event) which fires when the options of an editor have changed.
|
|
614
|
+
*/
|
|
615
|
+
export const onDidChangeTextEditorOptions: Event<TextEditorOptionsChangeEvent>;
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* An [event](#Event) which fires when the view column of an editor has changed.
|
|
619
|
+
*/
|
|
620
|
+
export const onDidChangeTextEditorViewColumn: Event<TextEditorViewColumnChangeEvent>;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Show the given document in a text editor. A [column](#ViewColumn) can be provided
|
|
624
|
+
* to control where the editor is being shown. Might change the [active editor](#window.activeTextEditor).
|
|
625
|
+
*
|
|
626
|
+
* @param document A text document to be shown.
|
|
627
|
+
* @param column A view column in which the [editor](#TextEditor) should be shown. The default is the [active](#ViewColumn.Active), other values
|
|
628
|
+
* are adjusted to be `Min(column, columnCount + 1)`, the [active](#ViewColumn.Active)-column is not adjusted. Use [`ViewColumn.Beside`](#ViewColumn.Beside)
|
|
629
|
+
* to open the editor to the side of the currently active one.
|
|
630
|
+
* @param preserveFocus When `true` the editor will not take focus.
|
|
631
|
+
* @return A promise that resolves to an [editor](#TextEditor).
|
|
632
|
+
*/
|
|
633
|
+
export function showTextDocument(
|
|
634
|
+
document: TextDocument,
|
|
635
|
+
column?: ViewColumn,
|
|
636
|
+
preserveFocus?: boolean,
|
|
637
|
+
): Thenable<TextEditor>;
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* A short-hand for `openTextDocument(uri).then(document => showTextDocument(document, options))`.
|
|
641
|
+
*
|
|
642
|
+
* @see [openTextDocument](#openTextDocument)
|
|
643
|
+
*
|
|
644
|
+
* @param document A resource identifier.
|
|
645
|
+
* @param options [Editor options](#TextDocumentShowOptions) to configure the behavior of showing the [editor](#TextEditor).
|
|
646
|
+
* @return A promise that resolves to an [editor](#TextEditor).
|
|
647
|
+
*/
|
|
648
|
+
export function showTextDocument(
|
|
649
|
+
document: Uri | TextDocument,
|
|
650
|
+
options?: TextDocumentShowOptions,
|
|
651
|
+
): Thenable<TextEditor>;
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Create a TextEditorDecorationType that can be used to add decorations to text editors.
|
|
655
|
+
*
|
|
656
|
+
* @param options Rendering options for the decoration type.
|
|
657
|
+
* @return A new decoration type instance.
|
|
658
|
+
*/
|
|
659
|
+
export function createTextEditorDecorationType(
|
|
660
|
+
options: DecorationRenderOptions,
|
|
661
|
+
): TextEditorDecorationType;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
export class TextEdit {
|
|
665
|
+
/**
|
|
666
|
+
* Utility to create a replace edit.
|
|
667
|
+
*
|
|
668
|
+
* @param range A range.
|
|
669
|
+
* @param newText A string.
|
|
670
|
+
* @return A new text edit object.
|
|
671
|
+
*/
|
|
672
|
+
static replace(range: Range, newText: string): TextEdit;
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Utility to create an insert edit.
|
|
676
|
+
*
|
|
677
|
+
* @param position A position, will become an empty range.
|
|
678
|
+
* @param newText A string.
|
|
679
|
+
* @return A new text edit object.
|
|
680
|
+
*/
|
|
681
|
+
static insert(position: Position, newText: string): TextEdit;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Utility to create a delete edit.
|
|
685
|
+
*
|
|
686
|
+
* @param range A range.
|
|
687
|
+
* @return A new text edit object.
|
|
688
|
+
*/
|
|
689
|
+
static delete(range: Range): TextEdit;
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Utility to create an eol-edit.
|
|
693
|
+
*
|
|
694
|
+
* @param eol An eol-sequence
|
|
695
|
+
* @return A new text edit object.
|
|
696
|
+
*/
|
|
697
|
+
static setEndOfLine(eol: EndOfLine): TextEdit;
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* The range this edit applies to.
|
|
701
|
+
*/
|
|
702
|
+
range: Range;
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* The string this edit will insert.
|
|
706
|
+
*/
|
|
707
|
+
newText: string;
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* The eol-sequence used in the document.
|
|
711
|
+
*
|
|
712
|
+
* *Note* that the eol-sequence will be applied to the
|
|
713
|
+
* whole document.
|
|
714
|
+
*/
|
|
715
|
+
newEol: EndOfLine;
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Create a new TextEdit.
|
|
719
|
+
*
|
|
720
|
+
* @param range A range.
|
|
721
|
+
* @param newText A string.
|
|
722
|
+
*/
|
|
723
|
+
constructor(range: Range, newText: string);
|
|
724
|
+
}
|
|
725
|
+
}
|