vscode.proposed.d.ts 68.0 KB
Newer Older
1 2 3 4 5
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

6 7 8 9 10 11 12 13 14 15
/**
 * This is the place for API experiments and proposals.
 * These API are NOT stable and subject to change. They are only available in the Insiders
 * distribution and CANNOT be used in published extensions.
 *
 * To test these API in local environment:
 * - Use Insiders release of VS Code.
 * - Add `"enableProposedApi": true` to your package.json.
 * - Copy this file to your project.
 */
16

17 18
declare module 'vscode' {

J
Johannes Rieken 已提交
19 20
	// #region auth provider: https://github.com/microsoft/vscode/issues/88309

21
	export interface AuthenticationSession {
22
		id: string;
23
		getAccessToken(): Thenable<string>;
24
		accountName: string;
25
		scopes: string[]
26 27
	}

28 29 30 31 32 33 34 35 36 37
	/**
	 * An [event](#Event) which fires when an [AuthenticationProvider](#AuthenticationProvider) is added or removed.
	 */
	export interface AuthenticationProvidersChangeEvent {
		/**
		 * The ids of the [authenticationProvider](#AuthenticationProvider)s that have been added.
		 */
		readonly added: string[];

		/**
38
		 * The ids of the [authenticationProvider](#AuthenticationProvider)s that have been removed.
39 40 41 42
		 */
		readonly removed: string[];
	}

43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
	/**
	* An [event](#Event) which fires when an [AuthenticationSession](#AuthenticationSession) is added, removed, or changed.
	*/
	export interface AuthenticationSessionsChangeEvent {
		/**
		 * The ids of the [AuthenticationSession](#AuthenticationSession)s that have been added.
		*/
		readonly added: string[];

		/**
		 * The ids of the [AuthenticationSession](#AuthenticationSession)s that have been removed.
		 */
		readonly removed: string[];

		/**
		 * The ids of the [AuthenticationSession](#AuthenticationSession)s that have been changed.
		 */
		readonly changed: string[];
	}

63
	export interface AuthenticationProvider {
64 65
		/**
		 * Used as an identifier for extensions trying to work with a particular
66
		 * provider: 'microsoft', 'github', etc. id must be unique, registering
67 68
		 * another provider with the same id will fail.
		 */
69 70
		readonly id: string;
		readonly displayName: string;
71 72

		/**
73
		 * An [event](#Event) which fires when the array of sessions has changed, or data
74 75
		 * within a session has changed.
		 */
76
		readonly onDidChangeSessions: Event<AuthenticationSessionsChangeEvent>;
77

78 79 80
		/**
		 * Returns an array of current sessions.
		 */
81
		getSessions(): Thenable<ReadonlyArray<AuthenticationSession>>;
82

83 84 85
		/**
		 * Prompts a user to login.
		 */
86 87
		login(scopes: string[]): Thenable<AuthenticationSession>;
		logout(sessionId: string): Thenable<void>;
88 89 90 91
	}

	export namespace authentication {
		export function registerAuthenticationProvider(provider: AuthenticationProvider): Disposable;
92 93 94 95

		/**
		 * Fires with the provider id that was registered or unregistered.
		 */
96
		export const onDidChangeAuthenticationProviders: Event<AuthenticationProvidersChangeEvent>;
97

98
		/**
99
		 * An array of the ids of authentication providers that are currently registered.
100
		 */
101
		export const providerIds: string[];
102 103 104 105 106 107

		/**
		 * Get existing authentication sessions. Rejects if a provider with providerId is not
		 * registered, or if the user does not consent to sharing authentication information with
		 * the extension.
		 */
108
		export function getSessions(providerId: string, scopes: string[]): Thenable<readonly AuthenticationSession[]>;
109 110 111 112 113 114 115 116 117

		/**
		* Prompt a user to login to create a new authenticaiton session. Rejects if a provider with
		* providerId is not registered, or if the user does not consent to sharing authentication
		* information with the extension.
		*/
		export function login(providerId: string, scopes: string[]): Thenable<AuthenticationSession>;

		/**
118
		* An [event](#Event) which fires when the array of sessions has changed, or data
119 120 121
		* within a session has changed for a provider. Fires with the ids of the providers
		* that have had session data change.
		*/
122
		export const onDidChangeSessions: Event<{ [providerId: string]: AuthenticationSessionsChangeEvent }>;
123 124
	}

J
Johannes Rieken 已提交
125 126
	//#endregion

127
	//#region Alex - resolvers
A
Alex Dima 已提交
128

A
Tweaks  
Alex Dima 已提交
129 130 131 132
	export interface RemoteAuthorityResolverContext {
		resolveAttempt: number;
	}

A
Alex Dima 已提交
133 134 135 136 137 138 139
	export class ResolvedAuthority {
		readonly host: string;
		readonly port: number;

		constructor(host: string, port: number);
	}

140
	export interface ResolvedOptions {
141
		extensionHostEnv?: { [key: string]: string | null };
142 143
	}

144
	export interface TunnelOptions {
A
Alex Ross 已提交
145 146 147 148
		remoteAddress: { port: number, host: string };
		// The desired local port. If this port can't be used, then another will be chosen.
		localAddressPort?: number;
		label?: string;
149 150
	}

A
Alex Ross 已提交
151
	export interface TunnelDescription {
A
Alex Ross 已提交
152 153
		remoteAddress: { port: number, host: string };
		//The complete local address(ex. localhost:1234)
154
		localAddress: { port: number, host: string } | string;
A
Alex Ross 已提交
155 156 157
	}

	export interface Tunnel extends TunnelDescription {
A
Alex Ross 已提交
158 159
		// Implementers of Tunnel should fire onDidDispose when dispose is called.
		onDidDispose: Event<void>;
160
		dispose(): void;
161 162 163
	}

	/**
164 165
	 * Used as part of the ResolverResult if the extension has any candidate,
	 * published, or forwarded ports.
166 167 168 169
	 */
	export interface TunnelInformation {
		/**
		 * Tunnels that are detected by the extension. The remotePort is used for display purposes.
A
Alex Ross 已提交
170
		 * The localAddress should be the complete local address (ex. localhost:1234) for connecting to the port. Tunnels provided through
171 172
		 * detected are read-only from the forwarded ports UI.
		 */
A
Alex Ross 已提交
173
		environmentTunnels?: TunnelDescription[];
A
Alex Ross 已提交
174

175 176 177
	}

	export type ResolverResult = ResolvedAuthority & ResolvedOptions & TunnelInformation;
178

A
Tweaks  
Alex Dima 已提交
179 180 181 182 183 184 185
	export class RemoteAuthorityResolverError extends Error {
		static NotAvailable(message?: string, handled?: boolean): RemoteAuthorityResolverError;
		static TemporarilyNotAvailable(message?: string): RemoteAuthorityResolverError;

		constructor(message?: string);
	}

A
Alex Dima 已提交
186
	export interface RemoteAuthorityResolver {
187
		resolve(authority: string, context: RemoteAuthorityResolverContext): ResolverResult | Thenable<ResolverResult>;
188 189 190 191 192
		/**
		 * Can be optionally implemented if the extension can forward ports better than the core.
		 * When not implemented, the core will use its default forwarding logic.
		 * When implemented, the core will use this to forward ports.
		 */
A
Alex Ross 已提交
193
		tunnelFactory?: (tunnelOptions: TunnelOptions) => Thenable<Tunnel> | undefined;
194 195 196 197 198

		/**
		 * Provides filtering for candidate ports.
		 */
		showCandidatePort?: (host: string, port: number, detail: string) => Thenable<boolean>;
199 200 201 202
	}

	export namespace workspace {
		/**
203
		 * Forwards a port. If the current resolver implements RemoteAuthorityResolver:forwardPort then that will be used to make the tunnel.
A
Alex Ross 已提交
204 205
		 * By default, openTunnel only support localhost; however, RemoteAuthorityResolver:tunnelFactory can be used to support other ips.
		 * @param tunnelOptions The `localPort` is a suggestion only. If that port is not available another will be chosen.
206
		 */
A
Alex Ross 已提交
207
		export function openTunnel(tunnelOptions: TunnelOptions): Thenable<Tunnel>;
208 209 210 211 212 213

		/**
		 * Gets an array of the currently available tunnels. This does not include environment tunnels, only tunnels that have been created by the user.
		 * Note that these are of type TunnelDescription and cannot be disposed.
		 */
		export let tunnels: Thenable<TunnelDescription[]>;
A
Alex Ross 已提交
214

215 216 217 218
		/**
		 * Fired when the list of tunnels has changed.
		 */
		export const onDidChangeTunnels: Event<void>;
A
Alex Dima 已提交
219 220
	}

221 222 223 224 225 226 227 228
	export interface ResourceLabelFormatter {
		scheme: string;
		authority?: string;
		formatting: ResourceLabelFormatting;
	}

	export interface ResourceLabelFormatting {
		label: string; // myLabel:/${path}
J
Johannes Rieken 已提交
229 230
		// TODO@isi
		// eslint-disable-next-line vscode-dts-literal-or-types
231 232 233 234 235 236 237
		separator: '/' | '\\' | '';
		tildify?: boolean;
		normalizeDriveLetter?: boolean;
		workspaceSuffix?: string;
		authorityPrefix?: string;
	}

A
Alex Dima 已提交
238 239
	export namespace workspace {
		export function registerRemoteAuthorityResolver(authorityPrefix: string, resolver: RemoteAuthorityResolver): Disposable;
240
		export function registerResourceLabelFormatter(formatter: ResourceLabelFormatter): Disposable;
241
	}
242

243 244
	//#endregion

A
Alexandru Dima 已提交
245
	//#region Semantic tokens: https://github.com/microsoft/vscode/issues/86415
A
WIP  
Alexandru Dima 已提交
246

247
	export class SemanticTokensLegend {
A
WIP  
Alexandru Dima 已提交
248 249 250 251 252 253
		public readonly tokenTypes: string[];
		public readonly tokenModifiers: string[];

		constructor(tokenTypes: string[], tokenModifiers: string[]);
	}

254 255 256 257 258 259 260
	export class SemanticTokensBuilder {
		constructor();
		push(line: number, char: number, length: number, tokenType: number, tokenModifiers: number): void;
		build(): Uint32Array;
	}

	export class SemanticTokens {
A
Alexandru Dima 已提交
261 262 263
		/**
		 * The result id of the tokens.
		 *
264
		 * This is the id that will be passed to `DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits` (if implemented).
A
Alexandru Dima 已提交
265
		 */
266 267 268 269 270 271 272
		readonly resultId?: string;
		readonly data: Uint32Array;

		constructor(data: Uint32Array, resultId?: string);
	}

	export class SemanticTokensEdits {
A
Alexandru Dima 已提交
273 274 275
		/**
		 * The result id of the tokens.
		 *
276
		 * This is the id that will be passed to `DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits` (if implemented).
A
Alexandru Dima 已提交
277
		 */
278 279
		readonly resultId?: string;
		readonly edits: SemanticTokensEdit[];
A
WIP  
Alexandru Dima 已提交
280

281
		constructor(edits: SemanticTokensEdit[], resultId?: string);
A
WIP  
Alexandru Dima 已提交
282 283
	}

284 285 286 287
	export class SemanticTokensEdit {
		readonly start: number;
		readonly deleteCount: number;
		readonly data?: Uint32Array;
A
WIP  
Alexandru Dima 已提交
288

289 290 291
		constructor(start: number, deleteCount: number, data?: Uint32Array);
	}

A
WIP  
Alexandru Dima 已提交
292
	/**
293
	 * The document semantic tokens provider interface defines the contract between extensions and
294
	 * semantic tokens.
A
WIP  
Alexandru Dima 已提交
295
	 */
296
	export interface DocumentSemanticTokensProvider {
297 298 299 300 301
		/**
		 * An optional event to signal that the semantic tokens from this provider have changed.
		 */
		onDidChangeSemanticTokens?: Event<void>;

A
Alex Dima 已提交
302
		/**
A
Alexandru Dima 已提交
303 304 305 306 307
		 * A file can contain many tokens, perhaps even hundreds of thousands of tokens. Therefore, to improve
		 * the memory consumption around describing semantic tokens, we have decided to avoid allocating an object
		 * for each token and we represent tokens from a file as an array of integers. Furthermore, the position
		 * of each token is expressed relative to the token before it because most tokens remain stable relative to
		 * each other when edits are made in a file.
A
Alex Dima 已提交
308
		 *
A
Alexandru Dima 已提交
309
		 * ---
310
		 * In short, each token takes 5 integers to represent, so a specific token `i` in the file consists of the following array indices:
A
Alex Dima 已提交
311 312 313
		 *  - at index `5*i`   - `deltaLine`: token line number, relative to the previous token
		 *  - at index `5*i+1` - `deltaStart`: token start character, relative to the previous token (relative to 0 or the previous token's start if they are on the same line)
		 *  - at index `5*i+2` - `length`: the length of the token. A token cannot be multiline.
314
		 *  - at index `5*i+3` - `tokenType`: will be looked up in `SemanticTokensLegend.tokenTypes`. We currently ask that `tokenType` < 65536.
A
Alex Dima 已提交
315 316
		 *  - at index `5*i+4` - `tokenModifiers`: each set bit will be looked up in `SemanticTokensLegend.tokenModifiers`
		 *
A
Alexandru Dima 已提交
317 318 319
		 * ---
		 * ### How to encode tokens
		 *
320
		 * Here is an example for encoding a file with 3 tokens in a uint32 array:
A
Alex Dima 已提交
321
		 * ```
A
Alex Dima 已提交
322 323 324
		 *    { line: 2, startChar:  5, length: 3, tokenType: "property",  tokenModifiers: ["private", "static"] },
		 *    { line: 2, startChar: 10, length: 4, tokenType: "type",      tokenModifiers: [] },
		 *    { line: 5, startChar:  2, length: 7, tokenType: "class",     tokenModifiers: [] }
A
Alex Dima 已提交
325 326 327
		 * ```
		 *
		 * 1. First of all, a legend must be devised. This legend must be provided up-front and capture all possible token types.
A
Alexandru Dima 已提交
328
		 * For this example, we will choose the following legend which must be passed in when registering the provider:
A
Alex Dima 已提交
329
		 * ```
A
Alex Dima 已提交
330
		 *    tokenTypes: ['property', 'type', 'class'],
A
Alexandru Dima 已提交
331
		 *    tokenModifiers: ['private', 'static']
A
Alex Dima 已提交
332 333
		 * ```
		 *
A
Alexandru Dima 已提交
334
		 * 2. The first transformation step is to encode `tokenType` and `tokenModifiers` as integers using the legend. Token types are looked
335
		 * up by index, so a `tokenType` value of `1` means `tokenTypes[1]`. Multiple token modifiers can be set by using bit flags,
A
Alexandru Dima 已提交
336 337
		 * so a `tokenModifier` value of `3` is first viewed as binary `0b00000011`, which means `[tokenModifiers[0], tokenModifiers[1]]` because
		 * bits 0 and 1 are set. Using this legend, the tokens now are:
A
Alex Dima 已提交
338
		 * ```
A
Alexandru Dima 已提交
339 340 341
		 *    { line: 2, startChar:  5, length: 3, tokenType: 0, tokenModifiers: 3 },
		 *    { line: 2, startChar: 10, length: 4, tokenType: 1, tokenModifiers: 0 },
		 *    { line: 5, startChar:  2, length: 7, tokenType: 2, tokenModifiers: 0 }
A
Alex Dima 已提交
342 343
		 * ```
		 *
A
Alex Dima 已提交
344
		 * 3. The next step is to represent each token relative to the previous token in the file. In this case, the second token
A
Alexandru Dima 已提交
345 346 347
		 * is on the same line as the first token, so the `startChar` of the second token is made relative to the `startChar`
		 * of the first token, so it will be `10 - 5`. The third token is on a different line than the second token, so the
		 * `startChar` of the third token will not be altered:
A
Alex Dima 已提交
348
		 * ```
A
Alexandru Dima 已提交
349 350 351
		 *    { deltaLine: 2, deltaStartChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 },
		 *    { deltaLine: 0, deltaStartChar: 5, length: 4, tokenType: 1, tokenModifiers: 0 },
		 *    { deltaLine: 3, deltaStartChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 }
A
Alex Dima 已提交
352 353
		 * ```
		 *
A
Alexandru Dima 已提交
354
		 * 4. Finally, the last step is to inline each of the 5 fields for a token in a single array, which is a memory friendly representation:
A
Alex Dima 已提交
355 356
		 * ```
		 *    // 1st token,  2nd token,  3rd token
A
Alexandru Dima 已提交
357
		 *    [  2,5,3,0,3,  0,5,4,1,0,  3,2,7,2,0 ]
A
Alex Dima 已提交
358
		 * ```
A
Alex Dima 已提交
359 360 361
		 *
		 * *NOTE*: When doing edits, it is possible that multiple edits occur until VS Code decides to invoke the semantic tokens provider.
		 * *NOTE*: If the provider cannot temporarily compute semantic tokens, it can indicate this by throwing an error with the message 'Busy'.
362
		 */
363
		provideDocumentSemanticTokens(document: TextDocument, token: CancellationToken): ProviderResult<SemanticTokens>;
364 365 366 367

		/**
		 * Instead of always returning all the tokens in a file, it is possible for a `DocumentSemanticTokensProvider` to implement
		 * this method (`updateSemanticTokens`) and then return incremental updates to the previously provided semantic tokens.
A
Alex Dima 已提交
368
		 *
A
Alexandru Dima 已提交
369 370 371 372 373 374 375
		 * ---
		 * ### How tokens change when the document changes
		 *
		 * Let's look at how tokens might change.
		 *
		 * Continuing with the above example, suppose a new line was inserted at the top of the file.
		 * That would make all the tokens move down by one line (notice how the line has changed for each one):
A
Alex Dima 已提交
376
		 * ```
A
Alex Dima 已提交
377 378 379
		 *    { line: 3, startChar:  5, length: 3, tokenType: "property", tokenModifiers: ["private", "static"] },
		 *    { line: 3, startChar: 10, length: 4, tokenType: "type",     tokenModifiers: [] },
		 *    { line: 6, startChar:  2, length: 7, tokenType: "class",    tokenModifiers: [] }
A
Alex Dima 已提交
380
		 * ```
A
Alexandru Dima 已提交
381
		 * The integer encoding of the tokens does not change substantially because of the delta-encoding of positions:
A
Alex Dima 已提交
382
		 * ```
A
Alexandru Dima 已提交
383 384
		 *    // 1st token,  2nd token,  3rd token
		 *    [  3,5,3,0,3,  0,5,4,1,0,  3,2,7,2,0 ]
A
Alex Dima 已提交
385
		 * ```
A
Alexandru Dima 已提交
386 387
		 * It is possible to express these new tokens in terms of an edit applied to the previous tokens:
		 * ```
388 389
		 *    [  2,5,3,0,3,  0,5,4,1,0,  3,2,7,2,0 ] // old tokens
		 *    [  3,5,3,0,3,  0,5,4,1,0,  3,2,7,2,0 ] // new tokens
A
Alex Dima 已提交
390
		 *
A
Alexandru Dima 已提交
391 392
		 *    edit: { start:  0, deleteCount: 1, data: [3] } // replace integer at offset 0 with 3
		 * ```
A
Alexandru Dima 已提交
393
		 *
A
Alexandru Dima 已提交
394 395
		 * Furthermore, let's assume that a new token has appeared on line 4:
		 * ```
A
Alex Dima 已提交
396 397 398 399
		 *    { line: 3, startChar:  5, length: 3, tokenType: "property", tokenModifiers: ["private", "static"] },
		 *    { line: 3, startChar: 10, length: 4, tokenType: "type",      tokenModifiers: [] },
		 *    { line: 4, startChar:  3, length: 5, tokenType: "property", tokenModifiers: ["static"] },
		 *    { line: 6, startChar:  2, length: 7, tokenType: "class",    tokenModifiers: [] }
A
Alexandru Dima 已提交
400 401
		 * ```
		 * The integer encoding of the tokens is:
A
Alex Dima 已提交
402
		 * ```
A
Alexandru Dima 已提交
403 404
		 *    // 1st token,  2nd token,  3rd token,  4th token
		 *    [  3,5,3,0,3,  0,5,4,1,0,  1,3,5,0,2,  2,2,7,2,0, ]
A
Alex Dima 已提交
405
		 * ```
A
Alexandru Dima 已提交
406
		 * Again, it is possible to express these new tokens in terms of an edit applied to the previous tokens:
A
Alex Dima 已提交
407
		 * ```
408 409
		 *    [  3,5,3,0,3,  0,5,4,1,0,  3,2,7,2,0 ]               // old tokens
		 *    [  3,5,3,0,3,  0,5,4,1,0,  1,3,5,0,2,  2,2,7,2,0, ]  // new tokens
A
Alexandru Dima 已提交
410 411
		 *
		 *    edit: { start: 10, deleteCount: 1, data: [1,3,5,0,2,2] } // replace integer at offset 10 with [1,3,5,0,2,2]
A
Alex Dima 已提交
412
		 * ```
A
Alexandru Dima 已提交
413
		 *
414 415
		 * *NOTE*: If the provider cannot compute `SemanticTokensEdits`, it can "give up" and return all the tokens in the document again.
		 * *NOTE*: All edits in `SemanticTokensEdits` contain indices in the old integers array, so they all refer to the previous result state.
A
Alex Dima 已提交
416
		 */
417 418 419 420 421 422 423 424 425 426
		provideDocumentSemanticTokensEdits?(document: TextDocument, previousResultId: string, token: CancellationToken): ProviderResult<SemanticTokens | SemanticTokensEdits>;
	}

	/**
	 * The document range semantic tokens provider interface defines the contract between extensions and
	 * semantic tokens.
	 */
	export interface DocumentRangeSemanticTokensProvider {
		/**
		 * See [provideDocumentSemanticTokens](#DocumentSemanticTokensProvider.provideDocumentSemanticTokens).
A
Alex Dima 已提交
427
		 */
428
		provideDocumentRangeSemanticTokens(document: TextDocument, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
A
WIP  
Alexandru Dima 已提交
429 430 431 432
	}

	export namespace languages {
		/**
433
		 * Register a semantic tokens provider for a whole document.
A
WIP  
Alexandru Dima 已提交
434 435 436 437 438 439
		 *
		 * Multiple providers can be registered for a language. In that case providers are sorted
		 * by their [score](#languages.match) and the best-matching provider is used. Failure
		 * of the selected provider will cause a failure of the whole operation.
		 *
		 * @param selector A selector that defines the documents this provider is applicable to.
440
		 * @param provider A document semantic tokens provider.
A
WIP  
Alexandru Dima 已提交
441 442
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
443 444 445 446
		export function registerDocumentSemanticTokensProvider(selector: DocumentSelector, provider: DocumentSemanticTokensProvider, legend: SemanticTokensLegend): Disposable;

		/**
		 * Register a semantic tokens provider for a document range.
A
WIP  
Alexandru Dima 已提交
447 448 449 450 451 452
		 *
		 * Multiple providers can be registered for a language. In that case providers are sorted
		 * by their [score](#languages.match) and the best-matching provider is used. Failure
		 * of the selected provider will cause a failure of the whole operation.
		 *
		 * @param selector A selector that defines the documents this provider is applicable to.
453
		 * @param provider A document range semantic tokens provider.
A
WIP  
Alexandru Dima 已提交
454 455
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
456
		export function registerDocumentRangeSemanticTokensProvider(selector: DocumentSelector, provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): Disposable;
A
WIP  
Alexandru Dima 已提交
457 458 459
	}

	//#endregion
460

J
Johannes Rieken 已提交
461
	//#region editor insets: https://github.com/microsoft/vscode/issues/85682
462

463 464
	export interface WebviewEditorInset {
		readonly editor: TextEditor;
465 466
		readonly line: number;
		readonly height: number;
467 468 469
		readonly webview: Webview;
		readonly onDidDispose: Event<void>;
		dispose(): void;
470 471
	}

472
	export namespace window {
473
		export function createWebviewTextEditorInset(editor: TextEditor, line: number, height: number, options?: WebviewOptions): WebviewEditorInset;
A
Alex Dima 已提交
474 475 476 477
	}

	//#endregion

J
Johannes Rieken 已提交
478
	//#region read/write in chunks: https://github.com/microsoft/vscode/issues/84515
479 480

	export interface FileSystemProvider {
J
Johannes Rieken 已提交
481
		open?(resource: Uri, options: { create: boolean }): number | Thenable<number>;
482 483 484 485 486 487 488
		close?(fd: number): void | Thenable<void>;
		read?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable<number>;
		write?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable<number>;
	}

	//#endregion

R
Rob Lourens 已提交
489
	//#region TextSearchProvider: https://github.com/microsoft/vscode/issues/59921
490

491 492 493
	/**
	 * The parameters of a query for text search.
	 */
494
	export interface TextSearchQuery {
495 496 497
		/**
		 * The text pattern to search for.
		 */
498
		pattern: string;
499

R
Rob Lourens 已提交
500 501 502 503 504
		/**
		 * Whether or not `pattern` should match multiple lines of text.
		 */
		isMultiline?: boolean;

505 506 507
		/**
		 * Whether or not `pattern` should be interpreted as a regular expression.
		 */
R
Rob Lourens 已提交
508
		isRegExp?: boolean;
509 510 511 512

		/**
		 * Whether or not the search should be case-sensitive.
		 */
R
Rob Lourens 已提交
513
		isCaseSensitive?: boolean;
514 515 516 517

		/**
		 * Whether or not to search for whole word matches only.
		 */
R
Rob Lourens 已提交
518
		isWordMatch?: boolean;
519 520
	}

521 522 523 524 525 526 527 528 529 530
	/**
	 * A file glob pattern to match file paths against.
	 * TODO@roblou - merge this with the GlobPattern docs/definition in vscode.d.ts.
	 * @see [GlobPattern](#GlobPattern)
	 */
	export type GlobString = string;

	/**
	 * Options common to file and text search
	 */
R
Rob Lourens 已提交
531
	export interface SearchOptions {
532 533 534
		/**
		 * The root folder to search within.
		 */
535
		folder: Uri;
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550

		/**
		 * Files that match an `includes` glob pattern should be included in the search.
		 */
		includes: GlobString[];

		/**
		 * Files that match an `excludes` glob pattern should be excluded from the search.
		 */
		excludes: GlobString[];

		/**
		 * Whether external files that exclude files, like .gitignore, should be respected.
		 * See the vscode setting `"search.useIgnoreFiles"`.
		 */
R
Rob Lourens 已提交
551
		useIgnoreFiles: boolean;
552 553 554 555 556

		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
557
		followSymlinks: boolean;
P
pkoushik 已提交
558 559 560 561 562 563

		/**
		 * Whether global files that exclude files, like .gitignore, should be respected.
		 * See the vscode setting `"search.useGlobalIgnoreFiles"`.
		 */
		useGlobalIgnoreFiles: boolean;
564
	}
565

R
Rob Lourens 已提交
566 567
	/**
	 * Options to specify the size of the result text preview.
R
Rob Lourens 已提交
568
	 * These options don't affect the size of the match itself, just the amount of preview text.
R
Rob Lourens 已提交
569
	 */
570
	export interface TextSearchPreviewOptions {
571
		/**
R
Rob Lourens 已提交
572
		 * The maximum number of lines in the preview.
R
Rob Lourens 已提交
573
		 * Only search providers that support multiline search will ever return more than one line in the match.
574
		 */
R
Rob Lourens 已提交
575
		matchLines: number;
R
Rob Lourens 已提交
576 577 578 579

		/**
		 * The maximum number of characters included per line.
		 */
R
Rob Lourens 已提交
580
		charsPerLine: number;
581 582
	}

583 584 585
	/**
	 * Options that apply to text search.
	 */
R
Rob Lourens 已提交
586
	export interface TextSearchOptions extends SearchOptions {
587
		/**
588
		 * The maximum number of results to be returned.
589
		 */
590 591
		maxResults: number;

R
Rob Lourens 已提交
592 593 594
		/**
		 * Options to specify the size of the result text preview.
		 */
595
		previewOptions?: TextSearchPreviewOptions;
596 597 598 599

		/**
		 * Exclude files larger than `maxFileSize` in bytes.
		 */
600
		maxFileSize?: number;
601 602 603 604 605

		/**
		 * Interpret files using this encoding.
		 * See the vscode setting `"files.encoding"`
		 */
606
		encoding?: string;
607 608 609 610 611 612 613 614 615 616

		/**
		 * Number of lines of context to include before each match.
		 */
		beforeContext?: number;

		/**
		 * Number of lines of context to include after each match.
		 */
		afterContext?: number;
617 618
	}

619 620 621 622 623 624 625 626 627 628 629 630 631 632
	/**
	 * Information collected when text search is complete.
	 */
	export interface TextSearchComplete {
		/**
		 * Whether the search hit the limit on the maximum number of search results.
		 * `maxResults` on [`TextSearchOptions`](#TextSearchOptions) specifies the max number of results.
		 * - If exactly that number of matches exist, this should be false.
		 * - If `maxResults` matches are returned and more exist, this should be true.
		 * - If search hits an internal limit which is less than `maxResults`, this should be true.
		 */
		limitHit?: boolean;
	}

R
Rob Lourens 已提交
633 634 635
	/**
	 * A preview of the text result.
	 */
636
	export interface TextSearchMatchPreview {
637
		/**
R
Rob Lourens 已提交
638
		 * The matching lines of text, or a portion of the matching line that contains the match.
639 640 641 642 643
		 */
		text: string;

		/**
		 * The Range within `text` corresponding to the text of the match.
644
		 * The number of matches must match the TextSearchMatch's range property.
645
		 */
646
		matches: Range | Range[];
647 648 649 650 651
	}

	/**
	 * A match from a text search
	 */
652
	export interface TextSearchMatch {
653 654 655
		/**
		 * The uri for the matching document.
		 */
656
		uri: Uri;
657 658

		/**
659
		 * The range of the match within the document, or multiple ranges for multiple matches.
660
		 */
661
		ranges: Range | Range[];
R
Rob Lourens 已提交
662

663
		/**
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685
		 * A preview of the text match.
		 */
		preview: TextSearchMatchPreview;
	}

	/**
	 * A line of context surrounding a TextSearchMatch.
	 */
	export interface TextSearchContext {
		/**
		 * The uri for the matching document.
		 */
		uri: Uri;

		/**
		 * One line of text.
		 * previewOptions.charsPerLine applies to this
		 */
		text: string;

		/**
		 * The line number of this line of context.
686
		 */
687
		lineNumber: number;
688 689
	}

690 691
	export type TextSearchResult = TextSearchMatch | TextSearchContext;

R
Rob Lourens 已提交
692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735
	/**
	 * A TextSearchProvider provides search results for text results inside files in the workspace.
	 */
	export interface TextSearchProvider {
		/**
		 * Provide results that match the given text pattern.
		 * @param query The parameters for this query.
		 * @param options A set of options to consider while searching.
		 * @param progress A progress callback that must be invoked for all results.
		 * @param token A cancellation token.
		 */
		provideTextSearchResults(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): ProviderResult<TextSearchComplete>;
	}

	//#endregion

	//#region FileSearchProvider: https://github.com/microsoft/vscode/issues/73524

	/**
	 * The parameters of a query for file search.
	 */
	export interface FileSearchQuery {
		/**
		 * The search pattern to match against file paths.
		 */
		pattern: string;
	}

	/**
	 * Options that apply to file search.
	 */
	export interface FileSearchOptions extends SearchOptions {
		/**
		 * The maximum number of results to be returned.
		 */
		maxResults?: number;

		/**
		 * A CancellationToken that represents the session for this search query. If the provider chooses to, this object can be used as the key for a cache,
		 * and searches with the same session object can search the same cache. When the token is cancelled, the session is complete and the cache can be cleared.
		 */
		session?: CancellationToken;
	}

736
	/**
R
Rob Lourens 已提交
737 738 739 740 741 742 743
	 * A FileSearchProvider provides search results for files in the given folder that match a query string. It can be invoked by quickopen or other extensions.
	 *
	 * A FileSearchProvider is the more powerful of two ways to implement file search in VS Code. Use a FileSearchProvider if you wish to search within a folder for
	 * all files that match the user's query.
	 *
	 * The FileSearchProvider will be invoked on every keypress in quickopen. When `workspace.findFiles` is called, it will be invoked with an empty query string,
	 * and in that case, every file in the folder should be returned.
744
	 */
745
	export interface FileSearchProvider {
746 747 748 749 750 751
		/**
		 * Provide the set of files that match a certain file path pattern.
		 * @param query The parameters for this query.
		 * @param options A set of options to consider while searching files.
		 * @param token A cancellation token.
		 */
752
		provideFileSearchResults(query: FileSearchQuery, options: FileSearchOptions, token: CancellationToken): ProviderResult<Uri[]>;
753
	}
754

R
Rob Lourens 已提交
755
	export namespace workspace {
756
		/**
R
Rob Lourens 已提交
757 758 759 760 761 762 763
		 * Register a search provider.
		 *
		 * Only one provider can be registered per scheme.
		 *
		 * @param scheme The provider will be invoked for workspace folders that have this file scheme.
		 * @param provider The provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
764
		 */
R
Rob Lourens 已提交
765 766 767 768 769 770 771 772 773 774 775 776
		export function registerFileSearchProvider(scheme: string, provider: FileSearchProvider): Disposable;

		/**
		 * Register a text search provider.
		 *
		 * Only one provider can be registered per scheme.
		 *
		 * @param scheme The provider will be invoked for workspace folders that have this file scheme.
		 * @param provider The provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
		export function registerTextSearchProvider(scheme: string, provider: TextSearchProvider): Disposable;
777 778
	}

R
Rob Lourens 已提交
779 780 781 782
	//#endregion

	//#region findTextInFiles: https://github.com/microsoft/vscode/issues/59924

783 784 785
	/**
	 * Options that can be set on a findTextInFiles search.
	 */
R
Rob Lourens 已提交
786
	export interface FindTextInFilesOptions {
787 788 789 790 791
		/**
		 * A [glob pattern](#GlobPattern) that defines the files to search for. The glob pattern
		 * will be matched against the file paths of files relative to their workspace. Use a [relative pattern](#RelativePattern)
		 * to restrict the search results to a [workspace folder](#WorkspaceFolder).
		 */
792
		include?: GlobPattern;
793 794 795

		/**
		 * A [glob pattern](#GlobPattern) that defines files and folders to exclude. The glob pattern
796 797
		 * will be matched against the file paths of resulting matches relative to their workspace. When `undefined`, default excludes will
		 * apply.
798
		 */
799 800 801 802 803 804
		exclude?: GlobPattern;

		/**
		 * Whether to use the default and user-configured excludes. Defaults to true.
		 */
		useDefaultExcludes?: boolean;
805 806 807 808

		/**
		 * The maximum number of results to search for
		 */
R
Rob Lourens 已提交
809
		maxResults?: number;
810 811 812 813 814

		/**
		 * Whether external files that exclude files, like .gitignore, should be respected.
		 * See the vscode setting `"search.useIgnoreFiles"`.
		 */
R
Rob Lourens 已提交
815
		useIgnoreFiles?: boolean;
816

P
pkoushik 已提交
817 818 819 820
		/**
		 * Whether global files that exclude files, like .gitignore, should be respected.
		 * See the vscode setting `"search.useGlobalIgnoreFiles"`.
		 */
821
		useGlobalIgnoreFiles?: boolean;
P
pkoushik 已提交
822

823 824 825 826
		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
827
		followSymlinks?: boolean;
828 829 830 831 832

		/**
		 * Interpret files using this encoding.
		 * See the vscode setting `"files.encoding"`
		 */
R
Rob Lourens 已提交
833
		encoding?: string;
834

R
Rob Lourens 已提交
835 836 837
		/**
		 * Options to specify the size of the result text preview.
		 */
838
		previewOptions?: TextSearchPreviewOptions;
839 840 841 842 843 844 845 846 847 848

		/**
		 * Number of lines of context to include before each match.
		 */
		beforeContext?: number;

		/**
		 * Number of lines of context to include after each match.
		 */
		afterContext?: number;
R
Rob Lourens 已提交
849 850
	}

851
	export namespace workspace {
852 853 854 855 856 857 858
		/**
		 * Search text in files across all [workspace folders](#workspace.workspaceFolders) in the workspace.
		 * @param query The query parameters for the search - the search string, whether it's case-sensitive, or a regex, or matches whole words.
		 * @param callback A callback, called for each result
		 * @param token A token that can be used to signal cancellation to the underlying search engine.
		 * @return A thenable that resolves when the search is complete.
		 */
859
		export function findTextInFiles(query: TextSearchQuery, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
860 861 862 863 864 865 866 867 868

		/**
		 * Search text in files across all [workspace folders](#workspace.workspaceFolders) in the workspace.
		 * @param query The query parameters for the search - the search string, whether it's case-sensitive, or a regex, or matches whole words.
		 * @param options An optional set of query options. Include and exclude patterns, maxResults, etc.
		 * @param callback A callback, called for each result
		 * @param token A token that can be used to signal cancellation to the underlying search engine.
		 * @return A thenable that resolves when the search is complete.
		 */
869
		export function findTextInFiles(query: TextSearchQuery, options: FindTextInFilesOptions, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
870 871
	}

J
Johannes Rieken 已提交
872
	//#endregion
873

J
Johannes Rieken 已提交
874
	//#region diff command: https://github.com/microsoft/vscode/issues/84899
P
Pine Wu 已提交
875

J
Joao Moreno 已提交
876 877 878
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
879 880 881 882 883 884 885
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903
	export namespace commands {

		/**
		 * Registers a diff information command that can be invoked via a keyboard shortcut,
		 * a menu item, an action, or directly.
		 *
		 * Diff information commands are different from ordinary [commands](#commands.registerCommand) as
		 * they only execute when there is an active diff editor when the command is called, and the diff
		 * information has been computed. Also, the command handler of an editor command has access to
		 * the diff information.
		 *
		 * @param command A unique identifier for the command.
		 * @param callback A command handler function with access to the [diff information](#LineChange).
		 * @param thisArg The `this` context used when invoking the handler function.
		 * @return Disposable which unregisters this command on disposal.
		 */
		export function registerDiffInformationCommand(command: string, callback: (diff: LineChange[], ...args: any[]) => any, thisArg?: any): Disposable;
	}
904

J
Johannes Rieken 已提交
905 906
	//#endregion

J
Johannes Rieken 已提交
907
	//#region file-decorations: https://github.com/microsoft/vscode/issues/54938
908

909
	export class Decoration {
910
		letter?: string;
911 912 913
		title?: string;
		color?: ThemeColor;
		priority?: number;
914
		bubble?: boolean;
915 916
	}

917
	export interface DecorationProvider {
918
		onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
919
		provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<Decoration>;
920 921 922
	}

	export namespace window {
923
		export function registerDecorationProvider(provider: DecorationProvider): Disposable;
924 925 926
	}

	//#endregion
927

928
	//#region deprecated debug API
A
Andre Weinand 已提交
929

930
	export interface DebugConfigurationProvider {
931
		/**
A
Andre Weinand 已提交
932 933
		 * Deprecated, use DebugAdapterDescriptorFactory.provideDebugAdapter instead.
		 * @deprecated Use DebugAdapterDescriptorFactory.createDebugAdapterDescriptor instead
934 935
		 */
		debugAdapterExecutable?(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult<DebugAdapterExecutable>;
936 937
	}

J
Johannes Rieken 已提交
938 939
	//#endregion

R
Rob Lourens 已提交
940
	//#region LogLevel: https://github.com/microsoft/vscode/issues/85992
J
Johannes Rieken 已提交
941

942 943 944 945 946 947 948 949 950 951 952 953 954
	/**
	 * The severity level of a log message
	 */
	export enum LogLevel {
		Trace = 1,
		Debug = 2,
		Info = 3,
		Warning = 4,
		Error = 5,
		Critical = 6,
		Off = 7
	}

M
Matt Bierner 已提交
955 956 957 958 959
	export namespace env {
		/**
		 * Current logging level.
		 */
		export const logLevel: LogLevel;
960 961 962 963 964

		/**
		 * An [event](#Event) that fires when the log level has changed.
		 */
		export const onDidChangeLogLevel: Event<LogLevel>;
M
Matt Bierner 已提交
965 966
	}

J
Johannes Rieken 已提交
967 968 969
	//#endregion

	//#region Joao: SCM validation
970

J
Joao Moreno 已提交
971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015
	/**
	 * Represents the validation type of the Source Control input.
	 */
	export enum SourceControlInputBoxValidationType {

		/**
		 * Something not allowed by the rules of a language or other means.
		 */
		Error = 0,

		/**
		 * Something suspicious but allowed.
		 */
		Warning = 1,

		/**
		 * Something to inform about but not a problem.
		 */
		Information = 2
	}

	export interface SourceControlInputBoxValidation {

		/**
		 * The validation message to display.
		 */
		readonly message: string;

		/**
		 * The validation type.
		 */
		readonly type: SourceControlInputBoxValidationType;
	}

	/**
	 * Represents the input box in the Source Control viewlet.
	 */
	export interface SourceControlInputBox {

		/**
		 * A validation function for the input box. It's possible to change
		 * the validation provider simply by setting this property to a different function.
		 */
		validateInput?(value: string, cursorPosition: number): ProviderResult<SourceControlInputBoxValidation | undefined | null>;
	}
M
Matt Bierner 已提交
1016

J
Johannes Rieken 已提交
1017 1018
	//#endregion

1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031
	//#region Joao: SCM selected provider

	export interface SourceControl {

		/**
		 * Whether the source control is selected.
		 */
		readonly selected: boolean;

		/**
		 * An event signaling when the selection state changes.
		 */
		readonly onDidChangeSelection: Event<boolean>;
1032 1033 1034 1035
	}

	//#endregion

1036 1037 1038 1039 1040 1041 1042 1043
	//#region Joao: SCM Input Box

	/**
	 * Represents the input box in the Source Control viewlet.
	 */
	export interface SourceControlInputBox {

		/**
1044 1045
		 * Controls whether the input box is visible (default is `true`).
		 */
1046 1047 1048 1049 1050
		visible: boolean;
	}

	//#endregion

D
Daniel Imms 已提交
1051
	//#region Terminal data write event https://github.com/microsoft/vscode/issues/78502
1052

1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063
	export interface TerminalDataWriteEvent {
		/**
		 * The [terminal](#Terminal) for which the data was written.
		 */
		readonly terminal: Terminal;
		/**
		 * The data being written.
		 */
		readonly data: string;
	}

D
Daniel Imms 已提交
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089
	namespace window {
		/**
		 * An event which fires when the terminal's pty slave pseudo-device is written to. In other
		 * words, this provides access to the raw data stream from the process running within the
		 * terminal, including VT sequences.
		 */
		export const onDidWriteTerminalData: Event<TerminalDataWriteEvent>;
	}

	//#endregion

	//#region Terminal dimensions property and change event https://github.com/microsoft/vscode/issues/55718

	/**
	 * An [event](#Event) which fires when a [Terminal](#Terminal)'s dimensions change.
	 */
	export interface TerminalDimensionsChangeEvent {
		/**
		 * The [terminal](#Terminal) for which the dimensions have changed.
		 */
		readonly terminal: Terminal;
		/**
		 * The new value for the [terminal's dimensions](#Terminal.dimensions).
		 */
		readonly dimensions: TerminalDimensions;
	}
1090

D
Daniel Imms 已提交
1091 1092 1093 1094 1095 1096 1097 1098
	namespace window {
		/**
		 * An event which fires when the [dimensions](#Terminal.dimensions) of the terminal change.
		 */
		export const onDidChangeTerminalDimensions: Event<TerminalDimensionsChangeEvent>;
	}

	export interface Terminal {
1099
		/**
1100 1101 1102
		 * The current dimensions of the terminal. This will be `undefined` immediately after the
		 * terminal is created as the dimensions are not known until shortly after the terminal is
		 * created.
1103
		 */
1104
		readonly dimensions: TerminalDimensions | undefined;
D
Daniel Imms 已提交
1105 1106
	}

1107 1108
	//#endregion

1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124
	//#region Terminal link handlers https://github.com/microsoft/vscode/issues/91606

	export namespace window {
		export function registerTerminalLinkHandler(handler: TerminalLinkHandler): Disposable;
	}

	export interface TerminalLinkHandler {
		/**
		 * @return true when the link was handled (and should not be considered by
		 * other providers including the default), false when the link was not handled.
		 */
		handleLink(terminal: Terminal, link: string): ProviderResult<boolean>;
	}

	//#endregion

1125 1126 1127 1128 1129 1130 1131
	//#region Joh -> exclusive document filters

	export interface DocumentFilter {
		exclusive?: boolean;
	}

	//#endregion
C
Christof Marti 已提交
1132

1133 1134 1135 1136 1137 1138 1139 1140
	//#region Alex - OnEnter enhancement
	export interface OnEnterRule {
		/**
		 * This rule will only execute if the text above the this line matches this regular expression.
		 */
		oneLineAboveText?: RegExp;
	}
	//#endregion
1141

1142
	//#region Tree View: https://github.com/microsoft/vscode/issues/61313
1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153
	/**
	 * Label describing the [Tree item](#TreeItem)
	 */
	export interface TreeItemLabel {

		/**
		 * A human-readable string describing the [Tree item](#TreeItem).
		 */
		label: string;

		/**
S
Sandeep Somavarapu 已提交
1154
		 * Ranges in the label to highlight. A range is defined as a tuple of two number where the
S
Sandeep Somavarapu 已提交
1155
		 * first is the inclusive start index and the second the exclusive end index
1156
		 */
S
Sandeep Somavarapu 已提交
1157
		highlights?: [number, number][];
1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172

	}

	export class TreeItem2 extends TreeItem {
		/**
		 * Label describing this item. When `falsy`, it is derived from [resourceUri](#TreeItem.resourceUri).
		 */
		label?: string | TreeItemLabel | /* for compilation */ any;

		/**
		 * @param label Label describing this item
		 * @param collapsibleState [TreeItemCollapsibleState](#TreeItemCollapsibleState) of the tree item. Default is [TreeItemCollapsibleState.None](#TreeItemCollapsibleState.None)
		 */
		constructor(label: TreeItemLabel, collapsibleState?: TreeItemCollapsibleState);
	}
1173
	//#endregion
1174

1175
	//#region CustomExecution: https://github.com/microsoft/vscode/issues/81007
1176 1177 1178
	/**
	 * A task to execute
	 */
G
Gabriel DeBacker 已提交
1179
	export class Task2 extends Task {
1180
		detail?: string;
1181
	}
G
Gabriel DeBacker 已提交
1182

1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193
	export class CustomExecution2 extends CustomExecution {
		/**
		 * Constructs a CustomExecution task object. The callback will be executed the task is run, at which point the
		 * extension should return the Pseudoterminal it will "run in". The task should wait to do further execution until
		 * [Pseudoterminal.open](#Pseudoterminal.open) is called. Task cancellation should be handled using
		 * [Pseudoterminal.close](#Pseudoterminal.close). When the task is complete fire
		 * [Pseudoterminal.onDidClose](#Pseudoterminal.onDidClose).
		 * @param callback The callback that will be called when the task is started by a user.
		 */
		constructor(callback: (resolvedDefinition?: TaskDefinition) => Thenable<Pseudoterminal>);
	}
1194
	//#endregion
1195

1196
	//#region Task presentation group: https://github.com/microsoft/vscode/issues/47265
1197 1198 1199 1200 1201 1202 1203
	export interface TaskPresentationOptions {
		/**
		 * Controls whether the task is executed in a specific terminal group using split panes.
		 */
		group?: string;
	}
	//#endregion
1204

1205
	//#region Status bar item with ID and Name: https://github.com/microsoft/vscode/issues/74972
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251

	export namespace window {

		/**
		 * Options to configure the status bar item.
		 */
		export interface StatusBarItemOptions {

			/**
			 * A unique identifier of the status bar item. The identifier
			 * is for example used to allow a user to show or hide the
			 * status bar item in the UI.
			 */
			id: string;

			/**
			 * A human readable name of the status bar item. The name is
			 * for example used as a label in the UI to show or hide the
			 * status bar item.
			 */
			name: string;

			/**
			 * The alignment of the status bar item.
			 */
			alignment?: StatusBarAlignment;

			/**
			 * The priority of the status bar item. Higher value means the item should
			 * be shown more to the left.
			 */
			priority?: number;
		}

		/**
		 * Creates a status bar [item](#StatusBarItem).
		 *
		 * @param options The options of the item. If not provided, some default values
		 * will be assumed. For example, the `StatusBarItemOptions.id` will be the id
		 * of the extension and the `StatusBarItemOptions.name` will be the extension name.
		 * @return A new status bar item.
		 */
		export function createStatusBarItem(options?: StatusBarItemOptions): StatusBarItem;
	}

	//#endregion
1252

A
Alexandru Dima 已提交
1253 1254
	//#region OnTypeRename: https://github.com/microsoft/vscode/issues/88424

P
Pine Wu 已提交
1255 1256 1257 1258
	/**
	 * The rename provider interface defines the contract between extensions and
	 * the live-rename feature.
	 */
A
Alexandru Dima 已提交
1259
	export interface OnTypeRenameProvider {
P
Pine Wu 已提交
1260 1261 1262 1263 1264 1265 1266 1267 1268
		/**
		 * Provide a list of ranges that can be live renamed together.
		 *
		 * @param document The document in which the command was invoked.
		 * @param position The position at which the command was invoked.
		 * @param token A cancellation token.
		 * @return A list of ranges that can be live-renamed togehter. The ranges must have
		 * identical length and contain identical text content. The ranges cannot overlap.
		 */
A
Alexandru Dima 已提交
1269 1270 1271 1272
		provideOnTypeRenameRanges(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Range[]>;
	}

	namespace languages {
P
Pine Wu 已提交
1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285
		/**
		 * Register a rename provider that works on type.
		 *
		 * Multiple providers can be registered for a language. In that case providers are sorted
		 * by their [score](#languages.match) and the best-matching provider is used. Failure
		 * of the selected provider will cause a failure of the whole operation.
		 *
		 * @param selector A selector that defines the documents this provider is applicable to.
		 * @param provider An on type rename provider.
		 * @param stopPattern Stop on type renaming when input text matches the regular expression. Defaults to `^\s`.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
		export function registerOnTypeRenameProvider(selector: DocumentSelector, provider: OnTypeRenameProvider, stopPattern?: RegExp): Disposable;
A
Alexandru Dima 已提交
1286 1287 1288 1289
	}

	//#endregion

J
Johannes Rieken 已提交
1290
	//#region Custom editors: https://github.com/microsoft/vscode/issues/77131
1291

1292 1293
	/**
	 * Defines the editing capability of a custom webview editor. This allows the webview editor to hook into standard
M
Matt Bierner 已提交
1294
	 * editor events such as `undo` or `save`.
1295
	 *
M
Matt Bierner 已提交
1296
	 * @param EditType Type of edits used for the documents this delegate handles.
M
Matt Bierner 已提交
1297
	 */
1298
	interface CustomEditorEditingDelegate<EditType = unknown> {
1299
		/**
1300
		 * Save the resource.
M
Matt Bierner 已提交
1301
		 *
1302
		 * @param document Document to save.
1303 1304
		 * @param cancellation Token that signals the save is no longer required (for example, if another save was triggered).
		 *
M
Matt Bierner 已提交
1305
		 * @return Thenable signaling that the save has completed.
1306
		 */
M
Matt Bierner 已提交
1307
		save(document: CustomDocument<EditType>, cancellation: CancellationToken): Thenable<void>;
1308

1309
		/**
1310
		 * Save the existing resource at a new path.
1311
		 *
1312
		 * @param document Document to save.
1313
		 * @param targetResource Location to save to.
1314 1315
		 *
		 * @return Thenable signaling that the save has completed.
1316
		 */
M
Matt Bierner 已提交
1317
		saveAs(document: CustomDocument<EditType>, targetResource: Uri): Thenable<void>;
1318

M
Matt Bierner 已提交
1319
		/**
M
Matt Bierner 已提交
1320
		 * Event triggered by extensions to signal to VS Code that an edit has occurred.
M
Matt Bierner 已提交
1321
		 */
1322
		readonly onDidEdit: Event<CustomDocumentEditEvent<EditType>>;
M
Matt Bierner 已提交
1323 1324

		/**
1325 1326
		 * Apply a set of edits.
		 *
1327
		 * Note that is not invoked when `onDidEdit` is called because `onDidEdit` implies also updating the view to reflect the edit.
1328
		 *
1329
		 * @param document Document to apply edits to.
1330
		 * @param edit Array of edits. Sorted from oldest to most recent.
1331 1332
		 *
		 * @return Thenable signaling that the change has completed.
M
Matt Bierner 已提交
1333
		 */
M
Matt Bierner 已提交
1334
		applyEdits(document: CustomDocument<EditType>, edits: readonly EditType[]): Thenable<void>;
1335 1336

		/**
1337
		 * Undo a set of edits.
1338
		 *
1339
		 * This is triggered when a user undoes an edit.
1340
		 *
1341
		 * @param document Document to undo edits from.
1342
		 * @param edit Array of edits. Sorted from most recent to oldest.
1343 1344
		 *
		 * @return Thenable signaling that the change has completed.
1345
		 */
M
Matt Bierner 已提交
1346
		undoEdits(document: CustomDocument<EditType>, edits: readonly EditType[]): Thenable<void>;
M
Matt Bierner 已提交
1347

1348 1349 1350
		/**
		 * Revert the file to its last saved state.
		 *
1351
		 * @param document Document to revert.
1352
		 * @param edits Added or applied edits.
1353 1354 1355
		 *
		 * @return Thenable signaling that the change has completed.
		 */
M
Matt Bierner 已提交
1356
		revert(document: CustomDocument<EditType>, edits: CustomDocumentRevert<EditType>): Thenable<void>;
1357

M
Matt Bierner 已提交
1358
		/**
1359
		 * Back up the resource in its current state.
M
Matt Bierner 已提交
1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370
		 *
		 * Backups are used for hot exit and to prevent data loss. Your `backup` method should persist the resource in
		 * its current state, i.e. with the edits applied. Most commonly this means saving the resource to disk in
		 * the `ExtensionContext.storagePath`. When VS Code reloads and your custom editor is opened for a resource,
		 * your extension should first check to see if any backups exist for the resource. If there is a backup, your
		 * extension should load the file contents from there instead of from the resource in the workspace.
		 *
		 * `backup` is triggered whenever an edit it made. Calls to `backup` are debounced so that if multiple edits are
		 * made in quick succession, `backup` is only triggered after the last one. `backup` is not invoked when
		 * `auto save` is enabled (since auto save already persists resource ).
		 *
1371
		 * @param document Document to revert.
M
Matt Bierner 已提交
1372 1373 1374 1375 1376
		 * @param cancellation Token that signals the current backup since a new backup is coming in. It is up to your
		 * extension to decided how to respond to cancellation. If for example your extension is backing up a large file
		 * in an operation that takes time to complete, your extension may decide to finish the ongoing backup rather
		 * than cancelling it to ensure that VS Code has some valid backup.
		 */
M
Matt Bierner 已提交
1377
		backup(document: CustomDocument<EditType>, cancellation: CancellationToken): Thenable<void>;
1378
	}
1379

1380
	/**
M
Matt Bierner 已提交
1381 1382 1383
	 * Event triggered by extensions to signal to VS Code that an edit has occurred on a `CustomDocument`.
	 *
	 * @param EditType Type of edits used for the document.
1384 1385 1386 1387 1388
	 */
	interface CustomDocumentEditEvent<EditType = unknown> {
		/**
		 * Document the edit is for.
		 */
M
Matt Bierner 已提交
1389
		readonly document: CustomDocument<EditType>;
1390 1391 1392 1393

		/**
		 * Object that describes the edit.
		 *
M
Matt Bierner 已提交
1394 1395
		 * Edit objects are passed back to your extension in `CustomEditorEditingDelegate.undoEdits`,
		 * `CustomEditorEditingDelegate.applyEdits`, and `CustomEditorEditingDelegate.revert`.
1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417
		 */
		readonly edit: EditType;

		/**
		 * Display name describing the edit.
		 */
		readonly label?: string;
	}

	/**
	 * Data about a revert for a `CustomDocument`.
	 */
	interface CustomDocumentRevert<EditType = unknown> {
		/**
		 * List of edits that were undone to get the document back to its on disk state.
		 */
		readonly undoneEdits: readonly EditType[];

		/**
		 * List of edits that were reapplied to get the document back to its on disk state.
		 */
		readonly appliedEdits: readonly EditType[];
1418
	}
1419

1420
	/**
1421
	 * Represents a custom document used by a `CustomEditorProvider`.
1422
	 *
M
Matt Bierner 已提交
1423 1424 1425
	 * All custom documents must subclass `CustomDocument`. Custom documents are only used within a given
	 * `CustomEditorProvider`. The lifecycle of a `CustomDocument` is managed by VS Code. When no more references
	 * remain to a `CustomDocument`, it is disposed of.
1426
	 *
M
Matt Bierner 已提交
1427
	 * @param EditType Type of edits used in this document.
1428
	 */
M
Matt Bierner 已提交
1429 1430 1431 1432 1433 1434 1435
	class CustomDocument<EditType = unknown> {
		/**
		 * @param viewType The associated uri for this document.
		 * @param uri The associated viewType for this document.
		 */
		constructor(viewType: string, uri: Uri);

1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446
		/**
		 * The associated viewType for this document.
		 */
		readonly viewType: string;

		/**
		 * The associated uri for this document.
		 */
		readonly uri: Uri;

		/**
1447
		 * Event fired when there are no more references to the `CustomDocument`.
1448 1449 1450 1451
		 */
		readonly onDidDispose: Event<void>;

		/**
M
Matt Bierner 已提交
1452
		 * List of edits from document open to the document's current state.
1453
		 */
M
Matt Bierner 已提交
1454
		readonly appliedEdits: ReadonlyArray<EditType>;
1455

M
Matt Bierner 已提交
1456 1457 1458 1459 1460 1461 1462
		/**
		 * List of edits from document open to the document's last saved point.
		 *
		 * The save point will be behind `appliedEdits` if the user saves and then continues editing,
		 * or in front of the last entry in `appliedEdits` if the user saves and then hits undo.
		 */
		readonly savedEdits: ReadonlyArray<EditType>;
1463 1464 1465 1466 1467
	}

	/**
	 * Provider for webview editors that use a custom data model.
	 *
1468
	 * Custom webview editors use [`CustomDocument`](#CustomDocument) as their data model.
1469 1470 1471 1472 1473
	 * This gives extensions full control over actions such as edit, save, and backup.
	 *
	 * You should use custom text based editors when dealing with binary files or more complex scenarios. For simple text
	 * based documents, use [`WebviewTextEditorProvider`](#WebviewTextEditorProvider) instead.
	 */
M
Matt Bierner 已提交
1474 1475
	export interface CustomEditorProvider<EditType = unknown> {

1476
		/**
1477
		 * Resolve the model for a given resource.
1478
		 *
1479 1480 1481 1482 1483
		 * `resolveCustomDocument` is called when the first editor for a given resource is opened, and the resolve document
		 * is passed to `resolveCustomEditor`. The resolved `CustomDocument` is re-used for subsequent editor opens.
		 * If all editors for a given resource are closed, the `CustomDocument` is disposed of. Opening an editor at
		 * this point will trigger another call to `resolveCustomDocument`.
		 *
M
Matt Bierner 已提交
1484
		 * @param uri Uri of the document to open.
1485
		 * @param token A cancellation token that indicates the result is no longer needed.
1486
		 *
M
Matt Bierner 已提交
1487
		 * @return The custom document.
1488
		 */
M
Matt Bierner 已提交
1489
		openCustomDocument(uri: Uri, token: CancellationToken): Thenable<CustomDocument<EditType>>;
1490

1491
		/**
M
Matt Bierner 已提交
1492 1493
		 * Resolve a webview editor for a given resource.
		 *
M
Matt Bierner 已提交
1494 1495
		 * This is called when a user first opens a resource for a `CustomEditorProvider`, or if they reopen an
		 * existing editor using this `CustomEditorProvider`.
1496
		 *
1497
		 * To resolve a webview editor, the provider must fill in its initial html content and hook up all
1498 1499
		 * the event listeners it is interested it. The provider can also hold onto the `WebviewPanel` to use later,
		 * for example in a command. See [`WebviewPanel`](#WebviewPanel) for additional details
1500
		 *
1501
		 * @param document Document for the resource being resolved.
1502
		 * @param webviewPanel Webview to resolve.
1503
		 * @param token A cancellation token that indicates the result is no longer needed.
1504
		 *
1505
		 * @return Thenable indicating that the webview editor has been resolved.
1506
		 */
M
Matt Bierner 已提交
1507
		resolveCustomEditor(document: CustomDocument<EditType>, webviewPanel: WebviewPanel, token: CancellationToken): Thenable<void>;
1508 1509 1510 1511 1512 1513

		/**
		 * Defines the editing capability of a custom webview document.
		 *
		 * When not provided, the document is considered readonly.
		 */
M
Matt Bierner 已提交
1514
		readonly editingDelegate?: CustomEditorEditingDelegate<EditType>;
1515
	}
1516

1517 1518 1519 1520 1521 1522 1523 1524
	/**
	 * Provider for text based webview editors.
	 *
	 * Text based webview editors use a [`TextDocument`](#TextDocument) as their data model. This considerably simplifies
	 * implementing a webview editor as it allows VS Code to handle many common operations such as
	 * undo and backup. The provider is responsible for synchronizing text changes between the webview and the `TextDocument`.
	 *
	 * You should use text based webview editors when dealing with text based file formats, such as `xml` or `json`.
1525
	 * For binary files or more specialized use cases, see [CustomEditorProvider](#CustomEditorProvider).
1526
	 */
1527
	export interface CustomTextEditorProvider {
M
Matt Bierner 已提交
1528

1529
		/**
1530 1531 1532 1533
		 * Resolve a webview editor for a given text resource.
		 *
		 * This is called when a user first opens a resource for a `CustomTextEditorProvider`, or if they reopen an
		 * existing editor using this `CustomTextEditorProvider`.
1534
		 *
1535
		 * To resolve a webview editor, the provider must fill in its initial html content and hook up all
1536 1537
		 * the event listeners it is interested it. The provider can also hold onto the `WebviewPanel` to use later,
		 * for example in a command. See [`WebviewPanel`](#WebviewPanel) for additional details.
1538
		 *
1539 1540
		 * @param document Document for the resource to resolve.
		 * @param webviewPanel Webview to resolve.
1541
		 * @param token A cancellation token that indicates the result is no longer needed.
1542 1543
		 *
		 * @return Thenable indicating that the webview editor has been resolved.
1544
		 */
1545
		resolveCustomTextEditor(document: TextDocument, webviewPanel: WebviewPanel, token: CancellationToken): Thenable<void>;
1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556

		/**
		 * TODO: discuss this at api sync.
		 *
		 * Handle when the underlying resource for a custom editor is renamed.
		 *
		 * This allows the webview for the editor be preserved throughout the rename. If this method is not implemented,
		 * VS Code will destory the previous custom editor and create a replacement one.
		 *
		 * @param newDocument New text document to use for the custom editor.
		 * @param existingWebviewPanel Webview panel for the custom editor.
1557
		 * @param token A cancellation token that indicates the result is no longer needed.
1558 1559 1560
		 *
		 * @return Thenable indicating that the webview editor has been moved.
		 */
1561
		moveCustomTextEditor?(newDocument: TextDocument, existingWebviewPanel: WebviewPanel, token: CancellationToken): Thenable<void>;
1562 1563 1564
	}

	namespace window {
M
Matt Bierner 已提交
1565
		/**
1566
		 * Register a new provider for a custom editor.
1567 1568 1569
		 *
		 * @param viewType Type of the webview editor provider. This should match the `viewType` from the
		 *   `package.json` contributions.
1570
		 * @param provider Provider that resolves editors.
M
Matt Bierner 已提交
1571
		 * @param options Options for the provider
M
Matt Bierner 已提交
1572
		 *
1573
		 * @return Disposable that unregisters the provider.
M
Matt Bierner 已提交
1574
		 */
1575
		export function registerCustomEditorProvider(
1576
			viewType: string,
1577
			provider: CustomEditorProvider | CustomTextEditorProvider,
M
Matt Bierner 已提交
1578 1579 1580
			options?: {
				readonly webviewOptions?: WebviewPanelOptions;
			}
1581 1582 1583 1584
		): Disposable;
	}

	//#endregion
1585

P
Peter Elmers 已提交
1586

J
Johannes Rieken 已提交
1587
	//#region allow QuickPicks to skip sorting: https://github.com/microsoft/vscode/issues/73904
P
Peter Elmers 已提交
1588 1589 1590

	export interface QuickPick<T extends QuickPickItem> extends QuickInput {
		/**
1591 1592
		 * An optional flag to sort the final results by index of first query match in label. Defaults to true.
		 */
P
Peter Elmers 已提交
1593 1594 1595 1596
		sortByLabel: boolean;
	}

	//#endregion
M
Matt Bierner 已提交
1597

E
Eric Amodio 已提交
1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608
	//#region Allow theme icons in hovers: https://github.com/microsoft/vscode/issues/84695

	export interface MarkdownString {

		/**
		 * Indicates that this markdown string can contain [ThemeIcons](#ThemeIcon), e.g. `$(zap)`.
		 */
		readonly supportThemeIcons?: boolean;
	}

	//#endregion
S
Sandeep Somavarapu 已提交
1609

R
rebornix 已提交
1610 1611
	//#region Peng: Notebook

R
rebornix 已提交
1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622
	export enum CellKind {
		Markdown = 1,
		Code = 2
	}

	export enum CellOutputKind {
		Text = 1,
		Error = 2,
		Rich = 3
	}

R
rebornix 已提交
1623
	export interface CellStreamOutput {
R
rebornix 已提交
1624
		outputKind: CellOutputKind.Text;
R
rebornix 已提交
1625 1626 1627
		text: string;
	}

R
rebornix 已提交
1628
	export interface CellErrorOutput {
R
rebornix 已提交
1629
		outputKind: CellOutputKind.Error;
R
rebornix 已提交
1630 1631 1632 1633 1634 1635 1636
		/**
		 * Exception Name
		 */
		ename: string;
		/**
		 * Exception Value
		 */
R
rebornix 已提交
1637
		evalue: string;
R
rebornix 已提交
1638 1639 1640
		/**
		 * Exception call stack
		 */
R
rebornix 已提交
1641 1642 1643
		traceback: string[];
	}

R
rebornix 已提交
1644
	export interface CellDisplayOutput {
R
rebornix 已提交
1645
		outputKind: CellOutputKind.Rich;
R
rebornix 已提交
1646 1647 1648 1649 1650 1651
		/**
		 * { mime_type: value }
		 *
		 * Example:
		 * ```json
		 * {
R
rebornix 已提交
1652
		 *   "outputKind": vscode.CellOutputKind.Rich,
R
rebornix 已提交
1653 1654 1655 1656 1657 1658 1659 1660 1661 1662
		 *   "data": {
		 *      "text/html": [
		 *          "<h1>Hello</h1>"
		 *       ],
		 *      "text/plain": [
		 *        "<IPython.lib.display.IFrame at 0x11dee3e80>"
		 *      ]
		 *   }
		 * }
		 */
R
rebornix 已提交
1663
		data: { [key: string]: any };
R
rebornix 已提交
1664 1665
	}

R
rebornix 已提交
1666
	export type CellOutput = CellStreamOutput | CellErrorOutput | CellDisplayOutput;
R
rebornix 已提交
1667

R
rebornix 已提交
1668
	export interface NotebookCellMetadata {
1669 1670 1671
		/**
		 * Controls if the content of a cell is editable or not.
		 */
R
rebornix 已提交
1672
		editable: boolean;
R
rebornix 已提交
1673 1674 1675 1676 1677 1678

		/**
		 * Controls if the cell is executable.
		 * This metadata is ignored for markdown cell.
		 */
		runnable: boolean;
R
rebornix 已提交
1679 1680
	}

R
rebornix 已提交
1681
	export interface NotebookCell {
1682
		readonly uri: Uri;
R
rebornix 已提交
1683 1684
		handle: number;
		language: string;
R
rebornix 已提交
1685
		cellKind: CellKind;
R
rebornix 已提交
1686 1687
		outputs: CellOutput[];
		getContent(): string;
R
rebornix 已提交
1688 1689 1690 1691
		metadata?: NotebookCellMetadata;
	}

	export interface NotebookDocumentMetadata {
1692 1693
		/**
		 * Controls if users can add or delete cells
R
rebornix 已提交
1694
		 * Default to true
1695
		 */
R
rebornix 已提交
1696
		editable: boolean;
R
rebornix 已提交
1697

1698 1699
		/**
		 * Default value for [cell editable metadata](#NotebookCellMetadata.editable).
R
rebornix 已提交
1700
		 * Default to true.
1701 1702
		 */
		cellEditable: boolean;
R
rebornix 已提交
1703 1704 1705 1706 1707 1708

		/**
		 * Default value for [cell runnable metadata](#NotebookCellMetadata.runnable).
		 * Default to true.
		 */
		cellRunnable: boolean;
R
rebornix 已提交
1709 1710
	}

R
rebornix 已提交
1711 1712 1713
	export interface NotebookDocument {
		readonly uri: Uri;
		readonly fileName: string;
R
rebornix 已提交
1714
		readonly isDirty: boolean;
R
rebornix 已提交
1715
		languages: string[];
R
rebornix 已提交
1716
		cells: NotebookCell[];
R
rebornix 已提交
1717
		displayOrder?: GlobPattern[];
R
rebornix 已提交
1718
		metadata?: NotebookDocumentMetadata;
R
rebornix 已提交
1719 1720
	}

R
rebornix 已提交
1721 1722 1723
	export interface NotebookEditor {
		readonly document: NotebookDocument;
		viewColumn?: ViewColumn;
1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736
		/**
		 * Fired when the output hosting webview posts a message.
		 */
		readonly onDidReceiveMessage: Event<any>;
		/**
		 * Post a message to the output hosting webview.
		 *
		 * Messages are only delivered if the editor is live.
		 *
		 * @param message Body of the message. This must be a string or other json serilizable object.
		 */
		postMessage(message: any): Thenable<boolean>;

R
rebornix 已提交
1737 1738 1739
		/**
		 * Create a notebook cell. The cell is not inserted into current document when created. Extensions should insert the cell into the document by [TextDocument.cells](#TextDocument.cells)
		 */
1740
		createCell(content: string, language: string, type: CellKind, outputs: CellOutput[], metadata: NotebookCellMetadata | undefined): NotebookCell;
R
rebornix 已提交
1741 1742 1743
	}

	export interface NotebookProvider {
R
rebornix 已提交
1744 1745
		resolveNotebook(editor: NotebookEditor): Promise<void>;
		executeCell(document: NotebookDocument, cell: NotebookCell | undefined): Promise<void>;
R
rebornix 已提交
1746
		save(document: NotebookDocument): Promise<boolean>;
R
rebornix 已提交
1747 1748
	}

R
rebornix 已提交
1749
	export interface NotebookOutputSelector {
R
rebornix 已提交
1750 1751 1752 1753 1754
		type: string;
		subTypes?: string[];
	}

	export interface NotebookOutputRenderer {
R
rebornix 已提交
1755 1756 1757
		/**
		 *
		 * @returns HTML fragment. We can probably return `CellOutput` instead of string ?
1758
		 *
R
rebornix 已提交
1759
		 */
R
rebornix 已提交
1760
		render(document: NotebookDocument, cell: NotebookCell, output: CellOutput, mimeType: string): string;
R
rebornix 已提交
1761
		preloads?: Uri[];
R
rebornix 已提交
1762 1763 1764 1765 1766 1767 1768
	}

	namespace window {
		export function registerNotebookProvider(
			notebookType: string,
			provider: NotebookProvider
		): Disposable;
R
rebornix 已提交
1769

R
rebornix 已提交
1770
		export function registerNotebookOutputRenderer(type: string, outputSelector: NotebookOutputSelector, renderer: NotebookOutputRenderer): Disposable;
R
rebornix 已提交
1771

R
rebornix 已提交
1772
		export let activeNotebookDocument: NotebookDocument | undefined;
R
rebornix 已提交
1773 1774 1775
	}

	//#endregion
R
rebornix 已提交
1776

M
Martin Aeschlimann 已提交
1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811
	//#region color theme access

	/**
	 * Represents a color theme kind.
	 */
	export enum ColorThemeKind {
		Light = 1,
		Dark = 2,
		HighContrast = 3
	}

	/**
	 * Represents a color theme.
	 */
	export interface ColorTheme {

		/**
		 * The kind of this color theme: light, dark or high contrast.
		 */
		readonly kind: ColorThemeKind;
	}

	export namespace window {
		/**
		 * The currently active color theme as configured in the settings. The active
		 * theme can be changed via the `workbench.colorTheme` setting.
		 */
		export let activeColorTheme: ColorTheme;

		/**
		 * An [event](#Event) which fires when the active theme changes or one of it's colors chnage.
		 */
		export const onDidChangeActiveColorTheme: Event<ColorTheme>;
	}

1812 1813 1814 1815 1816
	//#endregion


	//#region https://github.com/microsoft/vscode/issues/39441

P
label2  
Pine Wu 已提交
1817 1818 1819 1820
	export interface CompletionItem {
		/**
		 * Will be merged into CompletionItem#label
		 */
P
Pine Wu 已提交
1821
		label2?: CompletionItemLabel;
P
label2  
Pine Wu 已提交
1822 1823
	}

1824 1825
	export interface CompletionItemLabel {
		/**
P
Pine Wu 已提交
1826
		 * The function or variable. Rendered leftmost.
1827
		 */
P
Pine Wu 已提交
1828
		name: string;
1829

P
Pine Wu 已提交
1830
		/**
P
Pine Wu 已提交
1831
		 * The signature without the return type. Render after `name`.
P
Pine Wu 已提交
1832 1833 1834 1835
		 */
		signature?: string;

		/**
P
Pine Wu 已提交
1836
		 * The fully qualified name, like package name or file path. Rendered after `signature`.
P
Pine Wu 已提交
1837 1838
		 */
		qualifier?: string;
1839

P
Pine Wu 已提交
1840
		/**
P
Pine Wu 已提交
1841
		 * The return-type of a function or type of a property/variable. Rendered rightmost.
P
Pine Wu 已提交
1842
		 */
P
Pine Wu 已提交
1843
		type?: string;
1844 1845 1846 1847
	}

	//#endregion

1848

1849 1850 1851 1852
	//#region eamodio - timeline: https://github.com/microsoft/vscode/issues/84297

	export class TimelineItem {
		/**
1853
		 * A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred.
1854
		 */
E
Eric Amodio 已提交
1855
		timestamp: number;
1856 1857

		/**
1858
		 * A human-readable string describing the timeline item.
1859 1860 1861 1862
		 */
		label: string;

		/**
1863
		 * Optional id for the timeline item. It must be unique across all the timeline items provided by this source.
1864
		 *
1865
		 * If not provided, an id is generated using the timeline item's timestamp.
1866 1867 1868 1869
		 */
		id?: string;

		/**
1870
		 * The icon path or [ThemeIcon](#ThemeIcon) for the timeline item.
1871
		 */
1872
		iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
1873 1874

		/**
1875
		 * A human readable string describing less prominent details of the timeline item.
1876 1877 1878 1879 1880 1881
		 */
		description?: string;

		/**
		 * The tooltip text when you hover over the timeline item.
		 */
1882
		detail?: string;
1883 1884 1885 1886 1887 1888 1889

		/**
		 * The [command](#Command) that should be executed when the timeline item is selected.
		 */
		command?: Command;

		/**
1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905
		 * Context value of the timeline item. This can be used to contribute specific actions to the item.
		 * For example, a timeline item is given a context value as `commit`. When contributing actions to `timeline/item/context`
		 * using `menus` extension point, you can specify context value for key `timelineItem` in `when` expression like `timelineItem == commit`.
		 * ```
		 *	"contributes": {
		 *		"menus": {
		 *			"timeline/item/context": [
		 *				{
		 *					"command": "extension.copyCommitId",
		 *					"when": "timelineItem == commit"
		 *				}
		 *			]
		 *		}
		 *	}
		 * ```
		 * This will show the `extension.copyCommitId` action only for items where `contextValue` is `commit`.
1906 1907 1908 1909 1910
		 */
		contextValue?: string;

		/**
		 * @param label A human-readable string describing the timeline item
E
Eric Amodio 已提交
1911
		 * @param timestamp A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred
1912
		 */
E
Eric Amodio 已提交
1913
		constructor(label: string, timestamp: number);
1914 1915
	}

1916
	export interface TimelineChangeEvent {
E
Eric Amodio 已提交
1917
		/**
1918 1919
		 * The [uri](#Uri) of the resource for which the timeline changed.
		 * If the [uri](#Uri) is `undefined` that signals that the timeline source for all resources changed.
E
Eric Amodio 已提交
1920
		 */
1921
		uri?: Uri;
1922

E
Eric Amodio 已提交
1923
		/**
1924
		 * A flag which indicates whether the entire timeline should be reset.
E
Eric Amodio 已提交
1925
		 */
1926 1927
		reset?: boolean;
	}
E
Eric Amodio 已提交
1928

1929 1930 1931
	export interface Timeline {
		readonly paging?: {
			/**
E
Eric Amodio 已提交
1932
			 * A provider-defined cursor specifying the starting point of timeline items which are after the ones returned.
E
Eric Amodio 已提交
1933
			 * Use `undefined` to signal that there are no more items to be returned.
1934
			 */
E
Eric Amodio 已提交
1935
			readonly cursor: string | undefined;
1936
		}
E
Eric Amodio 已提交
1937 1938

		/**
1939
		 * An array of [timeline items](#TimelineItem).
E
Eric Amodio 已提交
1940
		 */
1941
		readonly items: readonly TimelineItem[];
E
Eric Amodio 已提交
1942 1943
	}

1944
	export interface TimelineOptions {
E
Eric Amodio 已提交
1945
		/**
E
Eric Amodio 已提交
1946
		 * A provider-defined cursor specifying the starting point of the timeline items that should be returned.
E
Eric Amodio 已提交
1947
		 */
1948
		cursor?: string;
E
Eric Amodio 已提交
1949 1950

		/**
1951 1952
		 * An optional maximum number timeline items or the all timeline items newer (inclusive) than the timestamp or id that should be returned.
		 * If `undefined` all timeline items should be returned.
E
Eric Amodio 已提交
1953
		 */
1954
		limit?: number | { timestamp: number; id?: string };
E
Eric Amodio 已提交
1955 1956
	}

1957
	export interface TimelineProvider {
1958
		/**
1959 1960
		 * An optional event to signal that the timeline for a source has changed.
		 * To signal that the timeline for all resources (uris) has changed, do not pass any argument or pass `undefined`.
1961
		 */
1962
		onDidChange?: Event<TimelineChangeEvent>;
1963 1964

		/**
1965
		 * An identifier of the source of the timeline items. This can be used to filter sources.
1966
		 */
1967
		readonly id: string;
1968

E
Eric Amodio 已提交
1969
		/**
1970
		 * A human-readable string describing the source of the timeline items. This can be used as the display label when filtering sources.
E
Eric Amodio 已提交
1971
		 */
1972
		readonly label: string;
1973 1974

		/**
E
Eric Amodio 已提交
1975
		 * Provide [timeline items](#TimelineItem) for a [Uri](#Uri).
1976
		 *
1977
		 * @param uri The [uri](#Uri) of the file to provide the timeline for.
1978
		 * @param options A set of options to determine how results should be returned.
1979
		 * @param token A cancellation token.
E
Eric Amodio 已提交
1980
		 * @return The [timeline result](#TimelineResult) or a thenable that resolves to such. The lack of a result
1981 1982
		 * can be signaled by returning `undefined`, `null`, or an empty array.
		 */
1983
		provideTimeline(uri: Uri, options: TimelineOptions, token: CancellationToken): ProviderResult<Timeline>;
1984 1985 1986 1987 1988 1989 1990 1991 1992 1993
	}

	export namespace workspace {
		/**
		 * Register a timeline provider.
		 *
		 * Multiple providers can be registered. In that case, providers are asked in
		 * parallel and the results are merged. A failing provider (rejected promise or exception) will
		 * not cause a failure of the whole operation.
		 *
1994
		 * @param scheme A scheme or schemes that defines which documents this provider is applicable to. Can be `*` to target all documents.
1995 1996
		 * @param provider A timeline provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
E
Eric Amodio 已提交
1997
		*/
1998
		export function registerTimelineProvider(scheme: string | string[], provider: TimelineProvider): Disposable;
1999 2000 2001
	}

	//#endregion
2002 2003


J
Johannes Rieken 已提交
2004
	//#region https://github.com/microsoft/vscode/issues/90208
2005 2006 2007 2008 2009 2010 2011 2012 2013

	export interface ExtensionContext {
		/**
		 * Get the uri of a resource contained in the extension.
		 *
		 * @param relativePath A relative path to a resource contained in the extension.
		 * @return The uri of the resource.
		 */
		asExtensionUri(relativePath: string): Uri;
2014 2015 2016 2017 2018

		/**
		 *
		 */
		readonly extensionUri: Uri;
2019 2020
	}

2021 2022 2023 2024 2025 2026 2027 2028
	export interface Extension<T> {
		/**
		 * Get the uri of a resource contained in the extension.
		 *
		 * @param relativePath A relative path to a resource contained in the extension.
		 * @return The uri of the resource.
		 */
		asExtensionUri(relativePath: string): Uri;
2029 2030 2031 2032 2033

		/**
		 *
		 */
		readonly extensionUri: Uri;
2034 2035
	}

2036
	//#endregion
2037 2038 2039 2040 2041 2042 2043

	//#region https://github.com/microsoft/vscode/issues/86788

	export interface CodeActionProviderMetadata {
		/**
		 * Static documentation for a class of code actions.
		 *
M
Matt Bierner 已提交
2044 2045
		 * The documentation is shown in the code actions menu if either:
		 *
M
Matt Bierner 已提交
2046 2047 2048 2049
		 * - Code actions of `kind` are requested by VS Code. In this case, VS Code will show the documentation that
		 *   most closely matches the requested code action kind. For example, if a provider has documentation for
		 *   both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`,
		 *   VS Code will use the documentation for `RefactorExtract` intead of the documentation for `Refactor`.
M
Matt Bierner 已提交
2050 2051
		 *
		 * - Any code actions of `kind` are returned by the provider.
2052 2053 2054 2055 2056
		 */
		readonly documentation?: ReadonlyArray<{ readonly kind: CodeActionKind, readonly command: Command }>;
	}

	//#endregion
2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069

	//#region Dialog title: https://github.com/microsoft/vscode/issues/82871

	/**
	 * Options to configure the behaviour of a file open dialog.
	 *
	 * * Note 1: A dialog can select files, folders, or both. This is not true for Windows
	 * which enforces to open either files or folder, but *not both*.
	 * * Note 2: Explicitly setting `canSelectFiles` and `canSelectFolders` to `false` is futile
	 * and the editor then silently adjusts the options to select files.
	 */
	export interface OpenDialogOptions {
		/**
2070 2071 2072 2073
		 * Dialog title.
		 *
		 * Depending on the underlying operating system this parameter might be ignored, since some
		 * systems do not present title on open dialogs.
2074 2075 2076 2077 2078 2079 2080 2081 2082
		 */
		title?: string;
	}

	/**
	 * Options to configure the behaviour of a file save dialog.
	 */
	export interface SaveDialogOptions {
		/**
2083 2084 2085 2086
		 * Dialog title.
		 *
		 * Depending on the underlying operating system this parameter might be ignored, since some
		 * systems do not present title on save dialogs.
2087 2088 2089 2090 2091
		 */
		title?: string;
	}

	//#endregion
2092

2093 2094 2095 2096 2097 2098 2099 2100 2101 2102
	//#region https://github.com/microsoft/vscode/issues/90208

	export namespace Uri {

		/**
		 *
		 * @param base
		 * @param pathFragments
		 * @returns A new uri
		 */
2103
		export function joinPath(base: Uri, ...pathFragments: string[]): Uri;
2104 2105 2106
	}

	//#endregion
2107

2108 2109 2110 2111 2112 2113 2114 2115 2116
	//#region https://github.com/microsoft/vscode/issues/91541

	export enum CompletionItemKind {
		User = 25,
		Issue = 26,
	}

	//#endregion

J
Johannes Rieken 已提交
2117
}