@theia/plugin 1.23.0-next.5 → 1.23.0-next.54
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/package.json +2 -2
- package/src/package.spec.ts +15 -15
- package/src/theia-proposed.d.ts +15 -21
- package/src/theia.d.ts +344 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/plugin",
|
|
3
|
-
"version": "1.23.0-next.
|
|
3
|
+
"version": "1.23.0-next.54+92b376dcf82",
|
|
4
4
|
"description": "Theia - Plugin API",
|
|
5
5
|
"types": "./src/theia.d.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"nyc": {
|
|
33
33
|
"extends": "../../configs/nyc.json"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "92b376dcf823293059e2023a2a03253b48352d80"
|
|
36
36
|
}
|
package/src/package.spec.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
16
|
|
|
17
17
|
/* note: this bogus test file is required so that
|
|
18
18
|
we are able to run mocha unit tests on this
|
package/src/theia-proposed.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
16
|
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
18
|
|
|
@@ -81,12 +81,6 @@ export module '@theia/plugin' {
|
|
|
81
81
|
*/
|
|
82
82
|
readonly supportsMultipleAccounts: boolean;
|
|
83
83
|
|
|
84
|
-
/**
|
|
85
|
-
* An [event](#Event) which fires when the array of sessions has changed, or data
|
|
86
|
-
* within a session has changed.
|
|
87
|
-
*/
|
|
88
|
-
readonly onDidChangeSessions: Event<AuthenticationProviderAuthenticationSessionsChangeEvent>;
|
|
89
|
-
|
|
90
84
|
/**
|
|
91
85
|
* Returns an array of current sessions.
|
|
92
86
|
*/
|
package/src/theia.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
16
|
|
|
17
17
|
// This file is heavily inspired by VSCode 'vscode.d.ts' - https://github.com/Microsoft/vscode/blob/master/src/vs/vscode.d.ts
|
|
18
18
|
// 'vscode.d.ts' copyright:
|
|
@@ -3988,6 +3988,87 @@ export module '@theia/plugin' {
|
|
|
3988
3988
|
|
|
3989
3989
|
}
|
|
3990
3990
|
|
|
3991
|
+
export interface WebviewView {
|
|
3992
|
+
/**
|
|
3993
|
+
* Identifies the type of the webview view, such as `'hexEditor.dataView'`.
|
|
3994
|
+
*/
|
|
3995
|
+
readonly viewType: string;
|
|
3996
|
+
|
|
3997
|
+
/**
|
|
3998
|
+
* The underlying webview for the view.
|
|
3999
|
+
*/
|
|
4000
|
+
readonly webview: Webview;
|
|
4001
|
+
|
|
4002
|
+
/**
|
|
4003
|
+
* View title displayed in the UI.
|
|
4004
|
+
*
|
|
4005
|
+
* The view title is initially taken from the extension `package.json` contribution.
|
|
4006
|
+
*/
|
|
4007
|
+
title?: string;
|
|
4008
|
+
|
|
4009
|
+
/**
|
|
4010
|
+
* Human-readable string which is rendered less prominently in the title.
|
|
4011
|
+
*/
|
|
4012
|
+
description?: string;
|
|
4013
|
+
|
|
4014
|
+
/**
|
|
4015
|
+
* Event fired when the view is disposed.
|
|
4016
|
+
*
|
|
4017
|
+
* Views are disposed when they are explicitly hidden by a user (this happens when a user
|
|
4018
|
+
* right clicks in a view and unchecks the webview view).
|
|
4019
|
+
*
|
|
4020
|
+
* Trying to use the view after it has been disposed throws an exception.
|
|
4021
|
+
*/
|
|
4022
|
+
readonly onDidDispose: Event<void>;
|
|
4023
|
+
|
|
4024
|
+
/**
|
|
4025
|
+
* Tracks if the webview is currently visible.
|
|
4026
|
+
*
|
|
4027
|
+
* Views are visible when they are on the screen and expanded.
|
|
4028
|
+
*/
|
|
4029
|
+
readonly visible: boolean;
|
|
4030
|
+
|
|
4031
|
+
/**
|
|
4032
|
+
* Event fired when the visibility of the view changes.
|
|
4033
|
+
*
|
|
4034
|
+
* Actions that trigger a visibility change:
|
|
4035
|
+
*
|
|
4036
|
+
* - The view is collapsed or expanded.
|
|
4037
|
+
* - The user switches to a different view group in the sidebar or panel.
|
|
4038
|
+
*
|
|
4039
|
+
* Note that hiding a view using the context menu instead disposes of the view and fires `onDidDispose`.
|
|
4040
|
+
*/
|
|
4041
|
+
readonly onDidChangeVisibility: Event<boolean>;
|
|
4042
|
+
|
|
4043
|
+
/**
|
|
4044
|
+
* Reveal the view in the UI.
|
|
4045
|
+
*
|
|
4046
|
+
* If the view is collapsed, this will expand it.
|
|
4047
|
+
*
|
|
4048
|
+
* @param preserveFocus When `true` the view will not take focus.
|
|
4049
|
+
*/
|
|
4050
|
+
show(preserveFocus?: boolean): void;
|
|
4051
|
+
}
|
|
4052
|
+
/**
|
|
4053
|
+
* Provider for creating `WebviewView` elements.
|
|
4054
|
+
*/
|
|
4055
|
+
export interface WebviewViewProvider {
|
|
4056
|
+
/**
|
|
4057
|
+
* Revolves a webview view.
|
|
4058
|
+
*
|
|
4059
|
+
* `resolveWebviewView` is called when a view first becomes visible. This may happen when the view is
|
|
4060
|
+
* first loaded or when the user hides and then shows a view again.
|
|
4061
|
+
*
|
|
4062
|
+
* @param webviewView Webview view to restore. The provider should take ownership of this view. The
|
|
4063
|
+
* provider must set the webview's `.html` and hook up all webview events it is interested in.
|
|
4064
|
+
* @param context Additional metadata about the view being resolved.
|
|
4065
|
+
* @param token Cancellation token indicating that the view being provided is no longer needed.
|
|
4066
|
+
*
|
|
4067
|
+
* @return Optional thenable indicating that the view has been fully resolved.
|
|
4068
|
+
*/
|
|
4069
|
+
resolveWebviewView(webviewView: WebviewView, context: WebviewViewResolveContext, token: CancellationToken): Thenable<void> | void;
|
|
4070
|
+
}
|
|
4071
|
+
|
|
3991
4072
|
/**
|
|
3992
4073
|
* Common namespace for dealing with window and editor, showing messages and user input.
|
|
3993
4074
|
*/
|
|
@@ -4321,6 +4402,70 @@ export module '@theia/plugin' {
|
|
|
4321
4402
|
* @param viewType Type of the webview panel that can be serialized.
|
|
4322
4403
|
* @param serializer Webview serializer.
|
|
4323
4404
|
*/
|
|
4405
|
+
|
|
4406
|
+
/**
|
|
4407
|
+
* Additional information the webview view being resolved.
|
|
4408
|
+
*
|
|
4409
|
+
* @param T Type of the webview's state.
|
|
4410
|
+
*/
|
|
4411
|
+
interface WebviewViewResolveContext<T = unknown> {
|
|
4412
|
+
/**
|
|
4413
|
+
* Persisted state from the webview content.
|
|
4414
|
+
*
|
|
4415
|
+
* To save resources, VS Code normally deallocates webview documents (the iframe content) that are not visible.
|
|
4416
|
+
* For example, when the user collapse a view or switches to another top level activity in the sidebar, the
|
|
4417
|
+
* `WebviewView` itself is kept alive but the webview's underlying document is deallocated. It is recreated when
|
|
4418
|
+
* the view becomes visible again.
|
|
4419
|
+
*
|
|
4420
|
+
* You can prevent this behavior by setting `retainContextWhenHidden` in the `WebviewOptions`. However this
|
|
4421
|
+
* increases resource usage and should be avoided wherever possible. Instead, you can use persisted state to
|
|
4422
|
+
* save off a webview's state so that it can be quickly recreated as needed.
|
|
4423
|
+
*
|
|
4424
|
+
* To save off a persisted state, inside the webview call `acquireVsCodeApi().setState()` with
|
|
4425
|
+
* any json serializable object. To restore the state again, call `getState()`. For example:
|
|
4426
|
+
*
|
|
4427
|
+
* ```js
|
|
4428
|
+
* // Within the webview
|
|
4429
|
+
* const vscode = acquireVsCodeApi();
|
|
4430
|
+
*
|
|
4431
|
+
* // Get existing state
|
|
4432
|
+
* const oldState = vscode.getState() || { value: 0 };
|
|
4433
|
+
*
|
|
4434
|
+
* // Update state
|
|
4435
|
+
* setState({ value: oldState.value + 1 })
|
|
4436
|
+
* ```
|
|
4437
|
+
*
|
|
4438
|
+
* VS Code ensures that the persisted state is saved correctly when a webview is hidden and across
|
|
4439
|
+
* editor restarts.
|
|
4440
|
+
*/
|
|
4441
|
+
readonly state: T | undefined;
|
|
4442
|
+
}
|
|
4443
|
+
|
|
4444
|
+
export function registerWebviewViewProvider(viewId: string, provider: WebviewViewProvider, options?: {
|
|
4445
|
+
/**
|
|
4446
|
+
* Content settings for the webview created for this view.
|
|
4447
|
+
*/
|
|
4448
|
+
readonly webviewOptions?: {
|
|
4449
|
+
/**
|
|
4450
|
+
* Controls if the webview element itself (iframe) is kept around even when the view
|
|
4451
|
+
* is no longer visible.
|
|
4452
|
+
*
|
|
4453
|
+
* Normally the webview's html context is created when the view becomes visible
|
|
4454
|
+
* and destroyed when it is hidden. Extensions that have complex state
|
|
4455
|
+
* or UI can set the `retainContextWhenHidden` to make the editor keep the webview
|
|
4456
|
+
* context around, even when the webview moves to a background tab. When a webview using
|
|
4457
|
+
* `retainContextWhenHidden` becomes hidden, its scripts and other dynamic content are suspended.
|
|
4458
|
+
* When the view becomes visible again, the context is automatically restored
|
|
4459
|
+
* in the exact same state it was in originally. You cannot send messages to a
|
|
4460
|
+
* hidden webview, even with `retainContextWhenHidden` enabled.
|
|
4461
|
+
*
|
|
4462
|
+
* `retainContextWhenHidden` has a high memory overhead and should only be used if
|
|
4463
|
+
* your view's context cannot be quickly saved and restored.
|
|
4464
|
+
*/
|
|
4465
|
+
readonly retainContextWhenHidden?: boolean;
|
|
4466
|
+
};
|
|
4467
|
+
}): Disposable;
|
|
4468
|
+
|
|
4324
4469
|
export function registerWebviewPanelSerializer(viewType: string, serializer: WebviewPanelSerializer): Disposable;
|
|
4325
4470
|
|
|
4326
4471
|
/**
|
|
@@ -4408,7 +4553,7 @@ export module '@theia/plugin' {
|
|
|
4408
4553
|
export function setStatusBarMessage(text: string, hideWhenDone: PromiseLike<any>): Disposable;
|
|
4409
4554
|
|
|
4410
4555
|
/**
|
|
4411
|
-
* Creates a status bar
|
|
4556
|
+
* Creates a status bar {@link StatusBarItem item}.
|
|
4412
4557
|
*
|
|
4413
4558
|
* @param alignment The alignment of the item.
|
|
4414
4559
|
* @param priority The priority of the item. Higher values mean the item should be shown more to the left.
|
|
@@ -4416,6 +4561,16 @@ export module '@theia/plugin' {
|
|
|
4416
4561
|
*/
|
|
4417
4562
|
export function createStatusBarItem(alignment?: StatusBarAlignment, priority?: number): StatusBarItem;
|
|
4418
4563
|
|
|
4564
|
+
/**
|
|
4565
|
+
* Creates a status bar {@link StatusBarItem item}.
|
|
4566
|
+
*
|
|
4567
|
+
* @param id The unique identifier of the item.
|
|
4568
|
+
* @param alignment The alignment of the item.
|
|
4569
|
+
* @param priority The priority of the item. Higher values mean the item should be shown more to the left.
|
|
4570
|
+
* @return A new status bar item.
|
|
4571
|
+
*/
|
|
4572
|
+
export function createStatusBarItem(id: string, alignment?: StatusBarAlignment, priority?: number): StatusBarItem;
|
|
4573
|
+
|
|
4419
4574
|
/**
|
|
4420
4575
|
* Create a new [output channel](#OutputChannel) with the given name.
|
|
4421
4576
|
*
|
|
@@ -4462,7 +4617,7 @@ export module '@theia/plugin' {
|
|
|
4462
4617
|
* @param options ExtensionTerminalOptions.
|
|
4463
4618
|
* @return A new Terminal.
|
|
4464
4619
|
*/
|
|
4465
|
-
|
|
4620
|
+
export function createTerminal(options: ExtensionTerminalOptions): Terminal;
|
|
4466
4621
|
|
|
4467
4622
|
/**
|
|
4468
4623
|
* Register a [TreeDataProvider](#TreeDataProvider) for the view contributed using the extension point `views`.
|
|
@@ -6049,6 +6204,28 @@ export module '@theia/plugin' {
|
|
|
6049
6204
|
* @return A [disposable](#Disposable) that unregisters this provider when being disposed.
|
|
6050
6205
|
*/
|
|
6051
6206
|
export function registerTaskProvider(type: string, provider: TaskProvider): Disposable;
|
|
6207
|
+
|
|
6208
|
+
/**
|
|
6209
|
+
* When true, the user has explicitly trusted the contents of the workspace.
|
|
6210
|
+
*/
|
|
6211
|
+
export const isTrusted: boolean;
|
|
6212
|
+
|
|
6213
|
+
export function requestWorkspaceTrust(options?: WorkspaceTrustRequestOptions): Promise<boolean | undefined>;
|
|
6214
|
+
|
|
6215
|
+
/**
|
|
6216
|
+
* Event that fires when the current workspace has been trusted.
|
|
6217
|
+
*/
|
|
6218
|
+
export const onDidGrantWorkspaceTrust: Event<void>;
|
|
6219
|
+
}
|
|
6220
|
+
|
|
6221
|
+
export interface WorkspaceTrustRequestButton {
|
|
6222
|
+
readonly label: string;
|
|
6223
|
+
readonly type: 'ContinueWithTrust' | 'ContinueWithoutTrust' | 'Manage' | 'Cancel'
|
|
6224
|
+
}
|
|
6225
|
+
|
|
6226
|
+
export interface WorkspaceTrustRequestOptions {
|
|
6227
|
+
readonly buttons?: WorkspaceTrustRequestButton[];
|
|
6228
|
+
readonly message?: string;
|
|
6052
6229
|
}
|
|
6053
6230
|
|
|
6054
6231
|
export namespace env {
|
|
@@ -7659,6 +7836,22 @@ export module '@theia/plugin' {
|
|
|
7659
7836
|
context: CodeActionContext,
|
|
7660
7837
|
token: CancellationToken | undefined
|
|
7661
7838
|
): ProviderResult<(Command | CodeAction)[]>;
|
|
7839
|
+
|
|
7840
|
+
/**
|
|
7841
|
+
* Given a code action fill in its `edit`-property. Changes to
|
|
7842
|
+
* all other properties, like title, are ignored. A code action that has an edit
|
|
7843
|
+
* will not be resolved.
|
|
7844
|
+
*
|
|
7845
|
+
* *Note* that a code action provider that returns commands, not code actions, cannot successfully
|
|
7846
|
+
* implement this function. Returning commands is deprecated and instead code actions should be
|
|
7847
|
+
* returned.
|
|
7848
|
+
*
|
|
7849
|
+
* @param codeAction A code action.
|
|
7850
|
+
* @param token A cancellation token.
|
|
7851
|
+
* @return The resolved code action or a thenable that resolves to such. It is OK to return the given
|
|
7852
|
+
* `item`. When no result is returned, the given `item` will be used.
|
|
7853
|
+
*/
|
|
7854
|
+
resolveCodeAction?(codeAction: CodeAction, token: CancellationToken | undefined): ProviderResult<CodeAction>;
|
|
7662
7855
|
}
|
|
7663
7856
|
|
|
7664
7857
|
/**
|
|
@@ -11017,6 +11210,28 @@ export module '@theia/plugin' {
|
|
|
11017
11210
|
* Defaults to false.
|
|
11018
11211
|
*/
|
|
11019
11212
|
clearSessionPreference?: boolean;
|
|
11213
|
+
|
|
11214
|
+
/**
|
|
11215
|
+
* Whether we should attempt to reauthenticate even if there is already a session available.
|
|
11216
|
+
*
|
|
11217
|
+
* If true, a modal dialog will be shown asking the user to sign in again. This is mostly used for scenarios
|
|
11218
|
+
* where the token needs to be re minted because it has lost some authorization.
|
|
11219
|
+
*
|
|
11220
|
+
* Defaults to false.
|
|
11221
|
+
*/
|
|
11222
|
+
forceNewSession?: boolean | { detail: string };
|
|
11223
|
+
|
|
11224
|
+
/**
|
|
11225
|
+
* Whether we should show the indication to sign in in the Accounts menu.
|
|
11226
|
+
*
|
|
11227
|
+
* If false, the user will be shown a badge on the Accounts menu with an option to sign in for the extension.
|
|
11228
|
+
* If true, no indication will be shown.
|
|
11229
|
+
*
|
|
11230
|
+
* Defaults to false.
|
|
11231
|
+
*
|
|
11232
|
+
* Note: you cannot use this option with any other options that prompt the user like {@link createIfNone}.
|
|
11233
|
+
*/
|
|
11234
|
+
silent?: boolean;
|
|
11020
11235
|
}
|
|
11021
11236
|
|
|
11022
11237
|
/**
|
|
@@ -11044,6 +11259,83 @@ export module '@theia/plugin' {
|
|
|
11044
11259
|
readonly provider: AuthenticationProviderInformation;
|
|
11045
11260
|
}
|
|
11046
11261
|
|
|
11262
|
+
/**
|
|
11263
|
+
* Options for creating an {@link AuthenticationProvider}.
|
|
11264
|
+
*/
|
|
11265
|
+
export interface AuthenticationProviderOptions {
|
|
11266
|
+
/**
|
|
11267
|
+
* Whether it is possible to be signed into multiple accounts at once with this provider.
|
|
11268
|
+
* If not specified, will default to false.
|
|
11269
|
+
*/
|
|
11270
|
+
readonly supportsMultipleAccounts?: boolean;
|
|
11271
|
+
}
|
|
11272
|
+
|
|
11273
|
+
/**
|
|
11274
|
+
* An {@link Event} which fires when an {@link AuthenticationSession} is added, removed, or changed.
|
|
11275
|
+
*/
|
|
11276
|
+
export interface AuthenticationProviderAuthenticationSessionsChangeEvent {
|
|
11277
|
+
/**
|
|
11278
|
+
* The {@link AuthenticationSession AuthenticationSessions} of the {@link AuthenticationProvider} that have been added.
|
|
11279
|
+
*/
|
|
11280
|
+
readonly added: readonly AuthenticationSession[] | undefined;
|
|
11281
|
+
|
|
11282
|
+
/**
|
|
11283
|
+
* The {@link AuthenticationSession AuthenticationSessions} of the {@link AuthenticationProvider} that have been removed.
|
|
11284
|
+
*/
|
|
11285
|
+
readonly removed: readonly AuthenticationSession[] | undefined;
|
|
11286
|
+
|
|
11287
|
+
/**
|
|
11288
|
+
* The {@link AuthenticationSession AuthenticationSessions} of the {@link AuthenticationProvider} that have been changed.
|
|
11289
|
+
* A session changes when its data excluding the id are updated. An example of this is a session refresh that results in a new
|
|
11290
|
+
* access token being set for the session.
|
|
11291
|
+
*/
|
|
11292
|
+
readonly changed: readonly AuthenticationSession[] | undefined;
|
|
11293
|
+
}
|
|
11294
|
+
|
|
11295
|
+
/**
|
|
11296
|
+
* A provider for performing authentication to a service.
|
|
11297
|
+
*/
|
|
11298
|
+
export interface AuthenticationProvider {
|
|
11299
|
+
/**
|
|
11300
|
+
* An {@link Event} which fires when the array of sessions has changed, or data
|
|
11301
|
+
* within a session has changed.
|
|
11302
|
+
*/
|
|
11303
|
+
readonly onDidChangeSessions: Event<AuthenticationProviderAuthenticationSessionsChangeEvent>;
|
|
11304
|
+
|
|
11305
|
+
/**
|
|
11306
|
+
* Get a list of sessions.
|
|
11307
|
+
* @param scopes An optional list of scopes. If provided, the sessions returned should match
|
|
11308
|
+
* these permissions, otherwise all sessions should be returned.
|
|
11309
|
+
* @returns A promise that resolves to an array of authentication sessions.
|
|
11310
|
+
*/
|
|
11311
|
+
getSessions(scopes?: readonly string[]): Thenable<readonly AuthenticationSession[]>;
|
|
11312
|
+
|
|
11313
|
+
/**
|
|
11314
|
+
* Prompts a user to login.
|
|
11315
|
+
*
|
|
11316
|
+
* If login is successful, the onDidChangeSessions event should be fired.
|
|
11317
|
+
*
|
|
11318
|
+
* If login fails, a rejected promise should be returned.
|
|
11319
|
+
*
|
|
11320
|
+
* If the provider has specified that it does not support multiple accounts,
|
|
11321
|
+
* then this should never be called if there is already an existing session matching these
|
|
11322
|
+
* scopes.
|
|
11323
|
+
* @param scopes A list of scopes, permissions, that the new session should be created with.
|
|
11324
|
+
* @returns A promise that resolves to an authentication session.
|
|
11325
|
+
*/
|
|
11326
|
+
createSession(scopes: readonly string[]): Thenable<AuthenticationSession>;
|
|
11327
|
+
|
|
11328
|
+
/**
|
|
11329
|
+
* Removes the session corresponding to session id.
|
|
11330
|
+
*
|
|
11331
|
+
* If the removal is successful, the onDidChangeSessions event should be fired.
|
|
11332
|
+
*
|
|
11333
|
+
* If a session cannot be removed, the provider should reject with an error message.
|
|
11334
|
+
* @param sessionId The id of the session to remove.
|
|
11335
|
+
*/
|
|
11336
|
+
removeSession(sessionId: string): Thenable<void>;
|
|
11337
|
+
}
|
|
11338
|
+
|
|
11047
11339
|
/**
|
|
11048
11340
|
* Namespace for authentication.
|
|
11049
11341
|
*/
|
|
@@ -11063,6 +11355,21 @@ export module '@theia/plugin' {
|
|
|
11063
11355
|
*/
|
|
11064
11356
|
export function getSession(providerId: string, scopes: string[], options: AuthenticationGetSessionOptions & { createIfNone: true }): Thenable<AuthenticationSession>;
|
|
11065
11357
|
|
|
11358
|
+
/**
|
|
11359
|
+
* Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
|
|
11360
|
+
* registered, or if the user does not consent to sharing authentication information with
|
|
11361
|
+
* the extension. If there are multiple sessions with the same scopes, the user will be shown a
|
|
11362
|
+
* quickpick to select which account they would like to use.
|
|
11363
|
+
*
|
|
11364
|
+
* Currently, there are only two authentication providers that are contributed from built in extensions
|
|
11365
|
+
* to the editor that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.
|
|
11366
|
+
* @param providerId The id of the provider to use
|
|
11367
|
+
* @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
|
|
11368
|
+
* @param options The {@link AuthenticationGetSessionOptions} to use
|
|
11369
|
+
* @returns A thenable that resolves to an authentication session
|
|
11370
|
+
*/
|
|
11371
|
+
export function getSession(providerId: string, scopes: readonly string[], options: AuthenticationGetSessionOptions & { forceNewSession: true | { detail: string } }): Thenable<AuthenticationSession>;
|
|
11372
|
+
|
|
11066
11373
|
/**
|
|
11067
11374
|
* Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
|
|
11068
11375
|
* registered, or if the user does not consent to sharing authentication information with
|
|
@@ -11081,5 +11388,25 @@ export module '@theia/plugin' {
|
|
|
11081
11388
|
* been added, removed, or changed.
|
|
11082
11389
|
*/
|
|
11083
11390
|
export const onDidChangeSessions: Event<AuthenticationSessionsChangeEvent>;
|
|
11391
|
+
|
|
11392
|
+
/**
|
|
11393
|
+
* Register an authentication provider.
|
|
11394
|
+
*
|
|
11395
|
+
* There can only be one provider per id and an error is being thrown when an id
|
|
11396
|
+
* has already been used by another provider. Ids are case-sensitive.
|
|
11397
|
+
*
|
|
11398
|
+
* @param id The unique identifier of the provider.
|
|
11399
|
+
* @param label The human-readable name of the provider.
|
|
11400
|
+
* @param provider The authentication provider provider.
|
|
11401
|
+
* @params options Additional options for the provider.
|
|
11402
|
+
* @return A {@link Disposable} that unregisters this provider when being disposed.
|
|
11403
|
+
*/
|
|
11404
|
+
export function registerAuthenticationProvider(id: string, label: string, provider: AuthenticationProvider, options?: AuthenticationProviderOptions): Disposable;
|
|
11405
|
+
|
|
11406
|
+
/**
|
|
11407
|
+
* @deprecated Use {@link getSession()} {@link AuthenticationGetSessionOptions.silent} instead.
|
|
11408
|
+
*/
|
|
11409
|
+
export function hasSession(providerId: string, scopes: readonly string[]): Thenable<boolean>;
|
|
11410
|
+
|
|
11084
11411
|
}
|
|
11085
11412
|
}
|