vscode.proposed.d.ts 53.5 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 22 23
	export interface Session {
		id: string;
		accessToken: string;
24
		accountName: string;
25
		scopes: string[]
26 27
	}

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
	/**
	 * 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[];

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

43
	export interface AuthenticationProvider {
44 45 46 47 48
		/**
		 * Used as an identifier for extensions trying to work with a particular
		 * provider: 'Microsoft', 'GitHub', etc. id must be unique, registering
		 * another provider with the same id will fail.
		 */
49 50
		readonly id: string;
		readonly displayName: string;
51 52 53 54 55

		/**
		 * A [enent](#Event) which fires when the array of sessions has changed, or data
		 * within a session has changed.
		 */
56
		readonly onDidChangeSessions: Event<void>;
57

58 59 60 61
		/**
		 * Returns an array of current sessions.
		 */
		getSessions(): Promise<ReadonlyArray<Session>>;
62

63 64 65
		/**
		 * Prompts a user to login.
		 */
66
		login(scopes: string[]): Promise<Session>;
67
		logout(sessionId: string): Promise<void>;
68 69 70 71
	}

	export namespace authentication {
		export function registerAuthenticationProvider(provider: AuthenticationProvider): Disposable;
72 73 74 75

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

78
		export const providers: ReadonlyArray<AuthenticationProvider>;
79 80
	}

J
Johannes Rieken 已提交
81 82
	//#endregion

83
	//#region Alex - resolvers
A
Alex Dima 已提交
84

A
Tweaks  
Alex Dima 已提交
85 86 87 88
	export interface RemoteAuthorityResolverContext {
		resolveAttempt: number;
	}

A
Alex Dima 已提交
89 90 91 92 93 94 95
	export class ResolvedAuthority {
		readonly host: string;
		readonly port: number;

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

96
	export interface ResolvedOptions {
97
		extensionHostEnv?: { [key: string]: string | null };
98 99
	}

100
	export interface TunnelOptions {
A
Alex Ross 已提交
101 102 103 104
		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;
105 106
	}

A
Alex Ross 已提交
107
	export interface TunnelDescription {
A
Alex Ross 已提交
108 109
		remoteAddress: { port: number, host: string };
		//The complete local address(ex. localhost:1234)
A
Alex Ross 已提交
110
		localAddress: string;
A
Alex Ross 已提交
111 112 113
	}

	export interface Tunnel extends TunnelDescription {
A
Alex Ross 已提交
114 115
		// Implementers of Tunnel should fire onDidDispose when dispose is called.
		onDidDispose: Event<void>;
116
		dispose(): void;
117 118 119
	}

	/**
120 121
	 * Used as part of the ResolverResult if the extension has any candidate,
	 * published, or forwarded ports.
122 123 124 125
	 */
	export interface TunnelInformation {
		/**
		 * Tunnels that are detected by the extension. The remotePort is used for display purposes.
A
Alex Ross 已提交
126
		 * The localAddress should be the complete local address (ex. localhost:1234) for connecting to the port. Tunnels provided through
127 128
		 * detected are read-only from the forwarded ports UI.
		 */
A
Alex Ross 已提交
129
		environmentTunnels?: TunnelDescription[];
A
Alex Ross 已提交
130

131 132 133
	}

	export type ResolverResult = ResolvedAuthority & ResolvedOptions & TunnelInformation;
134

A
Tweaks  
Alex Dima 已提交
135 136 137 138 139 140 141
	export class RemoteAuthorityResolverError extends Error {
		static NotAvailable(message?: string, handled?: boolean): RemoteAuthorityResolverError;
		static TemporarilyNotAvailable(message?: string): RemoteAuthorityResolverError;

		constructor(message?: string);
	}

A
Alex Dima 已提交
142
	export interface RemoteAuthorityResolver {
143
		resolve(authority: string, context: RemoteAuthorityResolverContext): ResolverResult | Thenable<ResolverResult>;
144 145 146 147 148
		/**
		 * 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 已提交
149
		tunnelFactory?: (tunnelOptions: TunnelOptions) => Thenable<Tunnel> | undefined;
150 151 152 153 154

		/**
		 * Provides filtering for candidate ports.
		 */
		showCandidatePort?: (host: string, port: number, detail: string) => Thenable<boolean>;
155 156 157 158
	}

	export namespace workspace {
		/**
159
		 * Forwards a port. If the current resolver implements RemoteAuthorityResolver:forwardPort then that will be used to make the tunnel.
A
Alex Ross 已提交
160 161
		 * 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.
162
		 */
A
Alex Ross 已提交
163
		export function openTunnel(tunnelOptions: TunnelOptions): Thenable<Tunnel>;
164 165 166 167 168 169

		/**
		 * 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 已提交
170 171 172 173

		/**
		 * Fired when the list of tunnels has changed.
		 */
J
Johannes Rieken 已提交
174 175
		// TODO@alexr
		// eslint-disable-next-line vscode-dts-event-naming
A
Alex Ross 已提交
176
		export const onDidTunnelsChange: Event<void>;
A
Alex Dima 已提交
177 178
	}

179 180 181 182 183 184 185 186
	export interface ResourceLabelFormatter {
		scheme: string;
		authority?: string;
		formatting: ResourceLabelFormatting;
	}

	export interface ResourceLabelFormatting {
		label: string; // myLabel:/${path}
J
Johannes Rieken 已提交
187 188
		// TODO@isi
		// eslint-disable-next-line vscode-dts-literal-or-types
189 190 191 192 193 194 195
		separator: '/' | '\\' | '';
		tildify?: boolean;
		normalizeDriveLetter?: boolean;
		workspaceSuffix?: string;
		authorityPrefix?: string;
	}

A
Alex Dima 已提交
196 197
	export namespace workspace {
		export function registerRemoteAuthorityResolver(authorityPrefix: string, resolver: RemoteAuthorityResolver): Disposable;
198
		export function registerResourceLabelFormatter(formatter: ResourceLabelFormatter): Disposable;
199
	}
200

201 202
	//#endregion

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

205
	export class SemanticTokensLegend {
A
WIP  
Alexandru Dima 已提交
206 207 208 209 210 211
		public readonly tokenTypes: string[];
		public readonly tokenModifiers: string[];

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

212 213 214 215 216 217 218
	export class SemanticTokensBuilder {
		constructor();
		push(line: number, char: number, length: number, tokenType: number, tokenModifiers: number): void;
		build(): Uint32Array;
	}

	export class SemanticTokens {
A
Alexandru Dima 已提交
219 220 221
		/**
		 * The result id of the tokens.
		 *
222
		 * This is the id that will be passed to `DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits` (if implemented).
A
Alexandru Dima 已提交
223
		 */
224 225 226 227 228 229 230
		readonly resultId?: string;
		readonly data: Uint32Array;

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

	export class SemanticTokensEdits {
A
Alexandru Dima 已提交
231 232 233
		/**
		 * The result id of the tokens.
		 *
234
		 * This is the id that will be passed to `DocumentSemanticTokensProvider.provideDocumentSemanticTokensEdits` (if implemented).
A
Alexandru Dima 已提交
235
		 */
236 237
		readonly resultId?: string;
		readonly edits: SemanticTokensEdit[];
A
WIP  
Alexandru Dima 已提交
238

239
		constructor(edits: SemanticTokensEdit[], resultId?: string);
A
WIP  
Alexandru Dima 已提交
240 241
	}

242 243 244 245
	export class SemanticTokensEdit {
		readonly start: number;
		readonly deleteCount: number;
		readonly data?: Uint32Array;
A
WIP  
Alexandru Dima 已提交
246

247 248 249
		constructor(start: number, deleteCount: number, data?: Uint32Array);
	}

A
WIP  
Alexandru Dima 已提交
250
	/**
251
	 * The document semantic tokens provider interface defines the contract between extensions and
252
	 * semantic tokens.
A
WIP  
Alexandru Dima 已提交
253
	 */
254
	export interface DocumentSemanticTokensProvider {
A
Alex Dima 已提交
255
		/**
A
Alexandru Dima 已提交
256 257 258 259 260
		 * 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 已提交
261
		 *
A
Alexandru Dima 已提交
262
		 * ---
263
		 * 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 已提交
264 265 266
		 *  - 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.
267
		 *  - at index `5*i+3` - `tokenType`: will be looked up in `SemanticTokensLegend.tokenTypes`. We currently ask that `tokenType` < 65536.
A
Alex Dima 已提交
268 269
		 *  - at index `5*i+4` - `tokenModifiers`: each set bit will be looked up in `SemanticTokensLegend.tokenModifiers`
		 *
A
Alexandru Dima 已提交
270 271 272
		 * ---
		 * ### How to encode tokens
		 *
273
		 * Here is an example for encoding a file with 3 tokens in a uint32 array:
A
Alex Dima 已提交
274
		 * ```
A
Alex Dima 已提交
275 276 277
		 *    { 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 已提交
278 279 280
		 * ```
		 *
		 * 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 已提交
281
		 * For this example, we will choose the following legend which must be passed in when registering the provider:
A
Alex Dima 已提交
282
		 * ```
A
Alex Dima 已提交
283
		 *    tokenTypes: ['property', 'type', 'class'],
A
Alexandru Dima 已提交
284
		 *    tokenModifiers: ['private', 'static']
A
Alex Dima 已提交
285 286
		 * ```
		 *
A
Alexandru Dima 已提交
287
		 * 2. The first transformation step is to encode `tokenType` and `tokenModifiers` as integers using the legend. Token types are looked
288
		 * 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 已提交
289 290
		 * 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 已提交
291
		 * ```
A
Alexandru Dima 已提交
292 293 294
		 *    { 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 已提交
295 296
		 * ```
		 *
A
Alex Dima 已提交
297
		 * 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 已提交
298 299 300
		 * 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 已提交
301
		 * ```
A
Alexandru Dima 已提交
302 303 304
		 *    { 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 已提交
305 306
		 * ```
		 *
A
Alexandru Dima 已提交
307
		 * 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 已提交
308 309
		 * ```
		 *    // 1st token,  2nd token,  3rd token
A
Alexandru Dima 已提交
310
		 *    [  2,5,3,0,3,  0,5,4,1,0,  3,2,7,2,0 ]
A
Alex Dima 已提交
311
		 * ```
312
		 */
313
		provideDocumentSemanticTokens(document: TextDocument, token: CancellationToken): ProviderResult<SemanticTokens>;
314 315 316 317

		/**
		 * 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 已提交
318
		 *
A
Alexandru Dima 已提交
319 320 321 322 323 324 325
		 * ---
		 * ### 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 已提交
326
		 * ```
A
Alex Dima 已提交
327 328 329
		 *    { 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 已提交
330
		 * ```
A
Alexandru Dima 已提交
331
		 * The integer encoding of the tokens does not change substantially because of the delta-encoding of positions:
A
Alex Dima 已提交
332
		 * ```
A
Alexandru Dima 已提交
333 334
		 *    // 1st token,  2nd token,  3rd token
		 *    [  3,5,3,0,3,  0,5,4,1,0,  3,2,7,2,0 ]
A
Alex Dima 已提交
335
		 * ```
A
Alexandru Dima 已提交
336
		 * It is possible to express these new tokens in terms of an edit applied to the previous tokens:
A
Alex Dima 已提交
337
		 * ```
338 339
		 *    [  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 已提交
340
		 *
A
Alexandru Dima 已提交
341 342
		 *    edit: { start:  0, deleteCount: 1, data: [3] } // replace integer at offset 0 with 3
		 * ```
A
Alexandru Dima 已提交
343
		 *
A
Alexandru Dima 已提交
344
		 * Furthermore, let's assume that a new token has appeared on line 4:
A
Alex Dima 已提交
345
		 * ```
A
Alex Dima 已提交
346 347 348 349
		 *    { 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
Alex Dima 已提交
350
		 * ```
A
Alexandru Dima 已提交
351
		 * The integer encoding of the tokens is:
A
Alex Dima 已提交
352
		 * ```
A
Alexandru Dima 已提交
353 354
		 *    // 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 已提交
355
		 * ```
A
Alexandru Dima 已提交
356
		 * Again, it is possible to express these new tokens in terms of an edit applied to the previous tokens:
A
Alex Dima 已提交
357
		 * ```
358 359
		 *    [  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 已提交
360 361
		 *
		 *    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 已提交
362
		 * ```
A
Alexandru Dima 已提交
363
		 *
364 365 366
		 * *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 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 已提交
367
		 */
368 369 370 371 372 373 374 375 376 377
		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 已提交
378
		 */
379
		provideDocumentRangeSemanticTokens(document: TextDocument, range: Range, token: CancellationToken): ProviderResult<SemanticTokens>;
A
WIP  
Alexandru Dima 已提交
380 381 382 383
	}

	export namespace languages {
		/**
384
		 * Register a semantic tokens provider for a whole document.
A
WIP  
Alexandru Dima 已提交
385 386 387 388 389 390
		 *
		 * 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.
391
		 * @param provider A document semantic tokens provider.
A
WIP  
Alexandru Dima 已提交
392 393
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
394 395 396 397
		export function registerDocumentSemanticTokensProvider(selector: DocumentSelector, provider: DocumentSemanticTokensProvider, legend: SemanticTokensLegend): Disposable;

		/**
		 * Register a semantic tokens provider for a document range.
A
WIP  
Alexandru Dima 已提交
398 399 400 401 402 403
		 *
		 * 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.
404
		 * @param provider A document range semantic tokens provider.
A
WIP  
Alexandru Dima 已提交
405 406
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
407
		export function registerDocumentRangeSemanticTokensProvider(selector: DocumentSelector, provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): Disposable;
A
WIP  
Alexandru Dima 已提交
408 409 410
	}

	//#endregion
411

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

414 415
	export interface WebviewEditorInset {
		readonly editor: TextEditor;
416 417
		readonly line: number;
		readonly height: number;
418 419 420
		readonly webview: Webview;
		readonly onDidDispose: Event<void>;
		dispose(): void;
421 422
	}

423
	export namespace window {
424
		export function createWebviewTextEditorInset(editor: TextEditor, line: number, height: number, options?: WebviewOptions): WebviewEditorInset;
A
Alex Dima 已提交
425 426 427 428
	}

	//#endregion

J
Johannes Rieken 已提交
429
	//#region read/write in chunks: https://github.com/microsoft/vscode/issues/84515
430 431

	export interface FileSystemProvider {
J
Johannes Rieken 已提交
432
		open?(resource: Uri, options: { create: boolean }): number | Thenable<number>;
433 434 435 436 437 438 439
		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 已提交
440
	//#region TextSearchProvider: https://github.com/microsoft/vscode/issues/59921
441

442 443 444
	/**
	 * The parameters of a query for text search.
	 */
445
	export interface TextSearchQuery {
446 447 448
		/**
		 * The text pattern to search for.
		 */
449
		pattern: string;
450

R
Rob Lourens 已提交
451 452 453 454 455
		/**
		 * Whether or not `pattern` should match multiple lines of text.
		 */
		isMultiline?: boolean;

456 457 458
		/**
		 * Whether or not `pattern` should be interpreted as a regular expression.
		 */
R
Rob Lourens 已提交
459
		isRegExp?: boolean;
460 461 462 463

		/**
		 * Whether or not the search should be case-sensitive.
		 */
R
Rob Lourens 已提交
464
		isCaseSensitive?: boolean;
465 466 467 468

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

472 473 474 475 476 477 478 479 480 481
	/**
	 * 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 已提交
482
	export interface SearchOptions {
483 484 485
		/**
		 * The root folder to search within.
		 */
486
		folder: Uri;
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501

		/**
		 * 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 已提交
502
		useIgnoreFiles: boolean;
503 504 505 506 507

		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
508
		followSymlinks: boolean;
P
pkoushik 已提交
509 510 511 512 513 514

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

R
Rob Lourens 已提交
517 518
	/**
	 * Options to specify the size of the result text preview.
R
Rob Lourens 已提交
519
	 * These options don't affect the size of the match itself, just the amount of preview text.
R
Rob Lourens 已提交
520
	 */
521
	export interface TextSearchPreviewOptions {
522
		/**
R
Rob Lourens 已提交
523
		 * The maximum number of lines in the preview.
R
Rob Lourens 已提交
524
		 * Only search providers that support multiline search will ever return more than one line in the match.
525
		 */
R
Rob Lourens 已提交
526
		matchLines: number;
R
Rob Lourens 已提交
527 528 529 530

		/**
		 * The maximum number of characters included per line.
		 */
R
Rob Lourens 已提交
531
		charsPerLine: number;
532 533
	}

534 535 536
	/**
	 * Options that apply to text search.
	 */
R
Rob Lourens 已提交
537
	export interface TextSearchOptions extends SearchOptions {
538
		/**
539
		 * The maximum number of results to be returned.
540
		 */
541 542
		maxResults: number;

R
Rob Lourens 已提交
543 544 545
		/**
		 * Options to specify the size of the result text preview.
		 */
546
		previewOptions?: TextSearchPreviewOptions;
547 548 549 550

		/**
		 * Exclude files larger than `maxFileSize` in bytes.
		 */
551
		maxFileSize?: number;
552 553 554 555 556

		/**
		 * Interpret files using this encoding.
		 * See the vscode setting `"files.encoding"`
		 */
557
		encoding?: string;
558 559 560 561 562 563 564 565 566 567

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

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

570 571 572 573 574 575 576 577 578 579 580 581 582 583
	/**
	 * 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 已提交
584 585 586
	/**
	 * A preview of the text result.
	 */
587
	export interface TextSearchMatchPreview {
588
		/**
R
Rob Lourens 已提交
589
		 * The matching lines of text, or a portion of the matching line that contains the match.
590 591 592 593 594
		 */
		text: string;

		/**
		 * The Range within `text` corresponding to the text of the match.
595
		 * The number of matches must match the TextSearchMatch's range property.
596
		 */
597
		matches: Range | Range[];
598 599 600 601 602
	}

	/**
	 * A match from a text search
	 */
603
	export interface TextSearchMatch {
604 605 606
		/**
		 * The uri for the matching document.
		 */
607
		uri: Uri;
608 609

		/**
610
		 * The range of the match within the document, or multiple ranges for multiple matches.
611
		 */
612
		ranges: Range | Range[];
R
Rob Lourens 已提交
613

614
		/**
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636
		 * 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.
637
		 */
638
		lineNumber: number;
639 640
	}

641 642
	export type TextSearchResult = TextSearchMatch | TextSearchContext;

R
Rob Lourens 已提交
643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686
	/**
	 * 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;
	}

687
	/**
R
Rob Lourens 已提交
688 689 690 691 692 693 694
	 * 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.
695
	 */
696
	export interface FileSearchProvider {
697 698 699 700 701 702
		/**
		 * 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.
		 */
703
		provideFileSearchResults(query: FileSearchQuery, options: FileSearchOptions, token: CancellationToken): ProviderResult<Uri[]>;
704
	}
705

R
Rob Lourens 已提交
706
	export namespace workspace {
707
		/**
R
Rob Lourens 已提交
708 709 710 711 712 713 714
		 * 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.
715
		 */
R
Rob Lourens 已提交
716 717 718 719 720 721 722 723 724 725 726 727
		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;
728 729
	}

R
Rob Lourens 已提交
730 731 732 733
	//#endregion

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

734 735 736
	/**
	 * Options that can be set on a findTextInFiles search.
	 */
R
Rob Lourens 已提交
737
	export interface FindTextInFilesOptions {
738 739 740 741 742
		/**
		 * 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).
		 */
743
		include?: GlobPattern;
744 745 746 747 748 749 750 751 752 753 754

		/**
		 * A [glob pattern](#GlobPattern) that defines files and folders to exclude. The glob pattern
		 * will be matched against the file paths of resulting matches relative to their workspace. When `undefined` only default excludes will
		 * apply, when `null` no excludes will apply.
		 */
		exclude?: GlobPattern | null;

		/**
		 * The maximum number of results to search for
		 */
R
Rob Lourens 已提交
755
		maxResults?: number;
756 757 758 759 760

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

P
pkoushik 已提交
763 764 765 766
		/**
		 * Whether global files that exclude files, like .gitignore, should be respected.
		 * See the vscode setting `"search.useGlobalIgnoreFiles"`.
		 */
767
		useGlobalIgnoreFiles?: boolean;
P
pkoushik 已提交
768

769 770 771 772
		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
773
		followSymlinks?: boolean;
774 775 776 777 778

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

R
Rob Lourens 已提交
781 782 783
		/**
		 * Options to specify the size of the result text preview.
		 */
784
		previewOptions?: TextSearchPreviewOptions;
785 786 787 788 789 790 791 792 793 794

		/**
		 * 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 已提交
795 796
	}

797
	export namespace workspace {
798 799 800 801 802 803 804
		/**
		 * 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.
		 */
805
		export function findTextInFiles(query: TextSearchQuery, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
806 807 808 809 810 811 812 813 814

		/**
		 * 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.
		 */
815
		export function findTextInFiles(query: TextSearchQuery, options: FindTextInFilesOptions, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
816 817
	}

J
Johannes Rieken 已提交
818
	//#endregion
819

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

J
Joao Moreno 已提交
822 823 824
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
825 826 827 828 829 830 831
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849
	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;
	}
850

J
Johannes Rieken 已提交
851 852
	//#endregion

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

855
	export class Decoration {
856
		letter?: string;
857 858 859
		title?: string;
		color?: ThemeColor;
		priority?: number;
860
		bubble?: boolean;
861 862
	}

863
	export interface DecorationProvider {
864
		onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
865
		provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<Decoration>;
866 867 868
	}

	export namespace window {
869
		export function registerDecorationProvider(provider: DecorationProvider): Disposable;
870 871 872
	}

	//#endregion
873

874
	//#region Debug:
875

A
Andre Weinand 已提交
876 877
	// deprecated

878
	export interface DebugConfigurationProvider {
879
		/**
A
Andre Weinand 已提交
880 881
		 * Deprecated, use DebugAdapterDescriptorFactory.provideDebugAdapter instead.
		 * @deprecated Use DebugAdapterDescriptorFactory.createDebugAdapterDescriptor instead
882 883
		 */
		debugAdapterExecutable?(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult<DebugAdapterExecutable>;
884 885
	}

J
Johannes Rieken 已提交
886 887
	//#endregion

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

890 891 892 893 894 895 896 897 898 899 900 901 902
	/**
	 * 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 已提交
903 904 905 906 907
	export namespace env {
		/**
		 * Current logging level.
		 */
		export const logLevel: LogLevel;
908 909 910 911 912

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

J
Johannes Rieken 已提交
915 916 917
	//#endregion

	//#region Joao: SCM validation
918

J
Joao Moreno 已提交
919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963
	/**
	 * 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 已提交
964

J
Johannes Rieken 已提交
965 966
	//#endregion

967 968 969 970 971 972 973 974 975 976 977 978 979
	//#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>;
980 981 982 983
	}

	//#endregion

984 985 986 987 988 989 990 991
	//#region Joao: SCM Input Box

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

		/**
992 993
		 * Controls whether the input box is visible (default is `true`).
		 */
994 995 996 997 998
		visible: boolean;
	}

	//#endregion

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

1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011
	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 已提交
1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024
	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 exit status https://github.com/microsoft/vscode/issues/62103

D
Daniel Imms 已提交
1025 1026 1027 1028 1029
	export interface TerminalExitStatus {
		/**
		 * The exit code that a terminal exited with, it can have the following values:
		 * - Zero: the terminal process or custom execution succeeded.
		 * - Non-zero: the terminal process or custom execution failed.
D
Daniel Imms 已提交
1030
		 * - `undefined`: the user forcibly closed the terminal or a custom execution exited
D
Daniel Imms 已提交
1031 1032 1033 1034 1035
		 *   without providing an exit code.
		 */
		readonly code: number | undefined;
	}

D
Daniel Imms 已提交
1036
	export interface Terminal {
1037
		/**
D
Daniel Imms 已提交
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048
		 * The exit status of the terminal, this will be undefined while the terminal is active.
		 *
		 * **Example:** Show a notification with the exit code when the terminal exits with a
		 * non-zero exit code.
		 * ```typescript
		 * window.onDidCloseTerminal(t => {
		 *   if (t.exitStatus && t.exitStatus.code) {
		 *   	vscode.window.showInformationMessage(`Exit code: ${t.exitStatus.code}`);
		 *   }
		 * });
		 * ```
1049
		 */
D
Daniel Imms 已提交
1050
		readonly exitStatus: TerminalExitStatus | undefined;
1051 1052
	}

D
Daniel Imms 已提交
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069
	//#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;
	}
1070

D
Daniel Imms 已提交
1071 1072 1073 1074 1075 1076 1077 1078
	namespace window {
		/**
		 * An event which fires when the [dimensions](#Terminal.dimensions) of the terminal change.
		 */
		export const onDidChangeTerminalDimensions: Event<TerminalDimensionsChangeEvent>;
	}

	export interface Terminal {
1079
		/**
1080 1081 1082
		 * 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.
1083
		 */
1084
		readonly dimensions: TerminalDimensions | undefined;
D
Daniel Imms 已提交
1085 1086
	}

1087 1088
	//#endregion

1089 1090 1091 1092 1093 1094 1095
	//#region Joh -> exclusive document filters

	export interface DocumentFilter {
		exclusive?: boolean;
	}

	//#endregion
C
Christof Marti 已提交
1096

1097 1098 1099 1100 1101 1102 1103 1104
	//#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
1105

1106
	//#region Tree View: https://github.com/microsoft/vscode/issues/61313
1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117
	/**
	 * Label describing the [Tree item](#TreeItem)
	 */
	export interface TreeItemLabel {

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

		/**
S
Sandeep Somavarapu 已提交
1118
		 * Ranges in the label to highlight. A range is defined as a tuple of two number where the
S
Sandeep Somavarapu 已提交
1119
		 * first is the inclusive start index and the second the exclusive end index
1120
		 */
S
Sandeep Somavarapu 已提交
1121
		highlights?: [number, number][];
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136

	}

	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);
	}
1137
	//#endregion
1138

1139
	//#region CustomExecution: https://github.com/microsoft/vscode/issues/81007
1140 1141 1142
	/**
	 * A task to execute
	 */
G
Gabriel DeBacker 已提交
1143
	export class Task2 extends Task {
1144
		detail?: string;
1145
	}
G
Gabriel DeBacker 已提交
1146

1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157
	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>);
	}
1158
	//#endregion
1159

1160
	//#region Task presentation group: https://github.com/microsoft/vscode/issues/47265
1161 1162 1163 1164 1165 1166 1167
	export interface TaskPresentationOptions {
		/**
		 * Controls whether the task is executed in a specific terminal group using split panes.
		 */
		group?: string;
	}
	//#endregion
1168

1169
	//#region Status bar item with ID and Name: https://github.com/microsoft/vscode/issues/74972
1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215

	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
1216

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

M
Matt Bierner 已提交
1219 1220 1221
	/**
	 * Defines the editing functionality of a webview editor. This allows the webview editor to hook into standard
	 * editor events such as `undo` or `save`.
1222
	 *
1223
	 * @param EditType Type of edits.
M
Matt Bierner 已提交
1224
	 */
1225
	interface WebviewCustomEditorEditingDelegate<EditType> {
1226
		/**
1227
		 * Save a resource.
M
Matt Bierner 已提交
1228
		 *
1229
		 * @param resource Resource being saved.
M
Matt Bierner 已提交
1230 1231
		 *
		 * @return Thenable signaling that the save has completed.
1232
		 */
1233
		save(resource: Uri): Thenable<void>;
1234

1235
		/**
1236
		 * Save an existing resource at a new path.
1237 1238 1239
		 *
		 * @param resource Resource being saved.
		 * @param targetResource Location to save to.
1240 1241
		 *
		 * @return Thenable signaling that the save has completed.
1242 1243 1244
		 */
		saveAs(resource: Uri, targetResource: Uri): Thenable<void>;

M
Matt Bierner 已提交
1245
		/**
M
Matt Bierner 已提交
1246
		 * Event triggered by extensions to signal to VS Code that an edit has occurred.
M
Matt Bierner 已提交
1247
		 */
J
Johannes Rieken 已提交
1248 1249
		// TODO@matt
		// eslint-disable-next-line vscode-dts-event-naming
1250
		readonly onEdit: Event<{ readonly resource: Uri, readonly edit: EditType }>;
M
Matt Bierner 已提交
1251 1252

		/**
1253 1254
		 * Apply a set of edits.
		 *
1255
		 * Note that is not invoked when `onEdit` is called as `onEdit` implies also updating the view to reflect the edit.
1256
		 *
1257
		 * @param resource Resource being edited.
1258
		 * @param edit Array of edits. Sorted from oldest to most recent.
1259 1260
		 *
		 * @return Thenable signaling that the change has completed.
M
Matt Bierner 已提交
1261
		 */
1262
		applyEdits(resource: Uri, edits: readonly EditType[]): Thenable<void>;
1263 1264

		/**
1265
		 * Undo a set of edits.
1266
		 *
1267
		 * This is triggered when a user undoes an edit or when revert is called on a file.
1268
		 *
1269
		 * @param resource Resource being edited.
1270
		 * @param edit Array of edits. Sorted from most recent to oldest.
1271 1272
		 *
		 * @return Thenable signaling that the change has completed.
1273
		 */
1274
		undoEdits(resource: Uri, edits: readonly EditType[]): Thenable<void>;
M
Matt Bierner 已提交
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295

		/**
		 * Back up `resource` in its current state.
		 *
		 * 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 ).
		 *
		 * @param resource The resource to back up.
		 * @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.
		 */
		backup?(resource: Uri, cancellation: CancellationToken): Thenable<boolean>;
1296
	}
1297

1298
	export interface WebviewCustomEditorProvider {
1299
		/**
M
Matt Bierner 已提交
1300 1301 1302 1303
		 * Resolve a webview editor for a given resource.
		 *
		 * To resolve a webview editor, a provider must fill in its initial html content and hook up all
		 * the event listeners it is interested it. The provider should also take ownership of the passed in `WebviewPanel`.
1304
		 *
1305
		 * @param resource Resource being resolved.
1306 1307
		 * @param webview Webview being resolved. The provider should take ownership of this webview.
		 *
1308
		 * @return Thenable indicating that the webview editor has been resolved.
1309
		 */
1310
		resolveWebviewEditor(
1311
			resource: Uri,
1312
			webview: WebviewPanel,
1313 1314 1315 1316 1317 1318 1319 1320 1321 1322
		): Thenable<void>;

		/**
		 * Controls the editing functionality of a webview editor. This allows the webview editor to hook into standard
		 * editor events such as `undo` or `save`.
		 *
		 * WebviewEditors that do not have `editingCapability` are considered to be readonly. Users can still interact
		 * with readonly editors, but these editors will not integrate with VS Code's standard editor functionality.
		 */
		readonly editingDelegate?: WebviewCustomEditorEditingDelegate<unknown>;
1323 1324 1325
	}

	namespace window {
M
Matt Bierner 已提交
1326 1327 1328 1329 1330 1331 1332
		/**
		 * Register a new provider for webview editors of a given type.
		 *
		 * @param viewType  Type of the webview editor provider.
		 * @param provider Resolves webview editors.
		 * @param options Content settings for a webview panels the provider is given.
		 *
1333
		 * @return Disposable that unregisters the `WebviewCustomEditorProvider`.
M
Matt Bierner 已提交
1334
		 */
1335
		export function registerWebviewCustomEditorProvider(
1336
			viewType: string,
1337
			provider: WebviewCustomEditorProvider,
1338
			options?: WebviewPanelOptions,
1339 1340 1341 1342
		): Disposable;
	}

	//#endregion
1343

P
Peter Elmers 已提交
1344

J
Johannes Rieken 已提交
1345
	//#region allow QuickPicks to skip sorting: https://github.com/microsoft/vscode/issues/73904
P
Peter Elmers 已提交
1346 1347 1348

	export interface QuickPick<T extends QuickPickItem> extends QuickInput {
		/**
1349 1350
		 * An optional flag to sort the final results by index of first query match in label. Defaults to true.
		 */
P
Peter Elmers 已提交
1351 1352 1353 1354
		sortByLabel: boolean;
	}

	//#endregion
M
Matt Bierner 已提交
1355

J
Johannes Rieken 已提交
1356
	//#region Surfacing reasons why a code action cannot be applied to users: https://github.com/microsoft/vscode/issues/85160
M
Matt Bierner 已提交
1357 1358 1359 1360 1361

	export interface CodeAction {
		/**
		 * Marks that the code action cannot currently be applied.
		 *
M
Matt Bierner 已提交
1362
		 * Disabled code actions will be surfaced in the refactor UI but cannot be applied.
M
Matt Bierner 已提交
1363
		 */
M
Matt Bierner 已提交
1364 1365 1366 1367 1368 1369 1370 1371
		disabled?: {
			/**
			 * Human readable description of why the code action is currently disabled.
			 *
			 * This is displayed in the UI.
			 */
			reason: string;
		};
M
Matt Bierner 已提交
1372 1373 1374
	}

	//#endregion
E
Eric Amodio 已提交
1375 1376 1377 1378 1379 1380 1381 1382 1383

	//#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;
M
Matt Bierner 已提交
1384 1385 1386
	}

	//#endregion
R
rebornix 已提交
1387 1388 1389

	//#region Peng: Notebook

R
rebornix 已提交
1390
	export interface CellStreamOutput {
R
rebornix 已提交
1391 1392 1393 1394
		output_type: 'stream';
		text: string;
	}

R
rebornix 已提交
1395
	export interface CellErrorOutput {
R
rebornix 已提交
1396 1397 1398 1399 1400
		output_type: 'error';
		evalue: string;
		traceback: string[];
	}

R
rebornix 已提交
1401
	export interface CellDisplayOutput {
R
rebornix 已提交
1402
		output_type: 'display_data';
R
rebornix 已提交
1403
		data: { [key: string]: any };
R
rebornix 已提交
1404 1405
	}

R
rebornix 已提交
1406
	export type CellOutput = CellStreamOutput | CellErrorOutput | CellDisplayOutput;
R
rebornix 已提交
1407

R
rebornix 已提交
1408
	export interface NotebookCell {
R
rebornix 已提交
1409 1410
		handle: number;
		language: string;
R
rebornix 已提交
1411
		cell_type: 'markdown' | 'code';
R
rebornix 已提交
1412 1413
		outputs: CellOutput[];
		getContent(): string;
R
rebornix 已提交
1414 1415
	}

R
rebornix 已提交
1416 1417 1418
	export interface NotebookDocument {
		readonly uri: Uri;
		readonly fileName: string;
R
rebornix 已提交
1419
		readonly isDirty: boolean;
R
rebornix 已提交
1420
		languages: string[];
R
rebornix 已提交
1421
		cells: NotebookCell[];
R
rebornix 已提交
1422 1423
	}

R
rebornix 已提交
1424 1425 1426 1427 1428 1429 1430
	export interface NotebookEditor {
		readonly document: NotebookDocument;
		viewColumn?: ViewColumn;
		/**
		 * 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)
		 */
		createCell(content: string, language: string, type: 'markdown' | 'code', outputs: CellOutput[]): NotebookCell;
R
rebornix 已提交
1431 1432 1433
	}

	export interface NotebookProvider {
R
rebornix 已提交
1434 1435
		resolveNotebook(editor: NotebookEditor): Promise<void>;
		executeCell(document: NotebookDocument, cell: NotebookCell | undefined): Promise<void>;
R
rebornix 已提交
1436
		save(document: NotebookDocument): Promise<boolean>;
R
rebornix 已提交
1437 1438 1439 1440 1441 1442 1443
	}

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

		export let activeNotebookDocument: NotebookDocument | undefined;
R
rebornix 已提交
1446 1447 1448
	}

	//#endregion
S
Sandeep Somavarapu 已提交
1449
	//#region Language specific settings: https://github.com/microsoft/vscode/issues/26707
M
Martin Aeschlimann 已提交
1450
	//#region color theme access
S
Sandeep Somavarapu 已提交
1451

M
Martin Aeschlimann 已提交
1452 1453 1454 1455 1456 1457 1458 1459
	/**
	 * Represents a color theme kind.
	 */
	export enum ColorThemeKind {
		Light = 1,
		Dark = 2,
		HighContrast = 3
	}
S
Sandeep Somavarapu 已提交
1460 1461

	/**
M
Martin Aeschlimann 已提交
1462
	 * Represents a color theme.
S
Sandeep Somavarapu 已提交
1463
	 */
M
Martin Aeschlimann 已提交
1464
	export interface ColorTheme {
S
Sandeep Somavarapu 已提交
1465 1466

		/**
M
Martin Aeschlimann 已提交
1467
		 * The kind of this color theme: light, dark or high contrast.
S
Sandeep Somavarapu 已提交
1468
		 */
M
Martin Aeschlimann 已提交
1469
		readonly kind: ColorThemeKind;
S
Sandeep Somavarapu 已提交
1470 1471
	}

M
Martin Aeschlimann 已提交
1472
	export namespace window {
S
Sandeep Somavarapu 已提交
1473
		/**
M
Martin Aeschlimann 已提交
1474 1475
		 * The currently active color theme as configured in the settings. The active
		 * theme can be changed via the `workbench.colorTheme` setting.
S
Sandeep Somavarapu 已提交
1476
		 */
M
Martin Aeschlimann 已提交
1477
		export let activeColorTheme: ColorTheme;
S
Sandeep Somavarapu 已提交
1478

M
Martin Aeschlimann 已提交
1479 1480 1481 1482
		/**
		 * An [event](#Event) which fires when the active theme changes or one of it's colors chnage.
		 */
		export const onDidChangeActiveColorTheme: Event<ColorTheme>;
S
Sandeep Somavarapu 已提交
1483 1484
	}

1485 1486
	//#endregion

S
Sandeep Somavarapu 已提交
1487

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

P
label2  
Pine Wu 已提交
1490
	export interface CompletionItem {
S
Sandeep Somavarapu 已提交
1491
		/**
P
label2  
Pine Wu 已提交
1492
		 * Will be merged into CompletionItem#label
M
Matt Bierner 已提交
1493
		 */
P
Pine Wu 已提交
1494
		label2?: CompletionItemLabel;
P
label2  
Pine Wu 已提交
1495
	}
S
Sandeep Somavarapu 已提交
1496

1497 1498
	export interface CompletionItemLabel {
		/**
P
Pine Wu 已提交
1499
		 * The function or variable. Rendered leftmost.
1500
		 */
P
Pine Wu 已提交
1501
		name: string;
S
Sandeep Somavarapu 已提交
1502

P
Pine Wu 已提交
1503
		/**
P
Pine Wu 已提交
1504
		 * The signature without the return type. Render after `name`.
P
Pine Wu 已提交
1505 1506
		 */
		signature?: string;
1507

P
Pine Wu 已提交
1508
		/**
P
Pine Wu 已提交
1509
		 * The fully qualified name, like package name or file path. Rendered after `signature`.
P
Pine Wu 已提交
1510 1511
		 */
		qualifier?: string;
S
Sandeep Somavarapu 已提交
1512 1513

		/**
P
Pine Wu 已提交
1514
		 * The return-type of a function or type of a property/variable. Rendered rightmost.
P
Pine Wu 已提交
1515
		 */
P
Pine Wu 已提交
1516
		type?: string;
M
Matt Bierner 已提交
1517 1518 1519
	}

	//#endregion
M
Martin Aeschlimann 已提交
1520 1521


1522 1523 1524 1525 1526 1527 1528
	//#region https://github.com/microsoft/vscode/issues/77728

	export interface WorkspaceEditMetadata {
		needsConfirmation: boolean;
		label: string;
		description?: string;
		iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
M
Martin Aeschlimann 已提交
1529 1530
	}

1531
	export interface WorkspaceEdit {
M
Martin Aeschlimann 已提交
1532

1533 1534 1535 1536 1537 1538 1539
		insert(uri: Uri, position: Position, newText: string, metadata?: WorkspaceEditMetadata): void;
		delete(uri: Uri, range: Range, metadata?: WorkspaceEditMetadata): void;
		replace(uri: Uri, range: Range, newText: string, metadata?: WorkspaceEditMetadata): void;

		createFile(uri: Uri, options?: { overwrite?: boolean, ignoreIfExists?: boolean }, metadata?: WorkspaceEditMetadata): void;
		deleteFile(uri: Uri, options?: { recursive?: boolean, ignoreIfNotExists?: boolean }, metadata?: WorkspaceEditMetadata): void;
		renameFile(oldUri: Uri, newUri: Uri, options?: { overwrite?: boolean, ignoreIfExists?: boolean }, metadata?: WorkspaceEditMetadata): void;
M
Martin Aeschlimann 已提交
1540 1541
	}

1542
	//#endregion
1543 1544

	//#region Diagnostic links https://github.com/microsoft/vscode/issues/11847
M
Martin Aeschlimann 已提交
1545

1546
	export interface Diagnostic {
M
Martin Aeschlimann 已提交
1547
		/**
1548
		 * Will be merged into `Diagnostic#code`
M
Martin Aeschlimann 已提交
1549
		 */
1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561
		code2?: {
			/**
			 * A code or identifier for this diagnostic.
			 * Should be used for later processing, e.g. when providing [code actions](#CodeActionContext).
			 */
			value: string | number;

			/**
			 * A link to a URI with more information about the diagnostic error.
			 */
			link: Uri;
		}
M
Martin Aeschlimann 已提交
1562 1563
	}

1564
	//#endregion
1565 1566 1567 1568 1569

	//#region eamodio - timeline: https://github.com/microsoft/vscode/issues/84297

	export class TimelineItem {
		/**
E
Eric Amodio 已提交
1570
		 * A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred
1571
		 */
E
Eric Amodio 已提交
1572
		timestamp: number;
1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586

		/**
		 * A human-readable string describing the timeline item. When `falsy`, it is derived from [resourceUri](#TreeItem.resourceUri).
		 */
		label: string;

		/**
		 * Optional id for the timeline item. See [TreeItem.id](#TreeItem.id) for more details.
		 */
		id?: string;

		/**
		 * The icon path or [ThemeIcon](#ThemeIcon) for the timeline item. See [TreeItem.iconPath](#TreeItem.iconPath) for more details.
		 */
1587
		iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
1588 1589 1590 1591 1592 1593 1594 1595 1596

		/**
		 * A human readable string describing less prominent details of the timeline item. See [TreeItem.description](#TreeItem.description) for more details.
		 */
		description?: string;

		/**
		 * The tooltip text when you hover over the timeline item.
		 */
1597
		detail?: string;
1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610

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

		/**
		 * Context value of the timeline item.  See [TreeItem.contextValue](#TreeItem.contextValue) for more details.
		 */
		contextValue?: string;

		/**
		 * @param label A human-readable string describing the timeline item
E
Eric Amodio 已提交
1611
		 * @param timestamp A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred
1612
		 */
E
Eric Amodio 已提交
1613
		constructor(label: string, timestamp: number);
1614 1615
	}

1616
	export interface TimelineProvider {
E
Eric Amodio 已提交
1617 1618 1619 1620
		/**
		 * 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`.
		 */
1621
		onDidChange?: Event<Uri | undefined>;
1622 1623

		/**
1624
		 * An identifier of the source of the timeline items. This can be used for filtering and/or overriding existing sources.
1625
		 */
1626
		source: string;
1627 1628

		/**
1629
		 * A human-readable string describing the source of the timeline items. This can be as the display label when filtering by sources.
1630
		 */
1631
		sourceDescription: string;
1632

E
Eric Amodio 已提交
1633 1634 1635
		/**
		 * A flag that signals whether this provider can be swapped out (replaced) for another provider using the same [TimelineProvider.source](#TimelineProvider.source).
		 */
1636
		replaceable?: boolean;
1637 1638

		/**
E
Eric Amodio 已提交
1639
		 * Provide [timeline items](#TimelineItem) for a [Uri](#Uri).
1640 1641 1642 1643 1644 1645
		 *
		 * @param uri The uri of the file to provide the timeline for.
		 * @param token A cancellation token.
		 * @return An array of timeline items or a thenable that resolves to such. The lack of a result
		 * can be signaled by returning `undefined`, `null`, or an empty array.
		 */
E
Eric Amodio 已提交
1646
		provideTimeline(uri: Uri, token: CancellationToken): ProviderResult<TimelineItem[]>;
1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659
	}

	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.
		 *
		 * @param selector A selector that defines the documents this provider is applicable to.
		 * @param provider A timeline provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
E
Eric Amodio 已提交
1660
		*/
1661 1662 1663 1664
		export function registerTimelineProvider(selector: DocumentSelector, provider: TimelineProvider): Disposable;
	}

	//#endregion
J
Johannes Rieken 已提交
1665
}