@theia/plugin 1.34.1 → 1.34.3

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.
@@ -1,630 +1,630 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 Red Hat, Inc. and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- /* eslint-disable @typescript-eslint/no-explicit-any */
18
-
19
- /**
20
- * This is the place for API experiments and proposals.
21
- * These API are NOT stable and subject to change. Use it on own risk.
22
- */
23
- export module '@theia/plugin' {
24
- /**
25
- * The contiguous set of modified lines in a diff.
26
- */
27
- export interface LineChange {
28
- readonly originalStartLineNumber: number;
29
- readonly originalEndLineNumber: number;
30
- readonly modifiedStartLineNumber: number;
31
- readonly modifiedEndLineNumber: number;
32
- }
33
-
34
- export namespace commands {
35
-
36
- /**
37
- * Get the keybindings associated to commandId.
38
- * @param commandId The ID of the command for which we are looking for keybindings.
39
- */
40
- export function getKeyBinding(commandId: string): Thenable<CommandKeyBinding[] | undefined>;
41
-
42
- /**
43
- * Registers a diff information command that can be invoked via a keyboard shortcut,
44
- * a menu item, an action, or directly.
45
- *
46
- * Diff information commands are different from ordinary [commands](#commands.registerCommand) as
47
- * they only execute when there is an active diff editor when the command is called, and the diff
48
- * information has been computed. Also, the command handler of an editor command has access to
49
- * the diff information.
50
- *
51
- * @param command A unique identifier for the command.
52
- * @param callback A command handler function with access to the [diff information](#LineChange).
53
- * @param thisArg The `this` context used when invoking the handler function.
54
- * @return Disposable which unregisters this command on disposal.
55
- */
56
- export function registerDiffInformationCommand(command: string, callback: (diff: LineChange[], ...args: any[]) => any, thisArg?: any): Disposable;
57
-
58
- }
59
-
60
- /**
61
- * Key Binding of a command
62
- */
63
- export interface CommandKeyBinding {
64
- /**
65
- * Identifier of the command.
66
- */
67
- id: string;
68
- /**
69
- * Value of the keyBinding
70
- */
71
- value: string;
72
- }
73
-
74
- /**
75
- * Enumeration of the supported operating systems.
76
- */
77
- export enum OperatingSystem {
78
- Windows = 'Windows',
79
- Linux = 'Linux',
80
- OSX = 'OSX'
81
- }
82
-
83
- export namespace env {
84
-
85
- /**
86
- * Returns the type of the operating system on the client side (like browser'OS if using browser mode). If it is neither [Windows](isWindows) nor [OS X](isOSX), then
87
- * it always return with the `Linux` OS type.
88
- */
89
- export function getClientOperatingSystem(): Thenable<OperatingSystem>;
90
-
91
- }
92
-
93
- export interface DecorationData {
94
- letter?: string;
95
- title?: string;
96
- color?: ThemeColor;
97
- priority?: number;
98
- bubble?: boolean;
99
- source?: string;
100
- }
101
-
102
- // #region SCM validation
103
-
104
- /**
105
- * Represents the validation type of the Source Control input.
106
- */
107
- export enum SourceControlInputBoxValidationType {
108
-
109
- /**
110
- * Something not allowed by the rules of a language or other means.
111
- */
112
- Error = 0,
113
-
114
- /**
115
- * Something suspicious but allowed.
116
- */
117
- Warning = 1,
118
-
119
- /**
120
- * Something to inform about but not a problem.
121
- */
122
- Information = 2
123
- }
124
-
125
- export interface SourceControlInputBoxValidation {
126
-
127
- /**
128
- * The validation message to display.
129
- */
130
- readonly message: string;
131
-
132
- /**
133
- * The validation type.
134
- */
135
- readonly type: SourceControlInputBoxValidationType;
136
- }
137
-
138
- /**
139
- * Represents the input box in the Source Control viewlet.
140
- */
141
- export interface SourceControlInputBox {
142
-
143
- /**
144
- * A validation function for the input box. It's possible to change
145
- * the validation provider simply by setting this property to a different function.
146
- */
147
- validateInput?(value: string, cursorPosition: number): ProviderResult<SourceControlInputBoxValidation | undefined | null>;
148
- }
149
-
150
- // #endregion
151
-
152
- export interface SourceControl {
153
-
154
- /**
155
- * Whether the source control is selected.
156
- */
157
- readonly selected: boolean;
158
-
159
- /**
160
- * An event signaling when the selection state changes.
161
- */
162
- readonly onDidChangeSelection: Event<boolean>;
163
- }
164
-
165
- export interface SourceControlResourceDecorations {
166
- source?: string;
167
- letter?: string;
168
- color?: ThemeColor;
169
- }
170
-
171
- // #region LogLevel: https://github.com/microsoft/vscode/issues/85992
172
-
173
- /**
174
- * The severity level of a log message
175
- */
176
- export enum LogLevel {
177
- Trace = 1,
178
- Debug = 2,
179
- Info = 3,
180
- Warning = 4,
181
- Error = 5,
182
- Critical = 6,
183
- Off = 7
184
- }
185
-
186
- export namespace env {
187
- /**
188
- * Current logging level.
189
- */
190
- export const logLevel: LogLevel;
191
-
192
- /**
193
- * An [event](#Event) that fires when the log level has changed.
194
- */
195
- export const onDidChangeLogLevel: Event<LogLevel>;
196
- }
197
-
198
- // #endregion
199
-
200
- // #region search in workspace
201
- /**
202
- * The parameters of a query for text search.
203
- */
204
- export interface TextSearchQuery {
205
- /**
206
- * The text pattern to search for.
207
- */
208
- pattern: string;
209
-
210
- /**
211
- * Whether or not `pattern` should match multiple lines of text.
212
- */
213
- isMultiline?: boolean;
214
-
215
- /**
216
- * Whether or not `pattern` should be interpreted as a regular expression.
217
- */
218
- isRegExp?: boolean;
219
-
220
- /**
221
- * Whether or not the search should be case-sensitive.
222
- */
223
- isCaseSensitive?: boolean;
224
-
225
- /**
226
- * Whether or not to search for whole word matches only.
227
- */
228
- isWordMatch?: boolean;
229
- }
230
-
231
- /**
232
- * Options that can be set on a findTextInFiles search.
233
- */
234
- export interface FindTextInFilesOptions {
235
- /**
236
- * A [glob pattern](#GlobPattern) that defines the files to search for. The glob pattern
237
- * will be matched against the file paths of files relative to their workspace. Use a [relative pattern](#RelativePattern)
238
- * to restrict the search results to a [workspace folder](#WorkspaceFolder).
239
- */
240
- include?: GlobPattern;
241
-
242
- /**
243
- * A [glob pattern](#GlobPattern) that defines files and folders to exclude. The glob pattern
244
- * will be matched against the file paths of resulting matches relative to their workspace. When `undefined`, default excludes will
245
- * apply.
246
- */
247
- exclude?: GlobPattern;
248
-
249
- /**
250
- * Whether to use the default and user-configured excludes. Defaults to true.
251
- */
252
- useDefaultExcludes?: boolean;
253
-
254
- /**
255
- * The maximum number of results to search for
256
- */
257
- maxResults?: number;
258
-
259
- /**
260
- * Whether external files that exclude files, like .gitignore, should be respected.
261
- * See the vscode setting `"search.useIgnoreFiles"`.
262
- */
263
- useIgnoreFiles?: boolean;
264
-
265
- /**
266
- * Whether global files that exclude files, like .gitignore, should be respected.
267
- * See the vscode setting `"search.useGlobalIgnoreFiles"`.
268
- */
269
- useGlobalIgnoreFiles?: boolean;
270
-
271
- /**
272
- * Whether symlinks should be followed while searching.
273
- * See the vscode setting `"search.followSymlinks"`.
274
- */
275
- followSymlinks?: boolean;
276
-
277
- /**
278
- * Interpret files using this encoding.
279
- * See the vscode setting `"files.encoding"`
280
- */
281
- encoding?: string;
282
-
283
- /**
284
- * Options to specify the size of the result text preview.
285
- */
286
- previewOptions?: TextSearchPreviewOptions;
287
-
288
- /**
289
- * Number of lines of context to include before each match.
290
- */
291
- beforeContext?: number;
292
-
293
- /**
294
- * Number of lines of context to include after each match.
295
- */
296
- afterContext?: number;
297
- }
298
-
299
- /**
300
- * A match from a text search
301
- */
302
- export interface TextSearchMatch {
303
- /**
304
- * The uri for the matching document.
305
- */
306
- uri: Uri;
307
-
308
- /**
309
- * The range of the match within the document, or multiple ranges for multiple matches.
310
- */
311
- ranges: Range | Range[];
312
-
313
- /**
314
- * A preview of the text match.
315
- */
316
- preview: TextSearchMatchPreview;
317
- }
318
-
319
- /**
320
- * A preview of the text result.
321
- */
322
- export interface TextSearchMatchPreview {
323
- /**
324
- * The matching lines of text, or a portion of the matching line that contains the match.
325
- */
326
- text: string;
327
-
328
- /**
329
- * The Range within `text` corresponding to the text of the match.
330
- * The number of matches must match the TextSearchMatch's range property.
331
- */
332
- matches: Range | Range[];
333
- }
334
-
335
- /**
336
- * Options to specify the size of the result text preview.
337
- * These options don't affect the size of the match itself, just the amount of preview text.
338
- */
339
- export interface TextSearchPreviewOptions {
340
- /**
341
- * The maximum number of lines in the preview.
342
- * Only search providers that support multiline search will ever return more than one line in the match.
343
- */
344
- matchLines: number;
345
-
346
- /**
347
- * The maximum number of characters included per line.
348
- */
349
- charsPerLine: number;
350
- }
351
-
352
- /**
353
- * A line of context surrounding a TextSearchMatch.
354
- */
355
- export interface TextSearchContext {
356
- /**
357
- * The uri for the matching document.
358
- */
359
- uri: Uri;
360
-
361
- /**
362
- * One line of text.
363
- * previewOptions.charsPerLine applies to this
364
- */
365
- text: string;
366
-
367
- /**
368
- * The line number of this line of context.
369
- */
370
- lineNumber: number;
371
- }
372
-
373
- export type TextSearchResult = TextSearchMatch | TextSearchContext;
374
-
375
- /**
376
- * Information collected when text search is complete.
377
- */
378
- export interface TextSearchComplete {
379
- /**
380
- * Whether the search hit the limit on the maximum number of search results.
381
- * `maxResults` on [`TextSearchOptions`](#TextSearchOptions) specifies the max number of results.
382
- * - If exactly that number of matches exist, this should be false.
383
- * - If `maxResults` matches are returned and more exist, this should be true.
384
- * - If search hits an internal limit which is less than `maxResults`, this should be true.
385
- */
386
- limitHit?: boolean;
387
- }
388
-
389
- export namespace workspace {
390
- /**
391
- * Find text in files across all [workspace folders] in the workspace
392
- * @param query What to search
393
- * @param optionsOrCallback
394
- * @param callbackOrToken
395
- * @param token
396
- */
397
- export function findTextInFiles(query: TextSearchQuery, optionsOrCallback: FindTextInFilesOptions | ((result: TextSearchResult) => void),
398
- callbackOrToken?: CancellationToken | ((result: TextSearchResult) => void), token?: CancellationToken): Promise<TextSearchComplete>;
399
- }
400
- // #endregion
401
-
402
- // #region read/write in chunks: https://github.com/microsoft/vscode/issues/84515
403
-
404
- export interface FileSystemProvider {
405
- open?(resource: Uri, options: { create: boolean; }): number | Thenable<number>;
406
- close?(fd: number): void | Thenable<void>;
407
- read?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable<number>;
408
- write?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable<number>;
409
- }
410
-
411
- // #endregion
412
-
413
- // #region Custom editor move https://github.com/microsoft/vscode/issues/86146
414
- // copied from https://github.com/microsoft/vscode/blob/53eac52308c4611000a171cc7bf1214293473c78/src/vs/vscode.proposed.d.ts#L986-L1007
415
-
416
- // TODO: Also for custom editor
417
-
418
- export interface CustomTextEditorProvider {
419
-
420
- /**
421
- * Handle when the underlying resource for a custom editor is renamed.
422
- *
423
- * This allows the webview for the editor be preserved throughout the rename. If this method is not implemented,
424
- * Theia will destroy the previous custom editor and create a replacement one.
425
- *
426
- * @param newDocument New text document to use for the custom editor.
427
- * @param existingWebviewPanel Webview panel for the custom editor.
428
- * @param token A cancellation token that indicates the result is no longer needed.
429
- *
430
- * @return Thenable indicating that the webview editor has been moved.
431
- */
432
- moveCustomTextEditor?(newDocument: TextDocument, existingWebviewPanel: WebviewPanel, token: CancellationToken): Thenable<void>;
433
- }
434
-
435
- // #endregion
436
-
437
- export interface ResourceLabelFormatter {
438
- scheme: string;
439
- authority?: string;
440
- formatting: ResourceLabelFormatting;
441
- }
442
-
443
- export interface ResourceLabelFormatting {
444
- label: string; // myLabel:/${path}
445
- // TODO@isi
446
- separator: '/' | '\\' | '';
447
- tildify?: boolean;
448
- normalizeDriveLetter?: boolean;
449
- workspaceSuffix?: string;
450
- authorityPrefix?: string;
451
- }
452
-
453
- export namespace workspace {
454
- export function registerResourceLabelFormatter(formatter: ResourceLabelFormatter): Disposable;
455
- }
456
-
457
- // #region timeline
458
- // copied from https://github.com/microsoft/vscode/blob/d69a79b73808559a91206d73d7717ff5f798f23c/src/vs/vscode.proposed.d.ts#L1870-L2017
459
- export class TimelineItem {
460
- /**
461
- * A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred.
462
- */
463
- timestamp: number;
464
-
465
- /**
466
- * A human-readable string describing the timeline item.
467
- */
468
- label: string;
469
-
470
- /**
471
- * Optional id for the timeline item. It must be unique across all the timeline items provided by this source.
472
- *
473
- * If not provided, an id is generated using the timeline item's timestamp.
474
- */
475
- id?: string;
476
-
477
- /**
478
- * The icon path or [ThemeIcon](#ThemeIcon) for the timeline item.
479
- */
480
- iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
481
-
482
- /**
483
- * A human readable string describing less prominent details of the timeline item.
484
- */
485
- description?: string;
486
-
487
- /**
488
- * The tooltip text when you hover over the timeline item.
489
- */
490
- detail?: string;
491
-
492
- /**
493
- * The [command](#Command) that should be executed when the timeline item is selected.
494
- */
495
- command?: Command;
496
-
497
- /**
498
- * Context value of the timeline item. This can be used to contribute specific actions to the item.
499
- * For example, a timeline item is given a context value as `commit`. When contributing actions to `timeline/item/context`
500
- * using `menus` extension point, you can specify context value for key `timelineItem` in `when` expression like `timelineItem == commit`.
501
- * ```
502
- * "contributes": {
503
- * "menus": {
504
- * "timeline/item/context": [{
505
- * "command": "extension.copyCommitId",
506
- * "when": "timelineItem == commit"
507
- * }]
508
- * }
509
- * }
510
- * ```
511
- * This will show the `extension.copyCommitId` action only for items where `contextValue` is `commit`.
512
- */
513
- contextValue?: string;
514
-
515
- /**
516
- * Accessibility information used when screen reader interacts with this timeline item.
517
- */
518
- accessibilityInformation?: AccessibilityInformation;
519
-
520
- /**
521
- * @param label A human-readable string describing the timeline item
522
- * @param timestamp A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred
523
- */
524
- constructor(label: string, timestamp: number);
525
- }
526
-
527
- export interface TimelineChangeEvent {
528
- /**
529
- * The [uri](#Uri) of the resource for which the timeline changed.
530
- */
531
- uri: Uri;
532
-
533
- /**
534
- * A flag which indicates whether the entire timeline should be reset.
535
- */
536
- reset?: boolean;
537
- }
538
-
539
- export interface Timeline {
540
- readonly paging?: {
541
- /**
542
- * A provider-defined cursor specifying the starting point of timeline items which are after the ones returned.
543
- * Use `undefined` to signal that there are no more items to be returned.
544
- */
545
- readonly cursor: string | undefined;
546
- }
547
-
548
- /**
549
- * An array of [timeline items](#TimelineItem).
550
- */
551
- readonly items: readonly TimelineItem[];
552
- }
553
-
554
- export interface TimelineOptions {
555
- /**
556
- * A provider-defined cursor specifying the starting point of the timeline items that should be returned.
557
- */
558
- cursor?: string;
559
-
560
- /**
561
- * An optional maximum number timeline items or the all timeline items newer (inclusive) than the timestamp or id that should be returned.
562
- * If `undefined` all timeline items should be returned.
563
- */
564
- limit?: number | { timestamp: number; id?: string };
565
- }
566
-
567
- export interface TimelineProvider {
568
- /**
569
- * An optional event to signal that the timeline for a source has changed.
570
- * To signal that the timeline for all resources (uris) has changed, do not pass any argument or pass `undefined`.
571
- */
572
- onDidChange?: Event<TimelineChangeEvent | undefined>;
573
-
574
- /**
575
- * An identifier of the source of the timeline items. This can be used to filter sources.
576
- */
577
- readonly id: string;
578
-
579
- /**
580
- * A human-readable string describing the source of the timeline items. This can be used as the display label when filtering sources.
581
- */
582
- readonly label: string;
583
-
584
- /**
585
- * Provide [timeline items](#TimelineItem) for a [Uri](#Uri).
586
- *
587
- * @param uri The [uri](#Uri) of the file to provide the timeline for.
588
- * @param options A set of options to determine how results should be returned.
589
- * @param token A cancellation token.
590
- * @return The [timeline result](#TimelineResult) or a thenable that resolves to such. The lack of a result
591
- * can be signaled by returning `undefined`, `null`, or an empty array.
592
- */
593
- provideTimeline(uri: Uri, options: TimelineOptions, token: CancellationToken): ProviderResult<Timeline>;
594
- }
595
-
596
- export namespace workspace {
597
- /**
598
- * Register a timeline provider.
599
- *
600
- * Multiple providers can be registered. In that case, providers are asked in
601
- * parallel and the results are merged. A failing provider (rejected promise or exception) will
602
- * not cause a failure of the whole operation.
603
- *
604
- * @param scheme A scheme or schemes that defines which documents this provider is applicable to. Can be `*` to target all documents.
605
- * @param provider A timeline provider.
606
- * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
607
- */
608
- export function registerTimelineProvider(scheme: string | string[], provider: TimelineProvider): Disposable;
609
- }
610
-
611
- // #endregion
612
- }
613
-
614
- /**
615
- * Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
616
- * and others. This API makes no assumption about what promise library is being used which
617
- * enables reusing existing code without migrating to a specific promise implementation. Still,
618
- * we recommend the use of native promises which are available in this editor.
619
- */
620
- interface Thenable<T> {
621
- /**
622
- * Attaches callbacks for the resolution and/or rejection of the Promise.
623
- * @param onfulfilled The callback to execute when the Promise is resolved.
624
- * @param onrejected The callback to execute when the Promise is rejected.
625
- * @returns A Promise for the completion of which ever callback is executed.
626
- */
627
- then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
628
- then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
629
- }
630
-
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 Red Hat, Inc. and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ /* eslint-disable @typescript-eslint/no-explicit-any */
18
+
19
+ /**
20
+ * This is the place for API experiments and proposals.
21
+ * These API are NOT stable and subject to change. Use it on own risk.
22
+ */
23
+ export module '@theia/plugin' {
24
+ /**
25
+ * The contiguous set of modified lines in a diff.
26
+ */
27
+ export interface LineChange {
28
+ readonly originalStartLineNumber: number;
29
+ readonly originalEndLineNumber: number;
30
+ readonly modifiedStartLineNumber: number;
31
+ readonly modifiedEndLineNumber: number;
32
+ }
33
+
34
+ export namespace commands {
35
+
36
+ /**
37
+ * Get the keybindings associated to commandId.
38
+ * @param commandId The ID of the command for which we are looking for keybindings.
39
+ */
40
+ export function getKeyBinding(commandId: string): Thenable<CommandKeyBinding[] | undefined>;
41
+
42
+ /**
43
+ * Registers a diff information command that can be invoked via a keyboard shortcut,
44
+ * a menu item, an action, or directly.
45
+ *
46
+ * Diff information commands are different from ordinary [commands](#commands.registerCommand) as
47
+ * they only execute when there is an active diff editor when the command is called, and the diff
48
+ * information has been computed. Also, the command handler of an editor command has access to
49
+ * the diff information.
50
+ *
51
+ * @param command A unique identifier for the command.
52
+ * @param callback A command handler function with access to the [diff information](#LineChange).
53
+ * @param thisArg The `this` context used when invoking the handler function.
54
+ * @return Disposable which unregisters this command on disposal.
55
+ */
56
+ export function registerDiffInformationCommand(command: string, callback: (diff: LineChange[], ...args: any[]) => any, thisArg?: any): Disposable;
57
+
58
+ }
59
+
60
+ /**
61
+ * Key Binding of a command
62
+ */
63
+ export interface CommandKeyBinding {
64
+ /**
65
+ * Identifier of the command.
66
+ */
67
+ id: string;
68
+ /**
69
+ * Value of the keyBinding
70
+ */
71
+ value: string;
72
+ }
73
+
74
+ /**
75
+ * Enumeration of the supported operating systems.
76
+ */
77
+ export enum OperatingSystem {
78
+ Windows = 'Windows',
79
+ Linux = 'Linux',
80
+ OSX = 'OSX'
81
+ }
82
+
83
+ export namespace env {
84
+
85
+ /**
86
+ * Returns the type of the operating system on the client side (like browser'OS if using browser mode). If it is neither [Windows](isWindows) nor [OS X](isOSX), then
87
+ * it always return with the `Linux` OS type.
88
+ */
89
+ export function getClientOperatingSystem(): Thenable<OperatingSystem>;
90
+
91
+ }
92
+
93
+ export interface DecorationData {
94
+ letter?: string;
95
+ title?: string;
96
+ color?: ThemeColor;
97
+ priority?: number;
98
+ bubble?: boolean;
99
+ source?: string;
100
+ }
101
+
102
+ // #region SCM validation
103
+
104
+ /**
105
+ * Represents the validation type of the Source Control input.
106
+ */
107
+ export enum SourceControlInputBoxValidationType {
108
+
109
+ /**
110
+ * Something not allowed by the rules of a language or other means.
111
+ */
112
+ Error = 0,
113
+
114
+ /**
115
+ * Something suspicious but allowed.
116
+ */
117
+ Warning = 1,
118
+
119
+ /**
120
+ * Something to inform about but not a problem.
121
+ */
122
+ Information = 2
123
+ }
124
+
125
+ export interface SourceControlInputBoxValidation {
126
+
127
+ /**
128
+ * The validation message to display.
129
+ */
130
+ readonly message: string;
131
+
132
+ /**
133
+ * The validation type.
134
+ */
135
+ readonly type: SourceControlInputBoxValidationType;
136
+ }
137
+
138
+ /**
139
+ * Represents the input box in the Source Control viewlet.
140
+ */
141
+ export interface SourceControlInputBox {
142
+
143
+ /**
144
+ * A validation function for the input box. It's possible to change
145
+ * the validation provider simply by setting this property to a different function.
146
+ */
147
+ validateInput?(value: string, cursorPosition: number): ProviderResult<SourceControlInputBoxValidation | undefined | null>;
148
+ }
149
+
150
+ // #endregion
151
+
152
+ export interface SourceControl {
153
+
154
+ /**
155
+ * Whether the source control is selected.
156
+ */
157
+ readonly selected: boolean;
158
+
159
+ /**
160
+ * An event signaling when the selection state changes.
161
+ */
162
+ readonly onDidChangeSelection: Event<boolean>;
163
+ }
164
+
165
+ export interface SourceControlResourceDecorations {
166
+ source?: string;
167
+ letter?: string;
168
+ color?: ThemeColor;
169
+ }
170
+
171
+ // #region LogLevel: https://github.com/microsoft/vscode/issues/85992
172
+
173
+ /**
174
+ * The severity level of a log message
175
+ */
176
+ export enum LogLevel {
177
+ Trace = 1,
178
+ Debug = 2,
179
+ Info = 3,
180
+ Warning = 4,
181
+ Error = 5,
182
+ Critical = 6,
183
+ Off = 7
184
+ }
185
+
186
+ export namespace env {
187
+ /**
188
+ * Current logging level.
189
+ */
190
+ export const logLevel: LogLevel;
191
+
192
+ /**
193
+ * An [event](#Event) that fires when the log level has changed.
194
+ */
195
+ export const onDidChangeLogLevel: Event<LogLevel>;
196
+ }
197
+
198
+ // #endregion
199
+
200
+ // #region search in workspace
201
+ /**
202
+ * The parameters of a query for text search.
203
+ */
204
+ export interface TextSearchQuery {
205
+ /**
206
+ * The text pattern to search for.
207
+ */
208
+ pattern: string;
209
+
210
+ /**
211
+ * Whether or not `pattern` should match multiple lines of text.
212
+ */
213
+ isMultiline?: boolean;
214
+
215
+ /**
216
+ * Whether or not `pattern` should be interpreted as a regular expression.
217
+ */
218
+ isRegExp?: boolean;
219
+
220
+ /**
221
+ * Whether or not the search should be case-sensitive.
222
+ */
223
+ isCaseSensitive?: boolean;
224
+
225
+ /**
226
+ * Whether or not to search for whole word matches only.
227
+ */
228
+ isWordMatch?: boolean;
229
+ }
230
+
231
+ /**
232
+ * Options that can be set on a findTextInFiles search.
233
+ */
234
+ export interface FindTextInFilesOptions {
235
+ /**
236
+ * A [glob pattern](#GlobPattern) that defines the files to search for. The glob pattern
237
+ * will be matched against the file paths of files relative to their workspace. Use a [relative pattern](#RelativePattern)
238
+ * to restrict the search results to a [workspace folder](#WorkspaceFolder).
239
+ */
240
+ include?: GlobPattern;
241
+
242
+ /**
243
+ * A [glob pattern](#GlobPattern) that defines files and folders to exclude. The glob pattern
244
+ * will be matched against the file paths of resulting matches relative to their workspace. When `undefined`, default excludes will
245
+ * apply.
246
+ */
247
+ exclude?: GlobPattern;
248
+
249
+ /**
250
+ * Whether to use the default and user-configured excludes. Defaults to true.
251
+ */
252
+ useDefaultExcludes?: boolean;
253
+
254
+ /**
255
+ * The maximum number of results to search for
256
+ */
257
+ maxResults?: number;
258
+
259
+ /**
260
+ * Whether external files that exclude files, like .gitignore, should be respected.
261
+ * See the vscode setting `"search.useIgnoreFiles"`.
262
+ */
263
+ useIgnoreFiles?: boolean;
264
+
265
+ /**
266
+ * Whether global files that exclude files, like .gitignore, should be respected.
267
+ * See the vscode setting `"search.useGlobalIgnoreFiles"`.
268
+ */
269
+ useGlobalIgnoreFiles?: boolean;
270
+
271
+ /**
272
+ * Whether symlinks should be followed while searching.
273
+ * See the vscode setting `"search.followSymlinks"`.
274
+ */
275
+ followSymlinks?: boolean;
276
+
277
+ /**
278
+ * Interpret files using this encoding.
279
+ * See the vscode setting `"files.encoding"`
280
+ */
281
+ encoding?: string;
282
+
283
+ /**
284
+ * Options to specify the size of the result text preview.
285
+ */
286
+ previewOptions?: TextSearchPreviewOptions;
287
+
288
+ /**
289
+ * Number of lines of context to include before each match.
290
+ */
291
+ beforeContext?: number;
292
+
293
+ /**
294
+ * Number of lines of context to include after each match.
295
+ */
296
+ afterContext?: number;
297
+ }
298
+
299
+ /**
300
+ * A match from a text search
301
+ */
302
+ export interface TextSearchMatch {
303
+ /**
304
+ * The uri for the matching document.
305
+ */
306
+ uri: Uri;
307
+
308
+ /**
309
+ * The range of the match within the document, or multiple ranges for multiple matches.
310
+ */
311
+ ranges: Range | Range[];
312
+
313
+ /**
314
+ * A preview of the text match.
315
+ */
316
+ preview: TextSearchMatchPreview;
317
+ }
318
+
319
+ /**
320
+ * A preview of the text result.
321
+ */
322
+ export interface TextSearchMatchPreview {
323
+ /**
324
+ * The matching lines of text, or a portion of the matching line that contains the match.
325
+ */
326
+ text: string;
327
+
328
+ /**
329
+ * The Range within `text` corresponding to the text of the match.
330
+ * The number of matches must match the TextSearchMatch's range property.
331
+ */
332
+ matches: Range | Range[];
333
+ }
334
+
335
+ /**
336
+ * Options to specify the size of the result text preview.
337
+ * These options don't affect the size of the match itself, just the amount of preview text.
338
+ */
339
+ export interface TextSearchPreviewOptions {
340
+ /**
341
+ * The maximum number of lines in the preview.
342
+ * Only search providers that support multiline search will ever return more than one line in the match.
343
+ */
344
+ matchLines: number;
345
+
346
+ /**
347
+ * The maximum number of characters included per line.
348
+ */
349
+ charsPerLine: number;
350
+ }
351
+
352
+ /**
353
+ * A line of context surrounding a TextSearchMatch.
354
+ */
355
+ export interface TextSearchContext {
356
+ /**
357
+ * The uri for the matching document.
358
+ */
359
+ uri: Uri;
360
+
361
+ /**
362
+ * One line of text.
363
+ * previewOptions.charsPerLine applies to this
364
+ */
365
+ text: string;
366
+
367
+ /**
368
+ * The line number of this line of context.
369
+ */
370
+ lineNumber: number;
371
+ }
372
+
373
+ export type TextSearchResult = TextSearchMatch | TextSearchContext;
374
+
375
+ /**
376
+ * Information collected when text search is complete.
377
+ */
378
+ export interface TextSearchComplete {
379
+ /**
380
+ * Whether the search hit the limit on the maximum number of search results.
381
+ * `maxResults` on [`TextSearchOptions`](#TextSearchOptions) specifies the max number of results.
382
+ * - If exactly that number of matches exist, this should be false.
383
+ * - If `maxResults` matches are returned and more exist, this should be true.
384
+ * - If search hits an internal limit which is less than `maxResults`, this should be true.
385
+ */
386
+ limitHit?: boolean;
387
+ }
388
+
389
+ export namespace workspace {
390
+ /**
391
+ * Find text in files across all [workspace folders] in the workspace
392
+ * @param query What to search
393
+ * @param optionsOrCallback
394
+ * @param callbackOrToken
395
+ * @param token
396
+ */
397
+ export function findTextInFiles(query: TextSearchQuery, optionsOrCallback: FindTextInFilesOptions | ((result: TextSearchResult) => void),
398
+ callbackOrToken?: CancellationToken | ((result: TextSearchResult) => void), token?: CancellationToken): Promise<TextSearchComplete>;
399
+ }
400
+ // #endregion
401
+
402
+ // #region read/write in chunks: https://github.com/microsoft/vscode/issues/84515
403
+
404
+ export interface FileSystemProvider {
405
+ open?(resource: Uri, options: { create: boolean; }): number | Thenable<number>;
406
+ close?(fd: number): void | Thenable<void>;
407
+ read?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable<number>;
408
+ write?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable<number>;
409
+ }
410
+
411
+ // #endregion
412
+
413
+ // #region Custom editor move https://github.com/microsoft/vscode/issues/86146
414
+ // copied from https://github.com/microsoft/vscode/blob/53eac52308c4611000a171cc7bf1214293473c78/src/vs/vscode.proposed.d.ts#L986-L1007
415
+
416
+ // TODO: Also for custom editor
417
+
418
+ export interface CustomTextEditorProvider {
419
+
420
+ /**
421
+ * Handle when the underlying resource for a custom editor is renamed.
422
+ *
423
+ * This allows the webview for the editor be preserved throughout the rename. If this method is not implemented,
424
+ * Theia will destroy the previous custom editor and create a replacement one.
425
+ *
426
+ * @param newDocument New text document to use for the custom editor.
427
+ * @param existingWebviewPanel Webview panel for the custom editor.
428
+ * @param token A cancellation token that indicates the result is no longer needed.
429
+ *
430
+ * @return Thenable indicating that the webview editor has been moved.
431
+ */
432
+ moveCustomTextEditor?(newDocument: TextDocument, existingWebviewPanel: WebviewPanel, token: CancellationToken): Thenable<void>;
433
+ }
434
+
435
+ // #endregion
436
+
437
+ export interface ResourceLabelFormatter {
438
+ scheme: string;
439
+ authority?: string;
440
+ formatting: ResourceLabelFormatting;
441
+ }
442
+
443
+ export interface ResourceLabelFormatting {
444
+ label: string; // myLabel:/${path}
445
+ // TODO@isi
446
+ separator: '/' | '\\' | '';
447
+ tildify?: boolean;
448
+ normalizeDriveLetter?: boolean;
449
+ workspaceSuffix?: string;
450
+ authorityPrefix?: string;
451
+ }
452
+
453
+ export namespace workspace {
454
+ export function registerResourceLabelFormatter(formatter: ResourceLabelFormatter): Disposable;
455
+ }
456
+
457
+ // #region timeline
458
+ // copied from https://github.com/microsoft/vscode/blob/d69a79b73808559a91206d73d7717ff5f798f23c/src/vs/vscode.proposed.d.ts#L1870-L2017
459
+ export class TimelineItem {
460
+ /**
461
+ * A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred.
462
+ */
463
+ timestamp: number;
464
+
465
+ /**
466
+ * A human-readable string describing the timeline item.
467
+ */
468
+ label: string;
469
+
470
+ /**
471
+ * Optional id for the timeline item. It must be unique across all the timeline items provided by this source.
472
+ *
473
+ * If not provided, an id is generated using the timeline item's timestamp.
474
+ */
475
+ id?: string;
476
+
477
+ /**
478
+ * The icon path or [ThemeIcon](#ThemeIcon) for the timeline item.
479
+ */
480
+ iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
481
+
482
+ /**
483
+ * A human readable string describing less prominent details of the timeline item.
484
+ */
485
+ description?: string;
486
+
487
+ /**
488
+ * The tooltip text when you hover over the timeline item.
489
+ */
490
+ detail?: string;
491
+
492
+ /**
493
+ * The [command](#Command) that should be executed when the timeline item is selected.
494
+ */
495
+ command?: Command;
496
+
497
+ /**
498
+ * Context value of the timeline item. This can be used to contribute specific actions to the item.
499
+ * For example, a timeline item is given a context value as `commit`. When contributing actions to `timeline/item/context`
500
+ * using `menus` extension point, you can specify context value for key `timelineItem` in `when` expression like `timelineItem == commit`.
501
+ * ```
502
+ * "contributes": {
503
+ * "menus": {
504
+ * "timeline/item/context": [{
505
+ * "command": "extension.copyCommitId",
506
+ * "when": "timelineItem == commit"
507
+ * }]
508
+ * }
509
+ * }
510
+ * ```
511
+ * This will show the `extension.copyCommitId` action only for items where `contextValue` is `commit`.
512
+ */
513
+ contextValue?: string;
514
+
515
+ /**
516
+ * Accessibility information used when screen reader interacts with this timeline item.
517
+ */
518
+ accessibilityInformation?: AccessibilityInformation;
519
+
520
+ /**
521
+ * @param label A human-readable string describing the timeline item
522
+ * @param timestamp A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred
523
+ */
524
+ constructor(label: string, timestamp: number);
525
+ }
526
+
527
+ export interface TimelineChangeEvent {
528
+ /**
529
+ * The [uri](#Uri) of the resource for which the timeline changed.
530
+ */
531
+ uri: Uri;
532
+
533
+ /**
534
+ * A flag which indicates whether the entire timeline should be reset.
535
+ */
536
+ reset?: boolean;
537
+ }
538
+
539
+ export interface Timeline {
540
+ readonly paging?: {
541
+ /**
542
+ * A provider-defined cursor specifying the starting point of timeline items which are after the ones returned.
543
+ * Use `undefined` to signal that there are no more items to be returned.
544
+ */
545
+ readonly cursor: string | undefined;
546
+ }
547
+
548
+ /**
549
+ * An array of [timeline items](#TimelineItem).
550
+ */
551
+ readonly items: readonly TimelineItem[];
552
+ }
553
+
554
+ export interface TimelineOptions {
555
+ /**
556
+ * A provider-defined cursor specifying the starting point of the timeline items that should be returned.
557
+ */
558
+ cursor?: string;
559
+
560
+ /**
561
+ * An optional maximum number timeline items or the all timeline items newer (inclusive) than the timestamp or id that should be returned.
562
+ * If `undefined` all timeline items should be returned.
563
+ */
564
+ limit?: number | { timestamp: number; id?: string };
565
+ }
566
+
567
+ export interface TimelineProvider {
568
+ /**
569
+ * An optional event to signal that the timeline for a source has changed.
570
+ * To signal that the timeline for all resources (uris) has changed, do not pass any argument or pass `undefined`.
571
+ */
572
+ onDidChange?: Event<TimelineChangeEvent | undefined>;
573
+
574
+ /**
575
+ * An identifier of the source of the timeline items. This can be used to filter sources.
576
+ */
577
+ readonly id: string;
578
+
579
+ /**
580
+ * A human-readable string describing the source of the timeline items. This can be used as the display label when filtering sources.
581
+ */
582
+ readonly label: string;
583
+
584
+ /**
585
+ * Provide [timeline items](#TimelineItem) for a [Uri](#Uri).
586
+ *
587
+ * @param uri The [uri](#Uri) of the file to provide the timeline for.
588
+ * @param options A set of options to determine how results should be returned.
589
+ * @param token A cancellation token.
590
+ * @return The [timeline result](#TimelineResult) or a thenable that resolves to such. The lack of a result
591
+ * can be signaled by returning `undefined`, `null`, or an empty array.
592
+ */
593
+ provideTimeline(uri: Uri, options: TimelineOptions, token: CancellationToken): ProviderResult<Timeline>;
594
+ }
595
+
596
+ export namespace workspace {
597
+ /**
598
+ * Register a timeline provider.
599
+ *
600
+ * Multiple providers can be registered. In that case, providers are asked in
601
+ * parallel and the results are merged. A failing provider (rejected promise or exception) will
602
+ * not cause a failure of the whole operation.
603
+ *
604
+ * @param scheme A scheme or schemes that defines which documents this provider is applicable to. Can be `*` to target all documents.
605
+ * @param provider A timeline provider.
606
+ * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
607
+ */
608
+ export function registerTimelineProvider(scheme: string | string[], provider: TimelineProvider): Disposable;
609
+ }
610
+
611
+ // #endregion
612
+ }
613
+
614
+ /**
615
+ * Thenable is a common denominator between ES6 promises, Q, jquery.Deferred, WinJS.Promise,
616
+ * and others. This API makes no assumption about what promise library is being used which
617
+ * enables reusing existing code without migrating to a specific promise implementation. Still,
618
+ * we recommend the use of native promises which are available in this editor.
619
+ */
620
+ interface Thenable<T> {
621
+ /**
622
+ * Attaches callbacks for the resolution and/or rejection of the Promise.
623
+ * @param onfulfilled The callback to execute when the Promise is resolved.
624
+ * @param onrejected The callback to execute when the Promise is rejected.
625
+ * @returns A Promise for the completion of which ever callback is executed.
626
+ */
627
+ then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
628
+ then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
629
+ }
630
+