@opensumi/sumi 2.12.1-next-079c1930
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/README.md +1 -0
- package/build.ts +18 -0
- package/index.d.ts +5 -0
- package/manifest.json +414 -0
- package/package.json +18 -0
- package/sumi-browser.d.ts +273 -0
- package/sumi-worker/sumi-worker.d.ts +2788 -0
- package/sumi-worker/worker.command.d.ts +86 -0
- package/sumi-worker/worker.comments.d.ts +273 -0
- package/sumi-worker/worker.doc.d.ts +356 -0
- package/sumi-worker/worker.editor.d.ts +725 -0
- package/sumi-worker/worker.extensions.d.ts +63 -0
- package/sumi-worker/worker.language.d.ts +2220 -0
- package/sumi-worker/worker.window.d.ts +318 -0
- package/sumi-worker.d.ts +7 -0
- package/sumi.d.ts +822 -0
- package/vscode/typings/vscode.authentication.d.ts +231 -0
- package/vscode/typings/vscode.command.d.ts +86 -0
- package/vscode/typings/vscode.comments.d.ts +292 -0
- package/vscode/typings/vscode.d.ts +3789 -0
- package/vscode/typings/vscode.debug.d.ts +684 -0
- package/vscode/typings/vscode.doc.d.ts +272 -0
- package/vscode/typings/vscode.editor.d.ts +1017 -0
- package/vscode/typings/vscode.env.d.ts +153 -0
- package/vscode/typings/vscode.extension.d.ts +67 -0
- package/vscode/typings/vscode.language.d.ts +2630 -0
- package/vscode/typings/vscode.message.d.ts +195 -0
- package/vscode/typings/vscode.proposed.d.ts +662 -0
- package/vscode/typings/vscode.quickpick.d.ts +491 -0
- package/vscode/typings/vscode.scm.d.ts +254 -0
- package/vscode/typings/vscode.tasks.d.ts +676 -0
- package/vscode/typings/vscode.theme.d.ts +370 -0
- package/vscode/typings/vscode.window.d.ts +870 -0
- package/vscode/typings/vscode.workspace.d.ts +664 -0
- package/vscode/typings-pending/vscode.d.ts +27 -0
- package/vscode/typings-pending/vscode.proposed.d.ts +3 -0
- package/vscode.d.ts +23 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
declare module 'vscode' {
|
|
2
|
+
/**
|
|
3
|
+
* Represents a session of a currently logged in user.
|
|
4
|
+
*/
|
|
5
|
+
export interface AuthenticationSession {
|
|
6
|
+
/**
|
|
7
|
+
* The identifier of the authentication session.
|
|
8
|
+
*/
|
|
9
|
+
readonly id: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The access token.
|
|
13
|
+
*/
|
|
14
|
+
readonly accessToken: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The account associated with the session.
|
|
18
|
+
*/
|
|
19
|
+
readonly account: AuthenticationSessionAccountInformation;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The permissions granted by the session's access token. Available scopes
|
|
23
|
+
* are defined by the {@link AuthenticationProvider}.
|
|
24
|
+
*/
|
|
25
|
+
readonly scopes: ReadonlyArray<string>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The information of an account associated with an {@link AuthenticationSession}.
|
|
30
|
+
*/
|
|
31
|
+
export interface AuthenticationSessionAccountInformation {
|
|
32
|
+
/**
|
|
33
|
+
* The unique identifier of the account.
|
|
34
|
+
*/
|
|
35
|
+
readonly id: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The human-readable name of the account.
|
|
39
|
+
*/
|
|
40
|
+
readonly label: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Options to be used when getting an {@link AuthenticationSession} from an {@link AuthenticationProvider}.
|
|
46
|
+
*/
|
|
47
|
+
export interface AuthenticationGetSessionOptions {
|
|
48
|
+
/**
|
|
49
|
+
* Whether login should be performed if there is no matching session.
|
|
50
|
+
*
|
|
51
|
+
* If true, a modal dialog will be shown asking the user to sign in. If false, a numbered badge will be shown
|
|
52
|
+
* on the accounts activity bar icon. An entry for the extension will be added under the menu to sign in. This
|
|
53
|
+
* allows quietly prompting the user to sign in.
|
|
54
|
+
*
|
|
55
|
+
* If there is a matching session but the extension has not been granted access to it, setting this to true
|
|
56
|
+
* will also result in an immediate modal dialog, and false will add a numbered badge to the accounts icon.
|
|
57
|
+
*
|
|
58
|
+
* Defaults to false.
|
|
59
|
+
*/
|
|
60
|
+
createIfNone?: boolean;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Whether the existing user session preference should be cleared.
|
|
64
|
+
*
|
|
65
|
+
* For authentication providers that support being signed into multiple accounts at once, the user will be
|
|
66
|
+
* prompted to select an account to use when {@link authentication.getSession getSession} is called. This preference
|
|
67
|
+
* is remembered until {@link authentication.getSession getSession} is called with this flag.
|
|
68
|
+
*
|
|
69
|
+
* Defaults to false.
|
|
70
|
+
*/
|
|
71
|
+
clearSessionPreference?: boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Basic information about an {@link AuthenticationProvider}
|
|
76
|
+
*/
|
|
77
|
+
export interface AuthenticationProviderInformation {
|
|
78
|
+
/**
|
|
79
|
+
* The unique identifier of the authentication provider.
|
|
80
|
+
*/
|
|
81
|
+
readonly id: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The human-readable name of the authentication provider.
|
|
85
|
+
*/
|
|
86
|
+
readonly label: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* An {@link Event} which fires when an {@link AuthenticationSession} is added, removed, or changed.
|
|
91
|
+
*/
|
|
92
|
+
export interface AuthenticationSessionsChangeEvent {
|
|
93
|
+
/**
|
|
94
|
+
* The {@link AuthenticationProvider} that has had its sessions change.
|
|
95
|
+
*/
|
|
96
|
+
readonly provider: AuthenticationProviderInformation;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Options for creating an {@link AuthenticationProvider}.
|
|
101
|
+
*/
|
|
102
|
+
export interface AuthenticationProviderOptions {
|
|
103
|
+
/**
|
|
104
|
+
* Whether it is possible to be signed into multiple accounts at once with this provider.
|
|
105
|
+
* If not specified, will default to false.
|
|
106
|
+
*/
|
|
107
|
+
readonly supportsMultipleAccounts?: boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* An {@link Event} which fires when an {@link AuthenticationSession} is added, removed, or changed.
|
|
112
|
+
*/
|
|
113
|
+
export interface AuthenticationProviderAuthenticationSessionsChangeEvent {
|
|
114
|
+
/**
|
|
115
|
+
* The {@link AuthenticationSession}s of the {@link AuthentiationProvider AuthenticationProvider} that have been added.
|
|
116
|
+
*/
|
|
117
|
+
readonly added?: ReadonlyArray<AuthenticationSession>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The {@link AuthenticationSession}s of the {@link AuthentiationProvider AuthenticationProvider} that have been removed.
|
|
121
|
+
*/
|
|
122
|
+
readonly removed?: ReadonlyArray<AuthenticationSession>;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The {@link AuthenticationSession}s of the {@link AuthentiationProvider AuthenticationProvider} that have been changed.
|
|
126
|
+
* A session changes when its data excluding the id are updated. An example of this is a session refresh that results in a new
|
|
127
|
+
* access token being set for the session.
|
|
128
|
+
*/
|
|
129
|
+
readonly changed?: ReadonlyArray<AuthenticationSession>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A provider for performing authentication to a service.
|
|
134
|
+
*/
|
|
135
|
+
export interface AuthenticationProvider {
|
|
136
|
+
/**
|
|
137
|
+
* An {@link Event} which fires when the array of sessions has changed, or data
|
|
138
|
+
* within a session has changed.
|
|
139
|
+
*/
|
|
140
|
+
readonly onDidChangeSessions: Event<AuthenticationProviderAuthenticationSessionsChangeEvent>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Get a list of sessions.
|
|
144
|
+
* @param scopes An optional list of scopes. If provided, the sessions returned should match
|
|
145
|
+
* these permissions, otherwise all sessions should be returned.
|
|
146
|
+
* @returns A promise that resolves to an array of authentication sessions.
|
|
147
|
+
*/
|
|
148
|
+
getSessions(scopes?: string[]): Thenable<ReadonlyArray<AuthenticationSession>>;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Prompts a user to login.
|
|
152
|
+
*
|
|
153
|
+
* If login is successful, the onDidChangeSessions event should be fired.
|
|
154
|
+
*
|
|
155
|
+
* If login fails, a rejected promise should be returned.
|
|
156
|
+
*
|
|
157
|
+
* If the provider has specified that it does not support multiple accounts,
|
|
158
|
+
* then this should never be called if there is already an existing session matching these
|
|
159
|
+
* scopes.
|
|
160
|
+
* @param scopes A list of scopes, permissions, that the new session should be created with.
|
|
161
|
+
* @returns A promise that resolves to an authentication session.
|
|
162
|
+
*/
|
|
163
|
+
createSession(scopes: string[]): Thenable<AuthenticationSession>;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Removes the session corresponding to session id.
|
|
167
|
+
*
|
|
168
|
+
* If the removal is successful, the onDidChangeSessions event should be fired.
|
|
169
|
+
*
|
|
170
|
+
* If a session cannot be removed, the provider should reject with an error message.
|
|
171
|
+
* @param sessionId The id of the session to remove.
|
|
172
|
+
*/
|
|
173
|
+
removeSession(sessionId: string): Thenable<void>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Namespace for authentication.
|
|
179
|
+
*/
|
|
180
|
+
export namespace authentication {
|
|
181
|
+
/**
|
|
182
|
+
* Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
|
|
183
|
+
* registered, or if the user does not consent to sharing authentication information with
|
|
184
|
+
* the extension. If there are multiple sessions with the same scopes, the user will be shown a
|
|
185
|
+
* quickpick to select which account they would like to use.
|
|
186
|
+
*
|
|
187
|
+
* Currently, there are only two authentication providers that are contributed from built in extensions
|
|
188
|
+
* to VS Code that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.
|
|
189
|
+
* @param providerId The id of the provider to use
|
|
190
|
+
* @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
|
|
191
|
+
* @param options The {@link GetSessionOptions} to use
|
|
192
|
+
* @returns A thenable that resolves to an authentication session
|
|
193
|
+
*/
|
|
194
|
+
export function getSession(providerId: string, scopes: string[], options: AuthenticationGetSessionOptions & { createIfNone: true }): Thenable<AuthenticationSession>;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
|
|
198
|
+
* registered, or if the user does not consent to sharing authentication information with
|
|
199
|
+
* the extension. If there are multiple sessions with the same scopes, the user will be shown a
|
|
200
|
+
* quickpick to select which account they would like to use.
|
|
201
|
+
*
|
|
202
|
+
* Currently, there are only two authentication providers that are contributed from built in extensions
|
|
203
|
+
* to VS Code that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.
|
|
204
|
+
* @param providerId The id of the provider to use
|
|
205
|
+
* @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
|
|
206
|
+
* @param options The {@link GetSessionOptions} to use
|
|
207
|
+
* @returns A thenable that resolves to an authentication session if available, or undefined if there are no sessions
|
|
208
|
+
*/
|
|
209
|
+
export function getSession(providerId: string, scopes: string[], options?: AuthenticationGetSessionOptions): Thenable<AuthenticationSession | undefined>;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* An {@link Event} which fires when the authentication sessions of an authentication provider have
|
|
213
|
+
* been added, removed, or changed.
|
|
214
|
+
*/
|
|
215
|
+
export const onDidChangeSessions: Event<AuthenticationSessionsChangeEvent>;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Register an authentication provider.
|
|
219
|
+
*
|
|
220
|
+
* There can only be one provider per id and an error is being thrown when an id
|
|
221
|
+
* has already been used by another provider. Ids are case-sensitive.
|
|
222
|
+
*
|
|
223
|
+
* @param id The unique identifier of the provider.
|
|
224
|
+
* @param label The human-readable name of the provider.
|
|
225
|
+
* @param provider The authentication provider provider.
|
|
226
|
+
* @params options Additional options for the provider.
|
|
227
|
+
* @return A {@link Disposable} that unregisters this provider when being disposed.
|
|
228
|
+
*/
|
|
229
|
+
export function registerAuthenticationProvider(id: string, label: string, provider: AuthenticationProvider, options?: AuthenticationProviderOptions): Disposable;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
declare module 'vscode' {
|
|
2
|
+
/**
|
|
3
|
+
* Represents a reference to a command. Provides a title which
|
|
4
|
+
* will be used to represent a command in the UI and, optionally,
|
|
5
|
+
* an array of arguments which will be passed to the command handler
|
|
6
|
+
* function when invoked.
|
|
7
|
+
*/
|
|
8
|
+
export interface Command {
|
|
9
|
+
/**
|
|
10
|
+
* Title of the command, like `save`.
|
|
11
|
+
*/
|
|
12
|
+
title: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The identifier of the actual command handler.
|
|
16
|
+
* @see [commands.registerCommand](#commands.registerCommand).
|
|
17
|
+
*/
|
|
18
|
+
command: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A tooltip for the command, when represented in the UI.
|
|
22
|
+
*/
|
|
23
|
+
tooltip?: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Arguments that the command handler should be
|
|
27
|
+
* invoked with.
|
|
28
|
+
*/
|
|
29
|
+
arguments?: any[];
|
|
30
|
+
}
|
|
31
|
+
export namespace commands {
|
|
32
|
+
/**
|
|
33
|
+
* Registers a command that can be invoked via a keyboard shortcut,
|
|
34
|
+
* a menu item, an action, or directly.
|
|
35
|
+
*
|
|
36
|
+
* Registering a command with an existing command identifier twice
|
|
37
|
+
* will cause an error.
|
|
38
|
+
*
|
|
39
|
+
* @param command A unique identifier for the command.
|
|
40
|
+
* @param callback A command handler function.
|
|
41
|
+
* @param thisArg The `this` context used when invoking the handler function.
|
|
42
|
+
* @return Disposable which unregisters this command on disposal.
|
|
43
|
+
*/
|
|
44
|
+
export function registerCommand(command: string, callback: (...args: any[]) => any, thisArg?: any): Disposable;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Executes the command denoted by the given command identifier.
|
|
48
|
+
*
|
|
49
|
+
* * *Note 1:* When executing an editor command not all types are allowed to
|
|
50
|
+
* be passed as arguments. Allowed are the primitive types `string`, `boolean`,
|
|
51
|
+
* `number`, `undefined`, and `null`, as well as [`Position`](#Position), [`Range`](#Range), [`Uri`](#Uri) and [`Location`](#Location).
|
|
52
|
+
* * *Note 2:* There are no restrictions when executing commands that have been contributed
|
|
53
|
+
* by extensions.
|
|
54
|
+
*
|
|
55
|
+
* @param command Identifier of the command to execute.
|
|
56
|
+
* @param rest Parameters passed to the command function.
|
|
57
|
+
* @return A thenable that resolves to the returned value of the given command. `undefined` when
|
|
58
|
+
* the command handler function doesn't return anything.
|
|
59
|
+
*/
|
|
60
|
+
export function executeCommand<T>(command: string, ...rest: any[]): Thenable<T | undefined>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Retrieve the list of all available commands. Commands starting an underscore are
|
|
64
|
+
* treated as internal commands.
|
|
65
|
+
*
|
|
66
|
+
* @param filterInternal Set `true` to not see internal commands (starting with an underscore)
|
|
67
|
+
* @return Thenable that resolves to a list of command ids.
|
|
68
|
+
*/
|
|
69
|
+
export function getCommands(filterInternal?: boolean): Thenable<string[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Registers a text editor command that can be invoked via a keyboard shortcut,
|
|
72
|
+
* a menu item, an action, or directly.
|
|
73
|
+
*
|
|
74
|
+
* Text editor commands are different from ordinary [commands](#commands.registerCommand) as
|
|
75
|
+
* they only execute when there is an active editor when the command is called. Also, the
|
|
76
|
+
* command handler of an editor command has access to the active editor and to an
|
|
77
|
+
* [edit](#TextEditorEdit)-builder.
|
|
78
|
+
*
|
|
79
|
+
* @param command A unique identifier for the command.
|
|
80
|
+
* @param callback A command handler function with access to an [editor](#TextEditor) and an [edit](#TextEditorEdit).
|
|
81
|
+
* @param thisArg The `this` context used when invoking the handler function.
|
|
82
|
+
* @return Disposable which unregisters this command on disposal.
|
|
83
|
+
*/
|
|
84
|
+
export function registerTextEditorCommand(command: string, callback: (textEditor: TextEditor, edit: TextEditorEdit, ...args: any[]) => void, thisArg?: any): Disposable;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
declare module 'vscode' {
|
|
2
|
+
//#region Comments
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Collapsible state of a [comment thread](#CommentThread)
|
|
6
|
+
*/
|
|
7
|
+
export enum CommentThreadCollapsibleState {
|
|
8
|
+
/**
|
|
9
|
+
* Determines an item is collapsed
|
|
10
|
+
*/
|
|
11
|
+
Collapsed = 0,
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Determines an item is expanded
|
|
15
|
+
*/
|
|
16
|
+
Expanded = 1,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Comment mode of a [comment](#Comment)
|
|
21
|
+
*/
|
|
22
|
+
export enum CommentMode {
|
|
23
|
+
/**
|
|
24
|
+
* Displays the comment editor
|
|
25
|
+
*/
|
|
26
|
+
Editing = 0,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Displays the preview of the comment
|
|
30
|
+
*/
|
|
31
|
+
Preview = 1,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A collection of [comments](#Comment) representing a conversation at a particular range in a document.
|
|
36
|
+
*/
|
|
37
|
+
export interface CommentThread {
|
|
38
|
+
/**
|
|
39
|
+
* The uri of the document the thread has been created on.
|
|
40
|
+
*/
|
|
41
|
+
readonly uri: Uri;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The range the comment thread is located within the document. The thread icon will be shown
|
|
45
|
+
* at the first line of the range.
|
|
46
|
+
*/
|
|
47
|
+
range: Range;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The ordered comments of the thread.
|
|
51
|
+
*/
|
|
52
|
+
comments: ReadonlyArray<Comment>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Whether the thread should be collapsed or expanded when opening the document.
|
|
56
|
+
* Defaults to Collapsed.
|
|
57
|
+
*/
|
|
58
|
+
collapsibleState: CommentThreadCollapsibleState;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Whether the thread supports reply.
|
|
62
|
+
* Defaults to true.
|
|
63
|
+
*/
|
|
64
|
+
canReply: boolean;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Context value of the comment thread. This can be used to contribute thread specific actions.
|
|
68
|
+
* For example, a comment thread is given a context value as `editable`. When contributing actions to `comments/commentThread/title`
|
|
69
|
+
* using `menus` extension point, you can specify context value for key `commentThread` in `when` expression like `commentThread == editable`.
|
|
70
|
+
* ```
|
|
71
|
+
* "contributes": {
|
|
72
|
+
* "menus": {
|
|
73
|
+
* "comments/commentThread/title": [
|
|
74
|
+
* {
|
|
75
|
+
* "command": "extension.deleteCommentThread",
|
|
76
|
+
* "when": "commentThread == editable"
|
|
77
|
+
* }
|
|
78
|
+
* ]
|
|
79
|
+
* }
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
* This will show action `extension.deleteCommentThread` only for comment threads with `contextValue` is `editable`.
|
|
83
|
+
*/
|
|
84
|
+
contextValue?: string;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The optional human-readable label describing the [Comment Thread](#CommentThread)
|
|
88
|
+
*/
|
|
89
|
+
label?: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Dispose this comment thread.
|
|
93
|
+
*
|
|
94
|
+
* Once disposed, this comment thread will be removed from visible editors and Comment Panel when approriate.
|
|
95
|
+
*/
|
|
96
|
+
dispose(): void;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Author information of a [comment](#Comment)
|
|
101
|
+
*/
|
|
102
|
+
export interface CommentAuthorInformation {
|
|
103
|
+
/**
|
|
104
|
+
* The display name of the author of the comment
|
|
105
|
+
*/
|
|
106
|
+
name: string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The optional icon path for the author
|
|
110
|
+
*/
|
|
111
|
+
iconPath?: Uri;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Reactions of a [comment](#Comment)
|
|
116
|
+
*/
|
|
117
|
+
export interface CommentReaction {
|
|
118
|
+
/**
|
|
119
|
+
* The human-readable label for the reaction
|
|
120
|
+
*/
|
|
121
|
+
readonly label: string;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Icon for the reaction shown in UI.
|
|
125
|
+
*/
|
|
126
|
+
readonly iconPath: string | Uri;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The number of users who have reacted to this reaction
|
|
130
|
+
*/
|
|
131
|
+
readonly count: number;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Whether the [author](CommentAuthorInformation) of the comment has reacted to this reaction
|
|
135
|
+
*/
|
|
136
|
+
readonly authorHasReacted: boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Represents a {@link CommentController comment controller}'s {@link CommentController.options options}.
|
|
141
|
+
*/
|
|
142
|
+
export interface CommentOptions {
|
|
143
|
+
/**
|
|
144
|
+
* TODO: kaitian 评论组件交互无收起时保留输入框的设计,该值设置无效
|
|
145
|
+
* An optional string to show on the comment input box when it's collapsed.
|
|
146
|
+
*/
|
|
147
|
+
prompt?: string;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* An optional string to show as placeholder in the comment input box when it's focused.
|
|
151
|
+
*/
|
|
152
|
+
placeHolder?: string;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* A comment is displayed within the editor or the Comments Panel, depending on how it is provided.
|
|
157
|
+
*/
|
|
158
|
+
export interface Comment {
|
|
159
|
+
/**
|
|
160
|
+
* The human-readable comment body
|
|
161
|
+
*/
|
|
162
|
+
body: string | MarkdownString;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* [Comment mode](#CommentMode) of the comment
|
|
166
|
+
*/
|
|
167
|
+
mode: CommentMode;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The [author information](#CommentAuthorInformation) of the comment
|
|
171
|
+
*/
|
|
172
|
+
author: CommentAuthorInformation;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Context value of the comment. This can be used to contribute comment specific actions.
|
|
176
|
+
* For example, a comment is given a context value as `editable`. When contributing actions to `comments/comment/title`
|
|
177
|
+
* using `menus` extension point, you can specify context value for key `comment` in `when` expression like `comment == editable`.
|
|
178
|
+
* ```json
|
|
179
|
+
* "contributes": {
|
|
180
|
+
* "menus": {
|
|
181
|
+
* "comments/comment/title": [
|
|
182
|
+
* {
|
|
183
|
+
* "command": "extension.deleteComment",
|
|
184
|
+
* "when": "comment == editable"
|
|
185
|
+
* }
|
|
186
|
+
* ]
|
|
187
|
+
* }
|
|
188
|
+
* }
|
|
189
|
+
* ```
|
|
190
|
+
* This will show action `extension.deleteComment` only for comments with `contextValue` is `editable`.
|
|
191
|
+
*/
|
|
192
|
+
contextValue?: string;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Optional reactions of the [comment](#Comment)
|
|
196
|
+
*/
|
|
197
|
+
reactions?: CommentReaction[];
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Optional label describing the [Comment](#Comment)
|
|
201
|
+
* Label will be rendered next to authorName if exists.
|
|
202
|
+
*/
|
|
203
|
+
label?: string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Command argument for actions registered in `comments/commentThread/context`.
|
|
208
|
+
*/
|
|
209
|
+
export interface CommentReply {
|
|
210
|
+
/**
|
|
211
|
+
* The active [comment thread](#CommentThread)
|
|
212
|
+
*/
|
|
213
|
+
thread: CommentThread;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* The value in the comment editor
|
|
217
|
+
*/
|
|
218
|
+
text: string;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Commenting range provider for a [comment controller](#CommentController).
|
|
223
|
+
*/
|
|
224
|
+
export interface CommentingRangeProvider {
|
|
225
|
+
/**
|
|
226
|
+
* Provide a list of ranges which allow new comment threads creation or null for a given document
|
|
227
|
+
*/
|
|
228
|
+
provideCommentingRanges(document: TextDocument, token: CancellationToken): ProviderResult<Range[]>;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* A comment controller is able to provide [comments](#CommentThread) support to the editor and
|
|
233
|
+
* provide users various ways to interact with comments.
|
|
234
|
+
*/
|
|
235
|
+
export interface CommentController {
|
|
236
|
+
/**
|
|
237
|
+
* The id of this comment controller.
|
|
238
|
+
*/
|
|
239
|
+
readonly id: string;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* The human-readable label of this comment controller.
|
|
243
|
+
*/
|
|
244
|
+
readonly label: string;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Optional commenting range provider. Provide a list [ranges](#Range) which support commenting to any given resource uri.
|
|
248
|
+
*
|
|
249
|
+
* If not provided, users can leave comments in any document opened in the editor.
|
|
250
|
+
*/
|
|
251
|
+
commentingRangeProvider?: CommentingRangeProvider;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Create a [comment thread](#CommentThread). The comment thread will be displayed in visible text editors (if the resource matches)
|
|
255
|
+
* and Comments Panel once created.
|
|
256
|
+
*
|
|
257
|
+
* @param uri The uri of the document the thread has been created on.
|
|
258
|
+
* @param range The range the comment thread is located within the document.
|
|
259
|
+
* @param comments The ordered comments of the thread.
|
|
260
|
+
*/
|
|
261
|
+
createCommentThread(uri: Uri, range: Range, comments: Comment[]): CommentThread;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Comment controller options
|
|
265
|
+
*/
|
|
266
|
+
options?: CommentOptions;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Optional reaction handler for creating and deleting reactions on a [comment](#Comment).
|
|
270
|
+
*/
|
|
271
|
+
reactionHandler?: (comment: Comment, reaction: CommentReaction) => Promise<void>;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Dispose this comment controller.
|
|
275
|
+
*
|
|
276
|
+
* Once disposed, all [comment threads](#CommentThread) created by this comment controller will also be removed from the editor
|
|
277
|
+
* and Comments Panel.
|
|
278
|
+
*/
|
|
279
|
+
dispose(): void;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
namespace comments {
|
|
283
|
+
/**
|
|
284
|
+
* Creates a new [comment controller](#CommentController) instance.
|
|
285
|
+
*
|
|
286
|
+
* @param id An `id` for the comment controller.
|
|
287
|
+
* @param label A human-readable string for the comment controller.
|
|
288
|
+
* @return An instance of [comment controller](#CommentController).
|
|
289
|
+
*/
|
|
290
|
+
export function createCommentController(id: string, label: string): CommentController;
|
|
291
|
+
}
|
|
292
|
+
}
|