@codingame/monaco-vscode-rollup-vsix-plugin 8.0.3 → 9.0.0
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 +1 -1
- package/rollup-vsix-plugin.js +19 -5
- package/vscode-dts/vscode.proposed.aiTextSearchProviderNew.d.ts +1 -85
- package/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts +42 -13
- package/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts +5 -0
- package/vscode-dts/vscode.proposed.chatProvider.d.ts +1 -1
- package/vscode-dts/vscode.proposed.chatVariableResolver.d.ts +0 -17
- package/vscode-dts/vscode.proposed.contribChatParticipantDetection.d.ts +6 -0
- package/vscode-dts/vscode.proposed.contribDebugCreateConfiguration.d.ts +6 -0
- package/vscode-dts/vscode.proposed.contribSourceControlHistoryTitleMenu.d.ts +7 -0
- package/vscode-dts/vscode.proposed.contribViewContainerTitle.d.ts +8 -0
- package/vscode-dts/vscode.proposed.defaultChatParticipant.d.ts +6 -3
- package/vscode-dts/vscode.proposed.extensionsAny.d.ts +1 -0
- package/vscode-dts/vscode.proposed.fileSearchProviderNew.d.ts +7 -6
- package/vscode-dts/vscode.proposed.findFiles2New.d.ts +36 -11
- package/vscode-dts/vscode.proposed.findTextInFilesNew.d.ts +51 -30
- package/vscode-dts/vscode.proposed.interactive.d.ts +0 -2
- package/vscode-dts/vscode.proposed.lmTools.d.ts +119 -20
- package/vscode-dts/vscode.proposed.notebookReplDocument.d.ts +20 -0
- package/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts +1 -0
- package/vscode-dts/vscode.proposed.testObserver.d.ts +6 -0
- package/vscode-dts/vscode.proposed.textSearchCompleteNew.d.ts +1 -9
- package/vscode-dts/vscode.proposed.textSearchProviderNew.d.ts +58 -17
- package/vscode-dts/vscode.proposed.authGetSessions.d.ts +0 -70
- package/vscode-dts/vscode.proposed.terminalShellIntegration.d.ts +0 -338
- package/vscode-dts/vscode.proposed.testMessageStackTrace.d.ts +0 -38
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
|
-
// version:
|
|
6
|
+
// version: 6
|
|
7
7
|
// https://github.com/microsoft/vscode/issues/213274
|
|
8
8
|
|
|
9
9
|
declare module 'vscode' {
|
|
10
10
|
|
|
11
11
|
// TODO@API capabilities
|
|
12
12
|
|
|
13
|
-
export type JSONSchema = object;
|
|
14
|
-
|
|
15
13
|
// API -> LM: an tool/function that is available to the language model
|
|
16
|
-
export interface
|
|
14
|
+
export interface LanguageModelChatTool {
|
|
15
|
+
// TODO@API should use "id" here to match vscode tools, or keep name to match OpenAI?
|
|
17
16
|
name: string;
|
|
18
17
|
description: string;
|
|
19
18
|
parametersSchema?: JSONSchema;
|
|
@@ -21,8 +20,8 @@ declare module 'vscode' {
|
|
|
21
20
|
|
|
22
21
|
// API -> LM: add tools as request option
|
|
23
22
|
export interface LanguageModelChatRequestOptions {
|
|
24
|
-
// TODO@API this will a heterogeneous array of different types of tools
|
|
25
|
-
tools?:
|
|
23
|
+
// TODO@API this will be a heterogeneous array of different types of tools
|
|
24
|
+
tools?: LanguageModelChatTool[];
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* Force a specific tool to be used.
|
|
@@ -31,11 +30,12 @@ declare module 'vscode' {
|
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
// LM -> USER: function that should be used
|
|
34
|
-
export class
|
|
33
|
+
export class LanguageModelChatResponseToolCallPart {
|
|
35
34
|
name: string;
|
|
35
|
+
toolCallId: string;
|
|
36
36
|
parameters: any;
|
|
37
37
|
|
|
38
|
-
constructor(name: string, parameters: any);
|
|
38
|
+
constructor(name: string, toolCallId: string, parameters: any);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// LM -> USER: text chunk
|
|
@@ -46,22 +46,41 @@ declare module 'vscode' {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export interface LanguageModelChatResponse {
|
|
49
|
-
|
|
50
|
-
stream: AsyncIterable<LanguageModelChatResponseTextPart | LanguageModelChatResponseFunctionUsePart>;
|
|
49
|
+
stream: AsyncIterable<LanguageModelChatResponseTextPart | LanguageModelChatResponseToolCallPart>;
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
|
|
54
53
|
// USER -> LM: the result of a function call
|
|
55
|
-
export class
|
|
56
|
-
|
|
54
|
+
export class LanguageModelChatMessageToolResultPart {
|
|
55
|
+
toolCallId: string;
|
|
57
56
|
content: string;
|
|
58
57
|
isError: boolean;
|
|
59
58
|
|
|
60
|
-
constructor(
|
|
59
|
+
constructor(toolCallId: string, content: string, isError?: boolean);
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
export interface LanguageModelChatMessage {
|
|
64
|
-
|
|
63
|
+
/**
|
|
64
|
+
* A heterogeneous array of other things that a message can contain as content.
|
|
65
|
+
* Some parts would be message-type specific for some models and wouldn't go together,
|
|
66
|
+
* but it's up to the chat provider to decide what to do about that.
|
|
67
|
+
* Can drop parts that are not valid for the message type.
|
|
68
|
+
* LanguageModelChatMessageToolResultPart: only on User messages
|
|
69
|
+
* LanguageModelChatResponseToolCallPart: only on Assistant messages
|
|
70
|
+
*/
|
|
71
|
+
content2: (string | LanguageModelChatMessageToolResultPart | LanguageModelChatResponseToolCallPart)[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface LanguageModelToolResult {
|
|
75
|
+
/**
|
|
76
|
+
* The result can contain arbitrary representations of the content. An example might be a `PromptElementJSON` from `@vscode/prompt-tsx`, using the `contentType` exported by that library.
|
|
77
|
+
*/
|
|
78
|
+
[contentType: string]: any;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A string representation of the result which can be incorporated back into an LLM prompt without any special handling.
|
|
82
|
+
*/
|
|
83
|
+
toString(): string;
|
|
65
84
|
}
|
|
66
85
|
|
|
67
86
|
// Tool registration/invoking between extensions
|
|
@@ -70,7 +89,7 @@ declare module 'vscode' {
|
|
|
70
89
|
/**
|
|
71
90
|
* Register a LanguageModelTool. The tool must also be registered in the package.json `languageModelTools` contribution point.
|
|
72
91
|
*/
|
|
73
|
-
export function registerTool(
|
|
92
|
+
export function registerTool(id: string, tool: LanguageModelTool): Disposable;
|
|
74
93
|
|
|
75
94
|
/**
|
|
76
95
|
* A list of all available tools.
|
|
@@ -79,18 +98,98 @@ declare module 'vscode' {
|
|
|
79
98
|
|
|
80
99
|
/**
|
|
81
100
|
* Invoke a tool with the given parameters.
|
|
101
|
+
* TODO@API Could request a set of contentTypes to be returned so they don't all need to be computed?
|
|
82
102
|
*/
|
|
83
|
-
export function invokeTool(
|
|
103
|
+
export function invokeTool(id: string, options: LanguageModelToolInvocationOptions, token: CancellationToken): Thenable<LanguageModelToolResult>;
|
|
84
104
|
}
|
|
85
105
|
|
|
86
|
-
|
|
106
|
+
export interface LanguageModelToolInvocationOptions {
|
|
107
|
+
/**
|
|
108
|
+
* Parameters with which to invoke the tool.
|
|
109
|
+
*/
|
|
110
|
+
parameters: Object;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Options to hint at how many tokens the tool should return in its response.
|
|
114
|
+
*/
|
|
115
|
+
tokenOptions?: {
|
|
116
|
+
/**
|
|
117
|
+
* If known, the maximum number of tokens the tool should emit in its result.
|
|
118
|
+
*/
|
|
119
|
+
tokenBudget: number;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Count the number of tokens in a message using the model specific tokenizer-logic.
|
|
123
|
+
* @param text A string.
|
|
124
|
+
* @param token Optional cancellation token. See {@link CancellationTokenSource} for how to create one.
|
|
125
|
+
* @returns A thenable that resolves to the number of tokens.
|
|
126
|
+
*/
|
|
127
|
+
countTokens(text: string, token?: CancellationToken): Thenable<number>;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type JSONSchema = object;
|
|
132
|
+
|
|
87
133
|
export interface LanguageModelToolDescription {
|
|
88
|
-
|
|
89
|
-
|
|
134
|
+
/**
|
|
135
|
+
* A unique identifier for the tool.
|
|
136
|
+
*/
|
|
137
|
+
id: string;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* A human-readable name for this tool that may be used to describe it in the UI.
|
|
141
|
+
*/
|
|
142
|
+
displayName: string | undefined;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* A description of this tool that may be passed to a language model.
|
|
146
|
+
*/
|
|
147
|
+
modelDescription: string;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* A JSON schema for the parameters this tool accepts.
|
|
151
|
+
*/
|
|
90
152
|
parametersSchema?: JSONSchema;
|
|
91
153
|
}
|
|
92
154
|
|
|
93
155
|
export interface LanguageModelTool {
|
|
94
|
-
|
|
156
|
+
// TODO@API should it be LanguageModelToolResult | string?
|
|
157
|
+
invoke(options: LanguageModelToolInvocationOptions, token: CancellationToken): ProviderResult<LanguageModelToolResult>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface ChatLanguageModelToolReference {
|
|
161
|
+
/**
|
|
162
|
+
* The tool's ID. Refers to a tool listed in {@link lm.tools}.
|
|
163
|
+
*/
|
|
164
|
+
readonly id: string;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The start and end index of the reference in the {@link ChatRequest.prompt prompt}. When undefined, the reference was not part of the prompt text.
|
|
168
|
+
*
|
|
169
|
+
* *Note* that the indices take the leading `#`-character into account which means they can
|
|
170
|
+
* used to modify the prompt as-is.
|
|
171
|
+
*/
|
|
172
|
+
readonly range?: [start: number, end: number];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface ChatRequest {
|
|
176
|
+
/**
|
|
177
|
+
* The list of tools that the user attached to their request.
|
|
178
|
+
*
|
|
179
|
+
* *Note* that if tools are referenced in the text of the prompt, using `#`, the prompt contains
|
|
180
|
+
* references as authored and that it is up to the participant
|
|
181
|
+
* to further modify the prompt, for instance by inlining reference values or creating links to
|
|
182
|
+
* headings which contain the resolved values. References are sorted in reverse by their range
|
|
183
|
+
* in the prompt. That means the last reference in the prompt is the first in this list. This simplifies
|
|
184
|
+
* string-manipulation of the prompt.
|
|
185
|
+
*/
|
|
186
|
+
readonly toolReferences: readonly ChatLanguageModelToolReference[];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface ChatRequestTurn {
|
|
190
|
+
/**
|
|
191
|
+
* The list of tools were attached to this request.
|
|
192
|
+
*/
|
|
193
|
+
readonly toolReferences?: readonly ChatLanguageModelToolReference[];
|
|
95
194
|
}
|
|
96
195
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
declare module 'vscode' {
|
|
7
|
+
|
|
8
|
+
export interface NotebookDocumentShowOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The notebook should be opened in a REPL editor,
|
|
11
|
+
* where the last cell of the notebook is an input box and the rest are read-only.
|
|
12
|
+
*/
|
|
13
|
+
readonly asRepl?: boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The label to be used for the editor tab.
|
|
17
|
+
*/
|
|
18
|
+
readonly label?: string;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -102,6 +102,12 @@ declare module 'vscode' {
|
|
|
102
102
|
* were passed in the {@link tests.runTests} method.
|
|
103
103
|
*/
|
|
104
104
|
readonly results: ReadonlyArray<Readonly<TestResultSnapshot>>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Gets coverage information for a URI. This function is available only
|
|
108
|
+
* when a test run reported coverage.
|
|
109
|
+
*/
|
|
110
|
+
getDetailedCoverage?(uri: Uri, token?: CancellationToken): Thenable<FileCoverageDetail[]>;
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
/**
|
|
@@ -33,14 +33,6 @@ declare module 'vscode' {
|
|
|
33
33
|
/**
|
|
34
34
|
* The message type, this affects how the message will be rendered.
|
|
35
35
|
*/
|
|
36
|
-
type:
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Represents the severity of a TextSearchComplete message.
|
|
41
|
-
*/
|
|
42
|
-
export enum TextSearchCompleteMessageTypeNew {
|
|
43
|
-
Information = 1,
|
|
44
|
-
Warning = 2,
|
|
36
|
+
type: TextSearchCompleteMessageType;
|
|
45
37
|
}
|
|
46
38
|
}
|
|
@@ -8,31 +8,47 @@ declare module 'vscode' {
|
|
|
8
8
|
// https://github.com/microsoft/vscode/issues/59921
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* The parameters of a query for text search.
|
|
11
|
+
* The parameters of a query for text search. All optional booleans default to `false`.
|
|
12
12
|
*/
|
|
13
13
|
export interface TextSearchQueryNew {
|
|
14
14
|
/**
|
|
15
15
|
* The text pattern to search for.
|
|
16
|
+
*
|
|
17
|
+
* If explicitly contains a newline character (`\n`), the default search behavior
|
|
18
|
+
* will automatically enable {@link isMultiline}.
|
|
16
19
|
*/
|
|
17
20
|
pattern: string;
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* Whether or not `pattern` should match multiple lines of text.
|
|
24
|
+
*
|
|
25
|
+
* If using the default search provider, this will be interpreted as `true` if
|
|
26
|
+
* `pattern` contains a newline character (`\n`).
|
|
21
27
|
*/
|
|
22
28
|
isMultiline?: boolean;
|
|
23
29
|
|
|
24
30
|
/**
|
|
25
31
|
* Whether or not `pattern` should be interpreted as a regular expression.
|
|
32
|
+
*
|
|
33
|
+
* If using the default search provider, this will be interpreted case-insensitively
|
|
34
|
+
* if {@link isCaseSensitive} is `false` or not set.
|
|
26
35
|
*/
|
|
27
36
|
isRegExp?: boolean;
|
|
28
37
|
|
|
29
38
|
/**
|
|
30
39
|
* Whether or not the search should be case-sensitive.
|
|
40
|
+
*
|
|
41
|
+
* If using the default search provider, this can be affected by the `search.smartCase` setting.
|
|
42
|
+
* See the setting description for more information.
|
|
31
43
|
*/
|
|
32
44
|
isCaseSensitive?: boolean;
|
|
33
45
|
|
|
34
46
|
/**
|
|
35
47
|
* Whether or not to search for whole word matches only.
|
|
48
|
+
*
|
|
49
|
+
* If enabled, the default search provider will check for boundary characters
|
|
50
|
+
* (regex pattern `\b`) surrounding the {@link pattern} to see whether something
|
|
51
|
+
* is a word match.
|
|
36
52
|
*/
|
|
37
53
|
isWordMatch?: boolean;
|
|
38
54
|
}
|
|
@@ -40,7 +56,7 @@ declare module 'vscode' {
|
|
|
40
56
|
/**
|
|
41
57
|
* Options that apply to text search.
|
|
42
58
|
*/
|
|
43
|
-
export interface
|
|
59
|
+
export interface TextSearchProviderOptions {
|
|
44
60
|
|
|
45
61
|
folderOptions: {
|
|
46
62
|
/**
|
|
@@ -73,14 +89,20 @@ declare module 'vscode' {
|
|
|
73
89
|
*/
|
|
74
90
|
local: boolean;
|
|
75
91
|
/**
|
|
76
|
-
* Use ignore files at the parent directory. If set, {@link
|
|
92
|
+
* Use ignore files at the parent directory. If set, {@link TextSearchProviderOptions.useIgnoreFiles.local} should also be `true`.
|
|
77
93
|
*/
|
|
78
94
|
parent: boolean;
|
|
79
95
|
/**
|
|
80
|
-
* Use global ignore files. If set, {@link
|
|
96
|
+
* Use global ignore files. If set, {@link TextSearchProviderOptions.useIgnoreFiles.local} should also be `true`.
|
|
81
97
|
*/
|
|
82
98
|
global: boolean;
|
|
83
99
|
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Interpret files using this encoding.
|
|
103
|
+
* See the vscode setting `"files.encoding"`
|
|
104
|
+
*/
|
|
105
|
+
encoding: string;
|
|
84
106
|
}[];
|
|
85
107
|
|
|
86
108
|
/**
|
|
@@ -109,13 +131,7 @@ declare module 'vscode' {
|
|
|
109
131
|
/**
|
|
110
132
|
* Exclude files larger than `maxFileSize` in bytes.
|
|
111
133
|
*/
|
|
112
|
-
maxFileSize: number;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Interpret files using this encoding.
|
|
116
|
-
* See the vscode setting `"files.encoding"`
|
|
117
|
-
*/
|
|
118
|
-
encoding: string;
|
|
134
|
+
maxFileSize: number | undefined;
|
|
119
135
|
|
|
120
136
|
/**
|
|
121
137
|
* Number of lines of context to include before and after each match.
|
|
@@ -129,7 +145,7 @@ declare module 'vscode' {
|
|
|
129
145
|
export interface TextSearchCompleteNew {
|
|
130
146
|
/**
|
|
131
147
|
* Whether the search hit the limit on the maximum number of search results.
|
|
132
|
-
* `maxResults` on {@linkcode
|
|
148
|
+
* `maxResults` on {@linkcode TextSearchProviderOptions} specifies the max number of results.
|
|
133
149
|
* - If exactly that number of matches exist, this should be false.
|
|
134
150
|
* - If `maxResults` matches are returned and more exist, this should be true.
|
|
135
151
|
* - If search hits an internal limit which is less than `maxResults`, this should be true.
|
|
@@ -138,7 +154,17 @@ declare module 'vscode' {
|
|
|
138
154
|
}
|
|
139
155
|
|
|
140
156
|
/**
|
|
141
|
-
*
|
|
157
|
+
* A query match instance in a file.
|
|
158
|
+
*
|
|
159
|
+
* For example, consider this excerpt:
|
|
160
|
+
*
|
|
161
|
+
* ```ts
|
|
162
|
+
* const bar = 1;
|
|
163
|
+
* console.log(bar);
|
|
164
|
+
* const foo = bar;
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* If the query is `log`, then the line `console.log(bar);` should be represented using a {@link TextSearchMatchNew}.
|
|
142
168
|
*/
|
|
143
169
|
export class TextSearchMatchNew {
|
|
144
170
|
/**
|
|
@@ -171,7 +197,20 @@ declare module 'vscode' {
|
|
|
171
197
|
}
|
|
172
198
|
|
|
173
199
|
/**
|
|
174
|
-
* The
|
|
200
|
+
* The context lines of text that are not a part of a match,
|
|
201
|
+
* but that surround a match line of type {@link TextSearchMatchNew}.
|
|
202
|
+
*
|
|
203
|
+
* For example, consider this excerpt:
|
|
204
|
+
*
|
|
205
|
+
* ```ts
|
|
206
|
+
* const bar = 1;
|
|
207
|
+
* console.log(bar);
|
|
208
|
+
* const foo = bar;
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* If the query is `log`, then the lines `const bar = 1;` and `const foo = bar;`
|
|
212
|
+
* should be represented using two separate {@link TextSearchContextNew} for the search instance.
|
|
213
|
+
* This example assumes that the finder requests one line of surrounding context.
|
|
175
214
|
*/
|
|
176
215
|
export class TextSearchContextNew {
|
|
177
216
|
/**
|
|
@@ -199,7 +238,8 @@ declare module 'vscode' {
|
|
|
199
238
|
}
|
|
200
239
|
|
|
201
240
|
/**
|
|
202
|
-
* A result payload for a text search, pertaining to
|
|
241
|
+
* A result payload for a text search, pertaining to {@link TextSearchMatchNew matches}
|
|
242
|
+
* and its associated {@link TextSearchContextNew context} within a single file.
|
|
203
243
|
*/
|
|
204
244
|
export type TextSearchResultNew = TextSearchMatchNew | TextSearchContextNew;
|
|
205
245
|
|
|
@@ -213,10 +253,11 @@ declare module 'vscode' {
|
|
|
213
253
|
* Provide results that match the given text pattern.
|
|
214
254
|
* @param query The parameters for this query.
|
|
215
255
|
* @param options A set of options to consider while searching.
|
|
216
|
-
* @param progress A progress callback that must be invoked for all results.
|
|
256
|
+
* @param progress A progress callback that must be invoked for all {@link TextSearchResultNew results}.
|
|
257
|
+
* These results can be direct matches, or context that surrounds matches.
|
|
217
258
|
* @param token A cancellation token.
|
|
218
259
|
*/
|
|
219
|
-
provideTextSearchResults(query: TextSearchQueryNew, options:
|
|
260
|
+
provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: Progress<TextSearchResultNew>, token: CancellationToken): ProviderResult<TextSearchCompleteNew>;
|
|
220
261
|
}
|
|
221
262
|
|
|
222
263
|
export namespace workspace {
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
|
|
6
|
-
declare module 'vscode' {
|
|
7
|
-
|
|
8
|
-
// https://github.com/microsoft/vscode/issues/152399
|
|
9
|
-
|
|
10
|
-
// FOR THE CONSUMER
|
|
11
|
-
|
|
12
|
-
export namespace authentication {
|
|
13
|
-
/**
|
|
14
|
-
* Get all accounts that the user is logged in to for the specified provider.
|
|
15
|
-
* Use this paired with {@link getSession} in order to get an authentication session for a specific account.
|
|
16
|
-
*
|
|
17
|
-
* Currently, there are only two authentication providers that are contributed from built in extensions
|
|
18
|
-
* to the editor that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.
|
|
19
|
-
*
|
|
20
|
-
* Note: Getting accounts does not imply that your extension has access to that account or its authentication sessions. You can verify access to the account by calling {@link getSession}.
|
|
21
|
-
*
|
|
22
|
-
* @param providerId The id of the provider to use
|
|
23
|
-
* @returns A thenable that resolves to a readonly array of authentication accounts.
|
|
24
|
-
*/
|
|
25
|
-
export function getAccounts(providerId: string): Thenable<readonly AuthenticationSessionAccountInformation[]>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface AuthenticationGetSessionOptions {
|
|
29
|
-
/**
|
|
30
|
-
* The account that you would like to get a session for. This is passed down to the Authentication Provider to be used for creating the correct session.
|
|
31
|
-
*/
|
|
32
|
-
account?: AuthenticationSessionAccountInformation;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// FOR THE AUTH PROVIDER
|
|
36
|
-
|
|
37
|
-
export interface AuthenticationProviderSessionOptions {
|
|
38
|
-
/**
|
|
39
|
-
* The account that is being asked about. If this is passed in, the provider should
|
|
40
|
-
* attempt to return the sessions that are only related to this account.
|
|
41
|
-
*/
|
|
42
|
-
account?: AuthenticationSessionAccountInformation;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface AuthenticationProvider {
|
|
46
|
-
/**
|
|
47
|
-
* Get a list of sessions.
|
|
48
|
-
* @param scopes An optional list of scopes. If provided, the sessions returned should match
|
|
49
|
-
* these permissions, otherwise all sessions should be returned.
|
|
50
|
-
* @param options Additional options for getting sessions.
|
|
51
|
-
* @returns A promise that resolves to an array of authentication sessions.
|
|
52
|
-
*/
|
|
53
|
-
getSessions(scopes: readonly string[] | undefined, options: AuthenticationProviderSessionOptions): Thenable<AuthenticationSession[]>;
|
|
54
|
-
/**
|
|
55
|
-
* Prompts a user to login.
|
|
56
|
-
*
|
|
57
|
-
* If login is successful, the onDidChangeSessions event should be fired.
|
|
58
|
-
*
|
|
59
|
-
* If login fails, a rejected promise should be returned.
|
|
60
|
-
*
|
|
61
|
-
* If the provider has specified that it does not support multiple accounts,
|
|
62
|
-
* then this should never be called if there is already an existing session matching these
|
|
63
|
-
* scopes.
|
|
64
|
-
* @param scopes A list of scopes, permissions, that the new session should be created with.
|
|
65
|
-
* @param options Additional options for creating a session.
|
|
66
|
-
* @returns A promise that resolves to an authentication session.
|
|
67
|
-
*/
|
|
68
|
-
createSession(scopes: readonly string[], options: AuthenticationProviderSessionOptions): Thenable<AuthenticationSession>;
|
|
69
|
-
}
|
|
70
|
-
}
|