-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
vsls.d.ts
93 lines (74 loc) · 2.3 KB
/
vsls.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import { CancellationToken, Disposable, Event, TreeDataProvider, Uri } from 'vscode';
export interface LiveShareExtension {
getApi(version: string): Promise<LiveShare | null>;
}
export interface LiveShare {
readonly session: Session;
readonly onDidChangeSession: Event<SessionChangeEvent>;
share(options?: ShareOptions): Promise<Uri | null>;
shareService(name: string): Promise<SharedService | null>;
unshareService(name: string): Promise<void>;
getSharedService(name: string): Promise<SharedServiceProxy | null>;
convertLocalUriToShared(localUri: Uri): Uri;
convertSharedUriToLocal(sharedUri: Uri): Uri;
getContacts(emails: string[]): Promise<Contacts>;
}
export const enum Access {
None = 0,
ReadOnly = 1,
ReadWrite = 3,
Owner = 0xff,
}
export const enum Role {
None = 0,
Host = 1,
Guest = 2,
}
export interface Session {
readonly id: string | null;
readonly role: Role;
readonly access: Access;
}
export interface SessionChangeEvent {
readonly session: Session;
}
export interface Contact {
readonly onDidChange: Event<string[]>;
readonly id: string;
readonly email: string;
readonly displayName?: string;
readonly status?: string;
readonly avatarUri?: string;
invite(options?: ContactInviteOptions): Promise<boolean>;
}
export interface Contacts {
readonly contacts: { [email: string]: Contact };
dispose(): Promise<void>;
}
export interface ContactInviteOptions {
useEmail?: boolean;
}
export interface SharedService {
readonly isServiceAvailable: boolean;
readonly onDidChangeIsServiceAvailable: Event<boolean>;
onRequest(name: string, handler: RequestHandler): void;
onNotify(name: string, handler: NotifyHandler): void;
notify(name: string, args: object): void;
}
export interface SharedServiceProxy {
readonly isServiceAvailable: boolean;
readonly onDidChangeIsServiceAvailable: Event<boolean>;
onNotify(name: string, handler: NotifyHandler): void;
request(name: string, args: any[], cancellation?: CancellationToken): Promise<any>;
notify(name: string, args: object): void;
}
export interface SharedServiceProxyError extends Error {}
export interface SharedServiceResponseError extends Error {
remoteStack?: string;
}
export interface RequestHandler {
(args: any[], cancellation: CancellationToken): any | Promise<any>;
}
export interface NotifyHandler {
(args: object): void;
}