-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
plugin-api-rpc.ts
2753 lines (2392 loc) · 106 KB
/
plugin-api-rpc.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// *****************************************************************************
// Copyright (C) 2018 Red Hat, Inc. and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************
/* eslint-disable @typescript-eslint/no-explicit-any */
import { createProxyIdentifier, ProxyIdentifier, RPCProtocol } from './rpc-protocol';
import * as theia from '@theia/plugin';
import { PluginLifecycle, PluginModel, PluginMetadata, PluginPackage, IconUrl, PluginJsonValidationContribution } from './plugin-protocol';
import { QueryParameters } from './env';
import { TextEditorCursorStyle } from './editor-options';
import {
ConfigurationTarget,
TextEditorLineNumbersStyle,
EndOfLine,
OverviewRulerLane,
FileOperationOptions,
TextDocumentChangeReason,
IndentAction,
NotebookRendererScript,
} from '../plugin/types-impl';
import { UriComponents } from './uri-components';
import {
SerializedDocumentFilter,
CompletionContext,
MarkdownString,
Range,
Completion,
CompletionResultDto,
MarkerData,
SignatureHelp,
Hover,
EvaluatableExpression,
InlineValue,
InlineValueContext,
DocumentHighlight,
FormattingOptions,
ChainedCacheId,
Definition,
DocumentLink,
CodeLensSymbol,
Command,
TextEdit,
DocumentSymbol,
ReferenceContext,
TextDocumentShowOptions,
WorkspaceRootsChangeEvent,
Location,
Breakpoint,
ColorPresentation,
RenameLocation,
SignatureHelpContext,
CodeAction,
CodeActionContext,
FoldingContext,
FoldingRange,
SelectionRange,
SearchInWorkspaceResult,
CallHierarchyItem,
CallHierarchyIncomingCall,
CallHierarchyOutgoingCall,
Comment,
CommentOptions,
CommentThreadState,
CommentThreadCollapsibleState,
CommentThread,
CommentThreadChangedEvent,
CodeActionProviderDocumentation,
LinkedEditingRanges,
ProvidedTerminalLink,
InlayHint,
CachedSession,
CachedSessionItem,
TypeHierarchyItem,
InlineCompletion,
InlineCompletions,
InlineCompletionContext,
DocumentDropEdit,
DataTransferDTO,
DocumentDropEditProviderMetadata,
DebugStackFrameDTO,
DebugThreadDTO
} from './plugin-api-rpc-model';
import { ExtPluginApi } from './plugin-ext-api-contribution';
import { KeysToAnyValues, KeysToKeysToAnyValue } from './types';
import {
AuthenticationProviderAuthenticationSessionsChangeEvent,
CancellationToken,
Progress,
ProgressOptions,
} from '@theia/plugin';
import { DebuggerDescription } from '@theia/debug/lib/common/debug-service';
import { DebugProtocol } from '@vscode/debugprotocol';
import { SymbolInformation } from '@theia/core/shared/vscode-languageserver-protocol';
import * as files from '@theia/filesystem/lib/common/files';
import { BinaryBuffer } from '@theia/core/lib/common/buffer';
import { ResourceLabelFormatter } from '@theia/core/lib/common/label-protocol';
import type {
InternalTimelineOptions,
Timeline,
TimelineChangeEvent,
TimelineProviderDescriptor
} from '@theia/timeline/lib/common/timeline-model';
import { SerializableEnvironmentVariableCollection } from '@theia/terminal/lib/common/shell-terminal-protocol';
import { ThemeType } from '@theia/core/lib/common/theme';
import { Disposable } from '@theia/core/lib/common/disposable';
import { isString, isObject, QuickInputButtonHandle } from '@theia/core/lib/common';
import { Severity } from '@theia/core/lib/common/severity';
import { DebugConfiguration, DebugSessionOptions } from '@theia/debug/lib/common/debug-configuration';
import * as notebookCommon from '@theia/notebook/lib/common';
import { CellExecutionUpdateType, CellRange, NotebookCellExecutionState } from '@theia/notebook/lib/common';
import { LanguagePackBundle } from './language-pack-service';
import { AccessibilityInformation } from '@theia/core/lib/common/accessibility';
import { TreeDelta } from '@theia/test/lib/common/tree-delta';
import { TestItemDTO, TestOutputDTO, TestRunDTO, TestRunProfileDTO, TestRunRequestDTO, TestStateChangeDTO } from './test-types';
import { ArgumentProcessor } from './commands';
export interface PreferenceData {
[scope: number]: any;
}
export interface Plugin {
pluginPath: string | undefined;
pluginFolder: string;
pluginUri: string;
model: PluginModel;
rawModel: PluginPackage;
lifecycle: PluginLifecycle;
isUnderDevelopment: boolean;
}
export interface ConfigStorage {
hostLogPath: string;
hostStoragePath?: string;
hostGlobalStoragePath: string;
}
export enum UIKind {
/**
* Extensions are accessed from a desktop application.
*/
Desktop = 1,
/**
* Extensions are accessed from a web browser.
*/
Web = 2
}
export enum ExtensionKind {
/**
* Extension runs where the UI runs.
*/
UI = 1,
/**
* Extension runs where the remote extension host runs.
*/
Workspace = 2
}
export interface EnvInit {
queryParams: QueryParameters;
language: string;
shell: string;
uiKind: UIKind;
appName: string;
appHost: string;
appRoot: string;
appUriScheme: string;
}
export interface PluginAPI {
}
export const PluginManager = Symbol.for('PluginManager');
export interface PluginManager {
getAllPlugins(): Plugin[];
getPluginById(pluginId: string): Plugin | undefined;
getPluginExport(pluginId: string): PluginAPI | undefined;
getPluginKind(): theia.ExtensionKind;
isRunning(pluginId: string): boolean;
isActive(pluginId: string): boolean;
activatePlugin(pluginId: string): PromiseLike<void>;
onDidChange: theia.Event<void>;
}
export interface PluginAPIFactory {
(plugin: Plugin): typeof theia;
}
export const emptyPlugin: Plugin = {
lifecycle: {
startMethod: 'empty',
stopMethod: 'empty'
},
model: {
id: 'emptyPlugin',
name: 'emptyPlugin',
publisher: 'Theia',
version: 'empty',
displayName: 'empty',
description: 'empty',
engine: {
type: 'empty',
version: 'empty'
},
packagePath: 'empty',
packageUri: 'empty',
entryPoint: {
}
},
pluginPath: 'empty',
pluginFolder: 'empty',
pluginUri: 'empty',
rawModel: {
name: 'emptyPlugin',
publisher: 'Theia',
version: 'empty',
displayName: 'empty',
description: 'empty',
engines: {
type: 'empty',
version: 'empty'
},
packagePath: 'empty'
},
isUnderDevelopment: false
};
export interface PluginManagerInitializeParams {
preferences: PreferenceData
globalState: KeysToKeysToAnyValue
workspaceState: KeysToKeysToAnyValue
env: EnvInit
pluginKind: ExtensionKind
extApi?: ExtPluginApi[]
webview: WebviewInitData
jsonValidation: PluginJsonValidationContribution[]
supportedActivationEvents?: string[]
}
export interface PluginManagerStartParams {
plugins: PluginMetadata[]
configStorage: ConfigStorage
activationEvents: string[]
}
export interface AbstractPluginManagerExt<P extends Record<string, any>> {
/** initialize the manager, should be called only once */
$init(params: P): Promise<void>;
/** load and activate plugins */
$start(params: PluginManagerStartParams): Promise<void>;
/** deactivate the plugin */
$stop(pluginId: string): Promise<void>;
/** deactivate all plugins */
$stop(): Promise<void>;
$updateStoragePath(path: string | undefined): Promise<void>;
$activateByEvent(event: string): Promise<void>;
$activatePlugin(id: string): Promise<void>;
}
export interface PluginManagerExt extends AbstractPluginManagerExt<PluginManagerInitializeParams> { }
export interface CommandRegistryMain {
$registerCommand(command: theia.CommandDescription): void;
$unregisterCommand(id: string): void;
$registerHandler(id: string): void;
$unregisterHandler(id: string): void;
$executeCommand<T>(id: string, ...args: any[]): PromiseLike<T | undefined>;
$getCommands(): PromiseLike<string[]>;
$getKeyBinding(commandId: string): PromiseLike<theia.CommandKeyBinding[] | undefined>;
registerArgumentProcessor(processor: ArgumentProcessor): void;
}
export interface CommandRegistryExt {
$executeCommand<T>(id: string, ...ars: any[]): PromiseLike<T | undefined>;
registerArgumentProcessor(processor: ArgumentProcessor): void;
}
export interface TerminalServiceExt {
$startProfile(providerId: string, cancellationToken: theia.CancellationToken): Promise<string>;
$terminalCreated(id: string, name: string): void;
$terminalNameChanged(id: string, name: string): void;
$terminalOpened(id: string, processId: number, terminalId: number, cols: number, rows: number): void;
$terminalClosed(id: string, exitStatus: theia.TerminalExitStatus | undefined): void;
$terminalOnInput(id: string, data: string): void;
$terminalSizeChanged(id: string, cols: number, rows: number): void;
$currentTerminalChanged(id: string | undefined): void;
$terminalStateChanged(id: string): void;
$initEnvironmentVariableCollections(collections: [string, string, boolean, SerializableEnvironmentVariableCollection][]): void;
$provideTerminalLinks(line: string, terminalId: string, token: theia.CancellationToken): Promise<ProvidedTerminalLink[]>;
$handleTerminalLink(link: ProvidedTerminalLink): Promise<void>;
getEnvironmentVariableCollection(extensionIdentifier: string): theia.GlobalEnvironmentVariableCollection;
$setShell(shell: string): void;
$reportOutputMatch(observerId: string, groups: string[]): void;
}
export interface OutputChannelRegistryExt {
createOutputChannel(name: string, pluginInfo: PluginInfo): theia.OutputChannel,
createOutputChannel(name: string, pluginInfo: PluginInfo, options: { log: true }): theia.LogOutputChannel
}
export interface ConnectionMain {
$createConnection(id: string): Promise<void>;
$deleteConnection(id: string): Promise<void>;
$sendMessage(id: string, message: string): void;
}
export interface ConnectionExt {
$createConnection(id: string): Promise<void>;
$deleteConnection(id: string): Promise<void>
$sendMessage(id: string, message: string): void;
}
export interface TerminalServiceMain {
/**
* Create new Terminal with Terminal options.
* @param options - object with parameters to create new terminal.
*/
$createTerminal(id: string, options: TerminalOptions, parentId?: string, isPseudoTerminal?: boolean): Promise<string>;
/**
* Send text to the terminal by id.
* @param id - terminal widget id.
* @param text - text content.
* @param shouldExecute - in case true - Indicates that the text being sent should be executed rather than just inserted in the terminal.
*/
$sendText(id: string, text: string, shouldExecute?: boolean): void;
/**
* Write data to the terminal by id.
* @param id - terminal widget id.
* @param data - data.
*/
$write(id: string, data: string): void;
/**
* Resize the terminal by id.
* @param id - terminal widget id.
* @param cols - columns.
* @param rows - rows.
*/
$resize(id: string, cols: number, rows: number): void;
/**
* Show terminal on the UI panel.
* @param id - terminal widget id.
* @param preserveFocus - set terminal focus in case true value, and don't set focus otherwise.
*/
$show(id: string, preserveFocus?: boolean): void;
/**
* Hide UI panel where is located terminal widget.
* @param id - terminal widget id.
*/
$hide(id: string): void;
/**
* Destroy terminal.
* @param id - terminal widget id.
*/
$dispose(id: string): void;
/**
* Set the terminal widget name.
* @param id terminal widget id.
* @param name new terminal widget name.
*/
$setName(id: string, name: string): void;
/**
* Send text to the terminal by id.
* @param id - terminal id.
* @param text - text content.
* @param addNewLine - in case true - add new line after the text, otherwise - don't apply new line.
*/
$sendTextByTerminalId(id: number, text: string, addNewLine?: boolean): void;
/**
* Write data to the terminal by id.
* @param id - terminal id.
* @param data - data.
*/
$writeByTerminalId(id: number, data: string): void;
/**
* Resize the terminal by id.
* @param id - terminal id.
* @param cols - columns.
* @param rows - rows.
*/
$resizeByTerminalId(id: number, cols: number, rows: number): void;
/**
* Show terminal on the UI panel.
* @param id - terminal id.
* @param preserveFocus - set terminal focus in case true value, and don't set focus otherwise.
*/
$showByTerminalId(id: number, preserveFocus?: boolean): void;
/**
* Hide UI panel where is located terminal widget.
* @param id - terminal id.
*/
$hideByTerminalId(id: number): void;
/**
* Destroy terminal.
* @param id - terminal id.
* @param waitOnExit - Whether to wait for a key press before closing the terminal.
*/
$disposeByTerminalId(id: number, waitOnExit?: boolean | string): void;
$setEnvironmentVariableCollection(persistent: boolean, extensionIdentifier: string, rootUri: string, collection: SerializableEnvironmentVariableCollection): void;
/**
* Set the terminal widget name.
* @param id terminal id.
* @param name new terminal widget name.
*/
$setNameByTerminalId(id: number, name: string): void;
/**
* Register a new terminal link provider.
* @param providerId id of the terminal link provider to be registered.
*/
$registerTerminalLinkProvider(providerId: string): Promise<void>;
/**
* Unregister the terminal link provider with the specified id.
* @param providerId id of the terminal link provider to be unregistered.
*/
$unregisterTerminalLinkProvider(providerId: string): Promise<void>;
/**
* Register a new terminal observer.
* @param providerId id of the terminal link provider to be registered.
* @param nrOfLinesToMatch the number of lines to match the outputMatcherRegex against
* @param outputMatcherRegex the regex to match the output to
*/
$registerTerminalObserver(id: string, nrOfLinesToMatch: number, outputMatcherRegex: string): unknown;
/**
* Unregister the terminal observer with the specified id.
* @param providerId id of the terminal observer to be unregistered.
*/
$unregisterTerminalObserver(id: string): unknown;
}
export interface TerminalOptions extends theia.TerminalOptions {
iconUrl?: string | { light: string; dark: string } | ThemeIcon;
}
export interface AutoFocus {
autoFocusFirstEntry?: boolean;
// TODO
}
export enum MainMessageType {
Error,
Warning,
Info
}
export interface MainMessageOptions {
detail?: string;
modal?: boolean
onCloseActionHandle?: number
}
export interface MainMessageItem {
title: string,
isCloseAffordance?: boolean;
handle?: number
}
export interface MessageRegistryMain {
$showMessage(type: MainMessageType, message: string, options: MainMessageOptions, actions: MainMessageItem[]): PromiseLike<number | undefined>;
}
export interface StatusBarMessageRegistryMain {
$setMessage(id: string,
name: string | undefined,
text: string | undefined,
priority: number,
alignment: theia.StatusBarAlignment,
color: string | undefined,
backgroundColor: string | undefined,
tooltip: string | theia.MarkdownString | undefined,
command: string | undefined,
accessibilityInformation: theia.AccessibilityInformation,
args: any[] | undefined): PromiseLike<void>;
$dispose(id: string): void;
}
export interface QuickOpenExt {
$onItemSelected(handle: number): void;
$validateInput(input: string): Promise<string | { content: string; severity: Severity; } | null | undefined>;
$acceptOnDidAccept(sessionId: number): Promise<void>;
$acceptDidChangeValue(sessionId: number, changedValue: string): Promise<void>;
$acceptOnDidHide(sessionId: number): Promise<void>;
$acceptOnDidTriggerButton(sessionId: number, btn: QuickInputButtonHandle): Promise<void>;
$onDidTriggerItemButton(sessionId: number, itemHandle: number, buttonHandle: number): void;
$onDidChangeActive(sessionId: number, handles: number[]): void;
$onDidChangeSelection(sessionId: number, handles: number[]): void;
/* eslint-disable max-len */
showQuickPick(plugin: Plugin, itemsOrItemsPromise: Array<theia.QuickPickItem> | Promise<Array<theia.QuickPickItem>>, options: theia.QuickPickOptions & { canPickMany: true; },
token?: theia.CancellationToken): Promise<Array<theia.QuickPickItem> | undefined>;
showQuickPick(plugin: Plugin, itemsOrItemsPromise: string[] | Promise<string[]>, options?: theia.QuickPickOptions, token?: theia.CancellationToken): Promise<string | undefined>;
showQuickPick(plugin: Plugin, itemsOrItemsPromise: Array<theia.QuickPickItem> | Promise<Array<theia.QuickPickItem>>, options?: theia.QuickPickOptions, token?: theia.CancellationToken): Promise<theia.QuickPickItem | undefined>;
showInput(options?: theia.InputBoxOptions, token?: theia.CancellationToken): PromiseLike<string | undefined>;
// showWorkspaceFolderPick(options?: theia.WorkspaceFolderPickOptions, token?: theia.CancellationToken): Promise<theia.WorkspaceFolder | undefined>
createQuickPick<T extends theia.QuickPickItem>(plugin: Plugin): theia.QuickPick<T>;
createInputBox(plugin: Plugin): theia.InputBox;
}
/**
* Options to configure the behaviour of a file open dialog.
*/
export interface OpenDialogOptionsMain {
/**
* Dialog title.
* This parameter might be ignored, as not all operating systems display a title on open dialogs.
*/
title?: string;
/**
* The resource the dialog shows when opened.
*/
defaultUri?: string;
/**
* A human-readable string for the open button.
*/
openLabel?: string;
/**
* Allow to select files, defaults to `true`.
*/
canSelectFiles?: boolean;
/**
* Allow to select folders, defaults to `false`.
*/
canSelectFolders?: boolean;
/**
* Allow to select many files or folders.
*/
canSelectMany?: boolean;
/**
* A set of file filters that are used by the dialog. Each entry is a human readable label,
* like "TypeScript", and an array of extensions, e.g.
* ```ts
* {
* 'Images': ['png', 'jpg']
* 'TypeScript': ['ts', 'tsx']
* }
* ```
*/
filters?: { [name: string]: string[] };
}
/**
* Options to configure the behaviour of a file save dialog.
*/
export interface SaveDialogOptionsMain {
/**
* Dialog title.
* This parameter might be ignored, as not all operating systems display a title on save dialogs.
*/
title?: string;
/**
* The resource the dialog shows when opened.
*/
defaultUri?: string;
/**
* A human-readable string for the save button.
*/
saveLabel?: string;
/**
* A set of file filters that are used by the dialog. Each entry is a human readable label,
* like "TypeScript", and an array of extensions, e.g.
* ```ts
* {
* 'Images': ['png', 'jpg']
* 'TypeScript': ['ts', 'tsx']
* }
* ```
*/
filters?: { [name: string]: string[] };
}
/**
* Options to configure the behaviour of a file upload dialog.
*/
export interface UploadDialogOptionsMain {
/**
* The resource, where files should be uploaded.
*/
defaultUri?: string;
}
export interface FileUploadResultMain {
uploaded: string[]
}
/**
* Options to configure the behaviour of the [workspace folder](#WorkspaceFolder) pick UI.
*/
export interface WorkspaceFolderPickOptionsMain {
/**
* An optional string to show as place holder in the input box to guide the user what to pick on.
*/
placeHolder?: string;
/**
* Set to `true` to keep the picker open when focus moves to another part of the editor or to another window.
*/
ignoreFocusOut?: boolean;
}
export interface TransferQuickPickItem {
handle: number;
kind: 'item' | 'separator',
label: string;
iconUrl?: string | { light: string; dark: string } | ThemeIcon;
description?: string;
detail?: string;
picked?: boolean;
alwaysShow?: boolean;
buttons?: readonly TransferQuickInputButton[];
}
export interface TransferQuickPickOptions<T extends TransferQuickPickItem> {
title?: string;
placeHolder?: string;
matchOnDescription?: boolean;
matchOnDetail?: boolean;
matchOnLabel?: boolean;
autoFocusOnList?: boolean;
ignoreFocusLost?: boolean;
canPickMany?: boolean;
contextKey?: string;
activeItem?: Promise<T> | T;
onDidFocus?: (entry: T) => void;
}
export interface TransferQuickInputButton {
handle?: number;
readonly iconUrl?: string | { light: string; dark: string } | ThemeIcon;
readonly tooltip?: string | undefined;
}
export type TransferQuickInput = TransferQuickPick | TransferInputBox;
export interface BaseTransferQuickInput {
[key: string]: any;
id: number;
type?: 'quickPick' | 'inputBox';
enabled?: boolean;
busy?: boolean;
visible?: boolean;
}
export interface TransferQuickPick extends BaseTransferQuickInput {
type?: 'quickPick';
value?: string;
placeholder?: string;
buttons?: TransferQuickInputButton[];
items?: TransferQuickPickItem[];
activeItems?: ReadonlyArray<theia.QuickPickItem>;
selectedItems?: ReadonlyArray<theia.QuickPickItem>;
canSelectMany?: boolean;
ignoreFocusOut?: boolean;
matchOnDescription?: boolean;
matchOnDetail?: boolean;
sortByLabel?: boolean;
}
export interface TransferInputBox extends BaseTransferQuickInput {
type?: 'inputBox';
value?: string;
placeholder?: string;
password?: boolean;
buttons?: TransferQuickInputButton[];
prompt?: string;
validationMessage?: string;
}
export interface IInputBoxOptions {
value?: string;
valueSelection?: [number, number];
prompt?: string;
placeHolder?: string;
password?: boolean;
ignoreFocusOut?: boolean;
}
export interface QuickOpenMain {
$show(instance: number, options: TransferQuickPickOptions<TransferQuickPickItem>, token: CancellationToken): Promise<number | number[] | undefined>;
$setItems(instance: number, items: TransferQuickPickItem[]): Promise<any>;
$setError(instance: number, error: Error): Promise<void>;
$input(options: theia.InputBoxOptions, validateInput: boolean, token: CancellationToken): Promise<string | undefined>;
$createOrUpdate<T extends theia.QuickPickItem>(params: TransferQuickInput): Promise<void>;
$dispose(id: number): Promise<void>;
$hide(): void;
$showInputBox(options: TransferInputBox, validateInput: boolean): Promise<string | undefined>;
}
export interface WorkspaceMain {
$pickWorkspaceFolder(options: WorkspaceFolderPickOptionsMain): Promise<theia.WorkspaceFolder | undefined>;
$startFileSearch(includePattern: string, includeFolder: string | undefined, excludePatternOrDisregardExcludes: string | false,
maxResults: number | undefined, token: theia.CancellationToken): PromiseLike<UriComponents[]>;
$findTextInFiles(query: theia.TextSearchQuery, options: theia.FindTextInFilesOptions, searchRequestId: number,
token?: theia.CancellationToken): Promise<theia.TextSearchComplete>
$registerTextDocumentContentProvider(scheme: string): Promise<void>;
$unregisterTextDocumentContentProvider(scheme: string): void;
$onTextDocumentContentChange(uri: string, content: string): void;
$updateWorkspaceFolders(start: number, deleteCount?: number, ...rootsToAdd: string[]): Promise<void>;
$getWorkspace(): Promise<files.FileStat | undefined>;
$requestWorkspaceTrust(options?: theia.WorkspaceTrustRequestOptions): Promise<boolean | undefined>;
$resolveProxy(url: string): Promise<string | undefined>;
$registerCanonicalUriProvider(scheme: string): Promise<void | undefined>;
$unregisterCanonicalUriProvider(scheme: string): void;
$getCanonicalUri(uri: string, targetScheme: string, token: theia.CancellationToken): Promise<string | undefined>;
}
export interface WorkspaceExt {
$onWorkspaceFoldersChanged(event: WorkspaceRootsChangeEvent): void;
$onWorkspaceLocationChanged(event: files.FileStat | undefined): void;
$provideTextDocumentContent(uri: string): Promise<string | undefined | null>;
$onTextSearchResult(searchRequestId: number, done: boolean, result?: SearchInWorkspaceResult): void;
$onWorkspaceTrustChanged(trust: boolean | undefined): void;
$registerEditSessionIdentityProvider(scheme: string, provider: theia.EditSessionIdentityProvider): theia.Disposable;
registerCanonicalUriProvider(scheme: string, provider: theia.CanonicalUriProvider): theia.Disposable;
$disposeCanonicalUriProvider(scheme: string): void;
getCanonicalUri(uri: theia.Uri, options: theia.CanonicalUriRequestOptions, token: CancellationToken): theia.ProviderResult<theia.Uri>;
$provideCanonicalUri(uri: string, targetScheme: string, token: CancellationToken): Promise<string | undefined>;
}
export interface TimelineExt {
$getTimeline(source: string, uri: UriComponents, options: theia.TimelineOptions, internalOptions?: InternalTimelineOptions): Promise<Timeline | undefined>;
}
export interface TimelineMain {
$registerTimelineProvider(provider: TimelineProviderDescriptor): Promise<void>;
$fireTimelineChanged(e: TimelineChangeEvent): Promise<void>;
$unregisterTimelineProvider(source: string): Promise<void>;
}
export interface ThemingExt {
$onColorThemeChange(type: ThemeType): void;
}
export interface ThemingMain extends Disposable {
}
export interface DialogsMain {
$showOpenDialog(options: OpenDialogOptionsMain): Promise<string[] | undefined>;
$showSaveDialog(options: SaveDialogOptionsMain): Promise<string | undefined>;
$showUploadDialog(options: UploadDialogOptionsMain): Promise<string[] | undefined>;
}
export interface RegisterTreeDataProviderOptions {
manageCheckboxStateManually?: boolean;
showCollapseAll?: boolean
canSelectMany?: boolean
dragMimeTypes?: string[]
dropMimeTypes?: string[]
}
export interface TreeViewRevealOptions {
readonly select: boolean
readonly focus: boolean
readonly expand: boolean | number
}
export interface TreeViewsMain {
$registerTreeDataProvider(treeViewId: string, options?: RegisterTreeDataProviderOptions): void;
$readDroppedFile(contentId: string): Promise<BinaryBuffer>;
$unregisterTreeDataProvider(treeViewId: string): void;
$refresh(treeViewId: string): Promise<void>;
$reveal(treeViewId: string, elementParentChain: string[], options: TreeViewRevealOptions): Promise<any>;
$setMessage(treeViewId: string, message: string): void;
$setTitle(treeViewId: string, title: string): void;
$setDescription(treeViewId: string, description: string): void;
$setBadge(treeViewId: string, badge: theia.ViewBadge | undefined): void;
}
export class DataTransferFileDTO {
constructor(readonly name: string, readonly contentId: string, readonly uri?: UriComponents) { }
static is(value: string | DataTransferFileDTO): value is DataTransferFileDTO {
return !(typeof value === 'string');
}
}
export interface TreeViewsExt {
$checkStateChanged(treeViewId: string, itemIds: { id: string, checked: boolean }[]): Promise<void>;
$dragStarted(treeViewId: string, treeItemIds: string[], token: CancellationToken): Promise<UriComponents[] | undefined>;
$dragEnd(treeViewId: string): Promise<void>;
$drop(treeViewId: string, treeItemId: string | undefined, dataTransferItems: [string, string | DataTransferFileDTO][], token: CancellationToken): Promise<void>;
$getChildren(treeViewId: string, treeItemId: string | undefined): Promise<TreeViewItem[] | undefined>;
$hasResolveTreeItem(treeViewId: string): Promise<boolean>;
$resolveTreeItem(treeViewId: string, treeItemId: string, token: CancellationToken): Promise<TreeViewItem | undefined>;
$setExpanded(treeViewId: string, treeItemId: string, expanded: boolean): Promise<any>;
$setSelection(treeViewId: string, treeItemIds: string[]): Promise<void>;
$setVisible(treeViewId: string, visible: boolean): Promise<void>;
}
export interface TreeViewItemCheckboxInfo {
checked: boolean;
tooltip?: string;
accessibilityInformation?: AccessibilityInformation
}
export interface TreeViewItem {
id: string;
label: string;
/** Label highlights given as tuples of inclusive start index and exclusive end index. */
highlights?: [number, number][];
description?: string | boolean;
/* font-awesome icon for compatibility */
icon?: string;
iconUrl?: IconUrl;
themeIcon?: ThemeIcon;
resourceUri?: UriComponents;
tooltip?: string | MarkdownString;
collapsibleState?: TreeViewItemCollapsibleState;
checkboxInfo?: TreeViewItemCheckboxInfo;
contextValue?: string;
command?: Command;
accessibilityInformation?: theia.AccessibilityInformation;
}
export interface TreeViewItemReference {
viewId: string
itemId: string
}
export namespace TreeViewItemReference {
export function is(arg: unknown): arg is TreeViewItemReference {
return isObject(arg) && isString(arg.viewId) && isString(arg.itemId);
}
}
/**
* Collapsible state of the tree item
*/
export enum TreeViewItemCollapsibleState {
/**
* Determines an item can be neither collapsed nor expanded. Implies it has no children.
*/
None = 0,
/**
* Determines an item is collapsed
*/
Collapsed = 1,
/**
* Determines an item is expanded
*/
Expanded = 2
}
export interface WindowMain {
$openUri(uri: UriComponents): Promise<boolean>;
$asExternalUri(uri: UriComponents): Promise<UriComponents>;
}
export interface WindowStateExt {
$onDidChangeWindowFocus(focused: boolean): void;
$onDidChangeWindowActive(active: boolean): void;
}
export interface NotificationExt {
withProgress<R>(
options: ProgressOptions,
task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => PromiseLike<R>
): PromiseLike<R>;
$acceptProgressCanceled(progressId: string): void;
}
export interface ScmCommandArg {
sourceControlHandle: number
resourceGroupHandle?: number
resourceStateHandle?: number
}
export namespace ScmCommandArg {
export function is(arg: unknown): arg is ScmCommandArg {
return isObject(arg) && 'sourceControlHandle' in arg;
}
}
export interface ScmExt {
createSourceControl(plugin: Plugin, id: string, label: string, rootUri?: theia.Uri): theia.SourceControl;
getLastInputBox(plugin: Plugin): theia.SourceControlInputBox | undefined;
$onInputBoxValueChange(sourceControlHandle: number, message: string): Promise<void>;
$executeResourceCommand(sourceControlHandle: number, groupHandle: number, resourceHandle: number): Promise<void>;
$validateInput(sourceControlHandle: number, value: string, cursorPosition: number): Promise<[string, number] | undefined>;
$setSelectedSourceControl(selectedSourceControlHandle: number | undefined): Promise<void>;
$provideOriginalResource(sourceControlHandle: number, uri: string, token: theia.CancellationToken): Promise<UriComponents | undefined>;
}
export namespace TimelineCommandArg {
export function is(arg: unknown): arg is TimelineCommandArg {
return isObject(arg) && 'timelineHandle' in arg;
}
}
export interface TimelineCommandArg {
timelineHandle: string;
source: string;
uri: string;
}
export interface DecorationRequest {
readonly id: number;
readonly uri: UriComponents;
}
export type DecorationData = [boolean, string, string, ThemeColor];
export interface DecorationReply { [id: number]: DecorationData; }
export namespace CommentsCommandArg {
export function is(arg: unknown): arg is CommentsCommandArg {
return isObject(arg) && 'commentControlHandle' in arg && 'commentThreadHandle' in arg && 'text' in arg && !('commentUniqueId' in arg);
}
}
export interface CommentsCommandArg {
commentControlHandle: number;
commentThreadHandle: number;
text: string
}
export namespace CommentsContextCommandArg {
export function is(arg: unknown): arg is CommentsContextCommandArg {
return isObject(arg) && 'commentControlHandle' in arg && 'commentThreadHandle' in arg && 'commentUniqueId' in arg && !('text' in arg);
}
}
export interface CommentsContextCommandArg {
commentControlHandle: number;
commentThreadHandle: number;
commentUniqueId: number
}
export namespace CommentsEditCommandArg {
export function is(arg: unknown): arg is CommentsEditCommandArg {
return isObject(arg) && 'commentControlHandle' in arg && 'commentThreadHandle' in arg && 'commentUniqueId' in arg && 'text' in arg;
}
}
export interface CommentsEditCommandArg {
commentControlHandle: number;
commentThreadHandle: number;
commentUniqueId: number
text: string