forked from microsoft/vscode-pull-request-github
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvscode.proposed.shareProvider.d.ts
74 lines (61 loc) · 2.25 KB
/
vscode.proposed.shareProvider.d.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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// https://github.com/microsoft/vscode/issues/176316 @joyceerhl
declare module 'vscode' {
/**
* Data about an item which can be shared.
*/
export interface ShareableItem {
/**
* A resource in the workspace that can be shared.
*/
resourceUri: Uri;
/**
* If present, a selection within the `resourceUri`.
*/
selection?: Range;
}
/**
* A provider which generates share links for resources in the editor.
*/
export interface ShareProvider {
/**
* A unique ID for the provider.
* This will be used to activate specific extensions contributing share providers if necessary.
*/
readonly id: string;
/**
* A label which will be used to present this provider's options in the UI.
*/
readonly label: string;
/**
* The order in which the provider should be listed in the UI when there are multiple providers.
*/
readonly priority: number;
/**
*
* @param item Data about an item which can be shared.
* @param token A cancellation token.
* @returns A {@link Uri} representing an external link or sharing text. The provider result
* will be copied to the user's clipboard and presented in a confirmation dialog.
*/
provideShare(item: ShareableItem, token: CancellationToken): ProviderResult<Uri | string>;
}
export namespace window {
/**
* Register a share provider. An extension may register multiple share providers.
* There may be multiple share providers for the same {@link ShareableItem}.
* @param selector A document selector to filter whether the provider should be shown for a {@link ShareableItem}.
* @param provider A share provider.
*/
export function registerShareProvider(selector: DocumentSelector, provider: ShareProvider): Disposable;
}
export interface TreeItem {
/**
* An optional property which, when set, inlines a `Share` option in the context menu for this tree item.
*/
shareableItem?: ShareableItem;
}
}