vscode.proposed.d.ts 72.9 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' {

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
	//#region https://github.com/microsoft/vscode/issues/93686

	/**
	 * An error type should be used to signal cancellation of an operation.
	 *
	 * This type can be used in response to a cancellation token or when an
	 * operation is being cancelled by the executor of that operation.
	 */
	export class CancellationError extends Error {

		/**
		 * Creates a new cancellation error.
		 */
		constructor();
	}


	//#endregion

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

40 41 42 43 44 45 46
	/**
	 * 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.
		 */
47
		readonly added: ReadonlyArray<AuthenticationProviderInformation>;
48 49

		/**
50
		 * The ids of the [authenticationProvider](#AuthenticationProvider)s that have been removed.
51
		 */
52
		readonly removed: ReadonlyArray<AuthenticationProviderInformation>;
53 54
	}

55 56 57
	/**
	* An [event](#Event) which fires when an [AuthenticationSession](#AuthenticationSession) is added, removed, or changed.
	*/
58
	export interface AuthenticationProviderAuthenticationSessionsChangeEvent {
59 60 61
		/**
		 * The ids of the [AuthenticationSession](#AuthenticationSession)s that have been added.
		*/
62
		readonly added: ReadonlyArray<string>;
63 64 65 66

		/**
		 * The ids of the [AuthenticationSession](#AuthenticationSession)s that have been removed.
		 */
67
		readonly removed: ReadonlyArray<string>;
68 69 70 71

		/**
		 * The ids of the [AuthenticationSession](#AuthenticationSession)s that have been changed.
		 */
72
		readonly changed: ReadonlyArray<string>;
73 74
	}

75 76 77 78 79
	/**
	 * **WARNING** When writing an AuthenticationProvider, `id` should be treated as part of your extension's
	 * API, changing it is a breaking change for all extensions relying on the provider. The id is
	 * treated case-sensitively.
	 */
80
	export interface AuthenticationProvider {
81 82
		/**
		 * Used as an identifier for extensions trying to work with a particular
83
		 * provider: 'microsoft', 'github', etc. id must be unique, registering
84 85
		 * another provider with the same id will fail.
		 */
86
		readonly id: string;
87

88
		/**
89
		 * The human-readable name of the provider.
90
		 */
91
		readonly label: string;
92 93 94 95 96

		/**
		 * Whether it is possible to be signed into multiple accounts at once with this provider
		*/
		readonly supportsMultipleAccounts: boolean;
97 98

		/**
99
		 * An [event](#Event) which fires when the array of sessions has changed, or data
100 101
		 * within a session has changed.
		 */
102
		readonly onDidChangeSessions: Event<AuthenticationProviderAuthenticationSessionsChangeEvent>;
103

104 105 106
		/**
		 * Returns an array of current sessions.
		 */
J
Johannes Rieken 已提交
107
		// eslint-disable-next-line vscode-dts-provider-naming
108
		getSessions(): Thenable<ReadonlyArray<AuthenticationSession>>;
109

110 111 112
		/**
		 * Prompts a user to login.
		 */
J
Johannes Rieken 已提交
113
		// eslint-disable-next-line vscode-dts-provider-naming
114
		login(scopes: string[]): Thenable<AuthenticationSession>;
115 116 117 118 119

		/**
		 * Removes the session corresponding to session id.
		 * @param sessionId The session id to log out of
		 */
J
Johannes Rieken 已提交
120
		// eslint-disable-next-line vscode-dts-provider-naming
121
		logout(sessionId: string): Thenable<void>;
122 123 124
	}

	export namespace authentication {
125 126 127 128 129 130 131 132 133
		/**
		 * Register an authentication provider.
		 *
		 * There can only be one provider per id and an error is being thrown when an id
		 * has already been used by another provider.
		 *
		 * @param provider The authentication provider provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
134
		export function registerAuthenticationProvider(provider: AuthenticationProvider): Disposable;
135 136

		/**
137
		 * @deprecated - getSession should now trigger extension activation.
138 139
		 * Fires with the provider id that was registered or unregistered.
		 */
140
		export const onDidChangeAuthenticationProviders: Event<AuthenticationProvidersChangeEvent>;
141

142
		/**
143 144 145
		 * An array of the information of authentication providers that are currently registered.
		 */
		export const providers: ReadonlyArray<AuthenticationProviderInformation>;
146

147 148 149 150 151 152 153
		/**
		* Logout of a specific session.
		* @param providerId The id of the provider to use
		* @param sessionId The session id to remove
		* provider
		*/
		export function logout(providerId: string, sessionId: string): Thenable<void>;
154 155
	}

J
Johannes Rieken 已提交
156 157
	//#endregion

A
Alex Ross 已提交
158
	//#region @alexdima - resolvers
A
Alex Dima 已提交
159

A
Tweaks  
Alex Dima 已提交
160 161 162 163
	export interface RemoteAuthorityResolverContext {
		resolveAttempt: number;
	}

A
Alex Dima 已提交
164 165 166
	export class ResolvedAuthority {
		readonly host: string;
		readonly port: number;
167
		readonly connectionToken: string | undefined;
A
Alex Dima 已提交
168

169
		constructor(host: string, port: number, connectionToken?: string);
A
Alex Dima 已提交
170 171
	}

172
	export interface ResolvedOptions {
R
rebornix 已提交
173
		extensionHostEnv?: { [key: string]: string | null; };
174 175
	}

176
	export interface TunnelOptions {
R
rebornix 已提交
177
		remoteAddress: { port: number, host: string; };
A
Alex Ross 已提交
178 179 180
		// The desired local port. If this port can't be used, then another will be chosen.
		localAddressPort?: number;
		label?: string;
181 182
	}

A
Alex Ross 已提交
183
	export interface TunnelDescription {
R
rebornix 已提交
184
		remoteAddress: { port: number, host: string; };
A
Alex Ross 已提交
185
		//The complete local address(ex. localhost:1234)
R
rebornix 已提交
186
		localAddress: { port: number, host: string; } | string;
A
Alex Ross 已提交
187 188 189
	}

	export interface Tunnel extends TunnelDescription {
A
Alex Ross 已提交
190 191
		// Implementers of Tunnel should fire onDidDispose when dispose is called.
		onDidDispose: Event<void>;
192
		dispose(): void | Thenable<void>;
193 194 195
	}

	/**
196 197
	 * Used as part of the ResolverResult if the extension has any candidate,
	 * published, or forwarded ports.
198 199 200 201
	 */
	export interface TunnelInformation {
		/**
		 * Tunnels that are detected by the extension. The remotePort is used for display purposes.
A
Alex Ross 已提交
202
		 * The localAddress should be the complete local address (ex. localhost:1234) for connecting to the port. Tunnels provided through
203 204
		 * detected are read-only from the forwarded ports UI.
		 */
A
Alex Ross 已提交
205
		environmentTunnels?: TunnelDescription[];
A
Alex Ross 已提交
206

207 208
	}

209
	export interface TunnelCreationOptions {
210 211 212 213 214 215
		/**
		 * True when the local operating system will require elevation to use the requested local port.
		 */
		elevationRequired?: boolean;
	}

216
	export type ResolverResult = ResolvedAuthority & ResolvedOptions & TunnelInformation;
217

A
Tweaks  
Alex Dima 已提交
218 219 220 221 222 223 224
	export class RemoteAuthorityResolverError extends Error {
		static NotAvailable(message?: string, handled?: boolean): RemoteAuthorityResolverError;
		static TemporarilyNotAvailable(message?: string): RemoteAuthorityResolverError;

		constructor(message?: string);
	}

A
Alex Dima 已提交
225
	export interface RemoteAuthorityResolver {
226
		resolve(authority: string, context: RemoteAuthorityResolverContext): ResolverResult | Thenable<ResolverResult>;
227 228 229 230
		/**
		 * 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.
231 232 233
		 *
		 * To enable the "Change Local Port" action on forwarded ports, make sure to set the `localAddress` of
		 * the returned `Tunnel` to a `{ port: number, host: string; }` and not a string.
234
		 */
235
		tunnelFactory?: (tunnelOptions: TunnelOptions, tunnelCreationOptions: TunnelCreationOptions) => Thenable<Tunnel> | undefined;
236

237
		/**p
238 239 240
		 * Provides filtering for candidate ports.
		 */
		showCandidatePort?: (host: string, port: number, detail: string) => Thenable<boolean>;
241 242 243 244 245 246 247 248

		/**
		 * Lets the resolver declare which tunnel factory features it supports.
		 * UNDER DISCUSSION! MAY CHANGE SOON.
		 */
		tunnelFeatures?: {
			elevation: boolean;
		};
249 250 251 252
	}

	export namespace workspace {
		/**
253
		 * Forwards a port. If the current resolver implements RemoteAuthorityResolver:forwardPort then that will be used to make the tunnel.
A
Alex Ross 已提交
254
		 * By default, openTunnel only support localhost; however, RemoteAuthorityResolver:tunnelFactory can be used to support other ips.
255 256 257
		 *
		 * @throws When run in an environment without a remote.
		 *
A
Alex Ross 已提交
258
		 * @param tunnelOptions The `localPort` is a suggestion only. If that port is not available another will be chosen.
259
		 */
A
Alex Ross 已提交
260
		export function openTunnel(tunnelOptions: TunnelOptions): Thenable<Tunnel>;
261 262 263 264 265 266

		/**
		 * 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 已提交
267

268 269 270 271
		/**
		 * Fired when the list of tunnels has changed.
		 */
		export const onDidChangeTunnels: Event<void>;
A
Alex Dima 已提交
272 273
	}

274 275 276 277 278 279 280 281
	export interface ResourceLabelFormatter {
		scheme: string;
		authority?: string;
		formatting: ResourceLabelFormatting;
	}

	export interface ResourceLabelFormatting {
		label: string; // myLabel:/${path}
I
isidor 已提交
282
		// For historic reasons we use an or string here. Once we finalize this API we should start using enums instead and adopt it in extensions.
J
Johannes Rieken 已提交
283
		// eslint-disable-next-line vscode-dts-literal-or-types
284 285 286 287 288
		separator: '/' | '\\' | '';
		tildify?: boolean;
		normalizeDriveLetter?: boolean;
		workspaceSuffix?: string;
		authorityPrefix?: string;
289
		stripPathStartingSeparator?: boolean;
290 291
	}

A
Alex Dima 已提交
292 293
	export namespace workspace {
		export function registerRemoteAuthorityResolver(authorityPrefix: string, resolver: RemoteAuthorityResolver): Disposable;
294
		export function registerResourceLabelFormatter(formatter: ResourceLabelFormatter): Disposable;
295
	}
296

297 298
	//#endregion

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

301 302
	export interface WebviewEditorInset {
		readonly editor: TextEditor;
303 304
		readonly line: number;
		readonly height: number;
305 306 307
		readonly webview: Webview;
		readonly onDidDispose: Event<void>;
		dispose(): void;
308 309
	}

310
	export namespace window {
311
		export function createWebviewTextEditorInset(editor: TextEditor, line: number, height: number, options?: WebviewOptions): WebviewEditorInset;
A
Alex Dima 已提交
312 313 314 315
	}

	//#endregion

J
Johannes Rieken 已提交
316
	//#region read/write in chunks: https://github.com/microsoft/vscode/issues/84515
317 318

	export interface FileSystemProvider {
R
rebornix 已提交
319
		open?(resource: Uri, options: { create: boolean; }): number | Thenable<number>;
320 321 322 323 324 325 326
		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 已提交
327
	//#region TextSearchProvider: https://github.com/microsoft/vscode/issues/59921
328

329 330 331
	/**
	 * The parameters of a query for text search.
	 */
332
	export interface TextSearchQuery {
333 334 335
		/**
		 * The text pattern to search for.
		 */
336
		pattern: string;
337

R
Rob Lourens 已提交
338 339 340 341 342
		/**
		 * Whether or not `pattern` should match multiple lines of text.
		 */
		isMultiline?: boolean;

343 344 345
		/**
		 * Whether or not `pattern` should be interpreted as a regular expression.
		 */
R
Rob Lourens 已提交
346
		isRegExp?: boolean;
347 348 349 350

		/**
		 * Whether or not the search should be case-sensitive.
		 */
R
Rob Lourens 已提交
351
		isCaseSensitive?: boolean;
352 353 354 355

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

359 360
	/**
	 * A file glob pattern to match file paths against.
361
	 * TODO@roblourens merge this with the GlobPattern docs/definition in vscode.d.ts.
362 363 364 365 366 367 368
	 * @see [GlobPattern](#GlobPattern)
	 */
	export type GlobString = string;

	/**
	 * Options common to file and text search
	 */
R
Rob Lourens 已提交
369
	export interface SearchOptions {
370 371 372
		/**
		 * The root folder to search within.
		 */
373
		folder: Uri;
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388

		/**
		 * 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 已提交
389
		useIgnoreFiles: boolean;
390 391 392 393 394

		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
395
		followSymlinks: boolean;
P
pkoushik 已提交
396 397 398 399 400 401

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

R
Rob Lourens 已提交
404 405
	/**
	 * Options to specify the size of the result text preview.
R
Rob Lourens 已提交
406
	 * These options don't affect the size of the match itself, just the amount of preview text.
R
Rob Lourens 已提交
407
	 */
408
	export interface TextSearchPreviewOptions {
409
		/**
R
Rob Lourens 已提交
410
		 * The maximum number of lines in the preview.
R
Rob Lourens 已提交
411
		 * Only search providers that support multiline search will ever return more than one line in the match.
412
		 */
R
Rob Lourens 已提交
413
		matchLines: number;
R
Rob Lourens 已提交
414 415 416 417

		/**
		 * The maximum number of characters included per line.
		 */
R
Rob Lourens 已提交
418
		charsPerLine: number;
419 420
	}

421 422 423
	/**
	 * Options that apply to text search.
	 */
R
Rob Lourens 已提交
424
	export interface TextSearchOptions extends SearchOptions {
425
		/**
426
		 * The maximum number of results to be returned.
427
		 */
428 429
		maxResults: number;

R
Rob Lourens 已提交
430 431 432
		/**
		 * Options to specify the size of the result text preview.
		 */
433
		previewOptions?: TextSearchPreviewOptions;
434 435 436 437

		/**
		 * Exclude files larger than `maxFileSize` in bytes.
		 */
438
		maxFileSize?: number;
439 440 441 442 443

		/**
		 * Interpret files using this encoding.
		 * See the vscode setting `"files.encoding"`
		 */
444
		encoding?: string;
445 446 447 448 449 450 451 452 453 454

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

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

457 458 459 460 461 462 463 464 465 466 467 468 469 470
	/**
	 * 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 已提交
471 472 473
	/**
	 * A preview of the text result.
	 */
474
	export interface TextSearchMatchPreview {
475
		/**
R
Rob Lourens 已提交
476
		 * The matching lines of text, or a portion of the matching line that contains the match.
477 478 479 480 481
		 */
		text: string;

		/**
		 * The Range within `text` corresponding to the text of the match.
482
		 * The number of matches must match the TextSearchMatch's range property.
483
		 */
484
		matches: Range | Range[];
485 486 487 488 489
	}

	/**
	 * A match from a text search
	 */
490
	export interface TextSearchMatch {
491 492 493
		/**
		 * The uri for the matching document.
		 */
494
		uri: Uri;
495 496

		/**
497
		 * The range of the match within the document, or multiple ranges for multiple matches.
498
		 */
499
		ranges: Range | Range[];
R
Rob Lourens 已提交
500

501
		/**
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523
		 * 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.
524
		 */
525
		lineNumber: number;
526 527
	}

528 529
	export type TextSearchResult = TextSearchMatch | TextSearchContext;

R
Rob Lourens 已提交
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573
	/**
	 * 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;
	}

574
	/**
R
Rob Lourens 已提交
575 576 577 578 579 580 581
	 * 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.
582
	 */
583
	export interface FileSearchProvider {
584 585 586 587 588 589
		/**
		 * 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.
		 */
590
		provideFileSearchResults(query: FileSearchQuery, options: FileSearchOptions, token: CancellationToken): ProviderResult<Uri[]>;
591
	}
592

R
Rob Lourens 已提交
593
	export namespace workspace {
594
		/**
R
Rob Lourens 已提交
595 596 597 598 599 600 601
		 * 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.
602
		 */
R
Rob Lourens 已提交
603 604 605 606 607 608 609 610 611 612 613 614
		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;
615 616
	}

R
Rob Lourens 已提交
617 618 619 620
	//#endregion

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

621 622 623
	/**
	 * Options that can be set on a findTextInFiles search.
	 */
R
Rob Lourens 已提交
624
	export interface FindTextInFilesOptions {
625 626 627 628 629
		/**
		 * 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).
		 */
630
		include?: GlobPattern;
631 632 633

		/**
		 * A [glob pattern](#GlobPattern) that defines files and folders to exclude. The glob pattern
634 635
		 * will be matched against the file paths of resulting matches relative to their workspace. When `undefined`, default excludes will
		 * apply.
636
		 */
637 638 639 640
		exclude?: GlobPattern;

		/**
		 * Whether to use the default and user-configured excludes. Defaults to true.
641
		 */
642
		useDefaultExcludes?: boolean;
643 644 645 646

		/**
		 * The maximum number of results to search for
		 */
R
Rob Lourens 已提交
647
		maxResults?: number;
648 649 650 651 652

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

P
pkoushik 已提交
655 656 657 658
		/**
		 * Whether global files that exclude files, like .gitignore, should be respected.
		 * See the vscode setting `"search.useGlobalIgnoreFiles"`.
		 */
659
		useGlobalIgnoreFiles?: boolean;
P
pkoushik 已提交
660

661 662 663 664
		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
665
		followSymlinks?: boolean;
666 667 668 669 670

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

R
Rob Lourens 已提交
673 674 675
		/**
		 * Options to specify the size of the result text preview.
		 */
676
		previewOptions?: TextSearchPreviewOptions;
677 678 679 680 681 682 683 684 685 686

		/**
		 * 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 已提交
687 688
	}

689
	export namespace workspace {
690 691 692 693 694 695 696
		/**
		 * 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.
		 */
697
		export function findTextInFiles(query: TextSearchQuery, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
698 699 700 701 702 703 704 705 706

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

J
Johannes Rieken 已提交
710
	//#endregion
711

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

J
Joao Moreno 已提交
714 715 716
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
717 718 719 720 721 722 723
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741
	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;
	}
742

J
Johannes Rieken 已提交
743 744
	//#endregion

745
	//#region debug
746

747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762
	/**
	 * A DebugProtocolVariableContainer is an opaque stand-in type for the intersection of the Scope and Variable types defined in the Debug Adapter Protocol.
	 * See https://microsoft.github.io/debug-adapter-protocol/specification#Types_Scope and https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable.
	 */
	export interface DebugProtocolVariableContainer {
		// Properties: the intersection of DAP's Scope and Variable types.
	}

	/**
	 * A DebugProtocolVariable is an opaque stand-in type for the Variable type defined in the Debug Adapter Protocol.
	 * See https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable.
	 */
	export interface DebugProtocolVariable {
		// Properties: see details [here](https://microsoft.github.io/debug-adapter-protocol/specification#Base_Protocol_Variable).
	}

J
Johannes Rieken 已提交
763 764 765 766
	//#endregion



767
	//#region @joaomoreno: SCM validation
768

J
Joao Moreno 已提交
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813
	/**
	 * 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 已提交
814

J
Johannes Rieken 已提交
815 816
	//#endregion

817
	//#region @joaomoreno: SCM selected provider
818 819 820 821 822 823 824 825 826 827 828 829

	export interface SourceControl {

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

		/**
		 * An event signaling when the selection state changes.
		 */
		readonly onDidChangeSelection: Event<boolean>;
830 831 832 833
	}

	//#endregion

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

836 837 838 839 840 841 842 843 844 845 846
	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 已提交
847 848
	namespace window {
		/**
D
Daniel Imms 已提交
849 850 851
		 * An event which fires when the terminal's child pseudo-device is written to (the shell).
		 * In other words, this provides access to the raw data stream from the process running
		 * within the terminal, including VT sequences.
D
Daniel Imms 已提交
852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872
		 */
		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;
	}
873

D
Daniel Imms 已提交
874
	export namespace window {
D
Daniel Imms 已提交
875 876 877 878 879 880 881
		/**
		 * An event which fires when the [dimensions](#Terminal.dimensions) of the terminal change.
		 */
		export const onDidChangeTerminalDimensions: Event<TerminalDimensionsChangeEvent>;
	}

	export interface Terminal {
882
		/**
883 884 885
		 * 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.
886
		 */
887
		readonly dimensions: TerminalDimensions | undefined;
D
Daniel Imms 已提交
888 889
	}

890 891
	//#endregion

892
	//#region @jrieken -> exclusive document filters
893 894

	export interface DocumentFilter {
895
		readonly exclusive?: boolean;
896 897 898
	}

	//#endregion
C
Christof Marti 已提交
899

900
	//#region @alexdima - OnEnter enhancement
901 902 903 904 905 906 907
	export interface OnEnterRule {
		/**
		 * This rule will only execute if the text above the this line matches this regular expression.
		 */
		oneLineAboveText?: RegExp;
	}
	//#endregion
908

909
	//#region Tree View: https://github.com/microsoft/vscode/issues/61313 @alexr00
910 911 912
	export interface TreeView<T> extends Disposable {
		reveal(element: T | undefined, options?: { select?: boolean, focus?: boolean, expand?: boolean | number }): Thenable<void>;
	}
913
	//#endregion
914

915 916
	//#region Tree data provider: https://github.com/microsoft/vscode/issues/111614 @alexr00
	export interface TreeDataProvider<T> {
917
		resolveTreeItem?(item: TreeItem, element: T, token: CancellationToken): ProviderResult<TreeItem>;
918 919 920
	}
	////#endregion

921
	//#region Task presentation group: https://github.com/microsoft/vscode/issues/47265
922 923 924 925 926 927 928
	export interface TaskPresentationOptions {
		/**
		 * Controls whether the task is executed in a specific terminal group using split panes.
		 */
		group?: string;
	}
	//#endregion
929

930
	//#region Status bar item with ID and Name: https://github.com/microsoft/vscode/issues/74972
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952

	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;

953 954 955 956 957
			/**
			 * Accessibility information used when screen reader interacts with this status bar item.
			 */
			accessibilityInformation?: AccessibilityInformation;

958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981
			/**
			 * 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
982

983
	//#region Custom editor move https://github.com/microsoft/vscode/issues/86146
984

985
	// TODO: Also for custom editor
986

987
	export interface CustomTextEditorProvider {
M
Matt Bierner 已提交
988

989 990 991 992 993 994 995 996
		/**
		 * 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.
997
		 * @param token A cancellation token that indicates the result is no longer needed.
998 999 1000
		 *
		 * @return Thenable indicating that the webview editor has been moved.
		 */
J
Johannes Rieken 已提交
1001
		// eslint-disable-next-line vscode-dts-provider-naming
1002
		moveCustomTextEditor?(newDocument: TextDocument, existingWebviewPanel: WebviewPanel, token: CancellationToken): Thenable<void>;
1003 1004 1005
	}

	//#endregion
1006

J
Johannes Rieken 已提交
1007
	//#region allow QuickPicks to skip sorting: https://github.com/microsoft/vscode/issues/73904
P
Peter Elmers 已提交
1008 1009 1010

	export interface QuickPick<T extends QuickPickItem> extends QuickInput {
		/**
1011 1012
		 * An optional flag to sort the final results by index of first query match in label. Defaults to true.
		 */
P
Peter Elmers 已提交
1013 1014 1015 1016
		sortByLabel: boolean;
	}

	//#endregion
M
Matt Bierner 已提交
1017

1018
	//#region @rebornix: Notebook
R
rebornix 已提交
1019

R
rebornix 已提交
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030
	export enum CellKind {
		Markdown = 1,
		Code = 2
	}

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

R
rebornix 已提交
1031
	export interface CellStreamOutput {
R
rebornix 已提交
1032
		outputKind: CellOutputKind.Text;
R
rebornix 已提交
1033 1034 1035
		text: string;
	}

R
rebornix 已提交
1036
	export interface CellErrorOutput {
R
rebornix 已提交
1037
		outputKind: CellOutputKind.Error;
R
rebornix 已提交
1038 1039 1040 1041 1042 1043 1044
		/**
		 * Exception Name
		 */
		ename: string;
		/**
		 * Exception Value
		 */
R
rebornix 已提交
1045
		evalue: string;
R
rebornix 已提交
1046 1047 1048
		/**
		 * Exception call stack
		 */
R
rebornix 已提交
1049 1050 1051
		traceback: string[];
	}

R
rebornix 已提交
1052 1053 1054 1055 1056 1057 1058
	export interface NotebookCellOutputMetadata {
		/**
		 * Additional attributes of a cell metadata.
		 */
		custom?: { [key: string]: any };
	}

R
rebornix 已提交
1059
	export interface CellDisplayOutput {
R
rebornix 已提交
1060
		outputKind: CellOutputKind.Rich;
R
rebornix 已提交
1061 1062 1063 1064 1065 1066
		/**
		 * { mime_type: value }
		 *
		 * Example:
		 * ```json
		 * {
R
rebornix 已提交
1067
		 *   "outputKind": vscode.CellOutputKind.Rich,
R
rebornix 已提交
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077
		 *   "data": {
		 *      "text/html": [
		 *          "<h1>Hello</h1>"
		 *       ],
		 *      "text/plain": [
		 *        "<IPython.lib.display.IFrame at 0x11dee3e80>"
		 *      ]
		 *   }
		 * }
		 */
R
rebornix 已提交
1078
		data: { [key: string]: any; };
R
rebornix 已提交
1079 1080

		readonly metadata?: NotebookCellOutputMetadata;
R
rebornix 已提交
1081 1082
	}

R
rebornix 已提交
1083
	export type CellOutput = CellStreamOutput | CellErrorOutput | CellDisplayOutput;
R
rebornix 已提交
1084

J
renames  
Johannes Rieken 已提交
1085
	export class NotebookCellOutputItem {
1086 1087 1088 1089 1090 1091 1092 1093

		readonly mime: string;
		readonly value: unknown;
		readonly metadata?: Record<string, string | number | boolean>;

		constructor(mime: string, value: unknown, metadata?: Record<string, string | number | boolean>);
	}

J
Johannes Rieken 已提交
1094
	//TODO@jrieken add id?
J
renames  
Johannes Rieken 已提交
1095
	export class NotebookCellOutput {
1096

J
renames  
Johannes Rieken 已提交
1097
		readonly outputs: NotebookCellOutputItem[];
1098 1099
		readonly metadata?: Record<string, string | number | boolean>;

J
renames  
Johannes Rieken 已提交
1100
		constructor(outputs: NotebookCellOutputItem[], metadata?: Record<string, string | number | boolean>);
1101 1102 1103

		//TODO@jrieken HACK to workaround dependency issues...
		toJSON(): any;
1104 1105
	}

R
Rob Lourens 已提交
1106 1107 1108 1109 1110 1111 1112
	export enum NotebookCellRunState {
		Running = 1,
		Idle = 2,
		Success = 3,
		Error = 4
	}

R
Rob Lourens 已提交
1113 1114 1115 1116 1117
	export enum NotebookRunState {
		Running = 1,
		Idle = 2
	}

R
rebornix 已提交
1118
	export interface NotebookCellMetadata {
1119
		/**
1120
		 * Controls whether a cell's editor is editable/readonly.
1121
		 */
R
rebornix 已提交
1122
		editable?: boolean;
R
rebornix 已提交
1123 1124 1125 1126 1127

		/**
		 * Controls if the cell is executable.
		 * This metadata is ignored for markdown cell.
		 */
R
rebornix 已提交
1128
		runnable?: boolean;
R
rebornix 已提交
1129

1130 1131 1132 1133 1134 1135
		/**
		 * Controls if the cell has a margin to support the breakpoint UI.
		 * This metadata is ignored for markdown cell.
		 */
		breakpointMargin?: boolean;

1136 1137 1138 1139 1140 1141
		/**
		 * Whether the [execution order](#NotebookCellMetadata.executionOrder) indicator will be displayed.
		 * Defaults to true.
		 */
		hasExecutionOrder?: boolean;

R
rebornix 已提交
1142
		/**
1143
		 * The order in which this cell was executed.
R
rebornix 已提交
1144
		 */
1145
		executionOrder?: number;
R
Rob Lourens 已提交
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155

		/**
		 * A status message to be shown in the cell's status bar
		 */
		statusMessage?: string;

		/**
		 * The cell's current run state
		 */
		runState?: NotebookCellRunState;
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165

		/**
		 * If the cell is running, the time at which the cell started running
		 */
		runStartTime?: number;

		/**
		 * The total duration of the cell's last run
		 */
		lastRunDuration?: number;
R
rebornix 已提交
1166

1167 1168 1169 1170 1171 1172 1173 1174 1175 1176
		/**
		 * Whether a code cell's editor is collapsed
		 */
		inputCollapsed?: boolean;

		/**
		 * Whether a code cell's outputs are collapsed
		 */
		outputCollapsed?: boolean;

R
rebornix 已提交
1177 1178 1179
		/**
		 * Additional attributes of a cell metadata.
		 */
R
rebornix 已提交
1180
		custom?: { [key: string]: any };
R
rebornix 已提交
1181 1182
	}

R
rebornix 已提交
1183
	export interface NotebookCell {
1184
		readonly index: number;
1185
		readonly notebook: NotebookDocument;
1186
		readonly uri: Uri;
R
rebornix 已提交
1187
		readonly cellKind: CellKind;
1188
		readonly document: TextDocument;
1189
		readonly language: string;
R
rebornix 已提交
1190
		outputs: CellOutput[];
R
rebornix 已提交
1191
		metadata: NotebookCellMetadata;
R
rebornix 已提交
1192 1193 1194
	}

	export interface NotebookDocumentMetadata {
1195 1196
		/**
		 * Controls if users can add or delete cells
1197
		 * Defaults to true
1198
		 */
1199
		editable?: boolean;
R
rebornix 已提交
1200

1201 1202 1203 1204 1205 1206
		/**
		 * Controls whether the full notebook can be run at once.
		 * Defaults to true
		 */
		runnable?: boolean;

1207 1208
		/**
		 * Default value for [cell editable metadata](#NotebookCellMetadata.editable).
1209
		 * Defaults to true.
1210
		 */
1211
		cellEditable?: boolean;
R
rebornix 已提交
1212 1213 1214

		/**
		 * Default value for [cell runnable metadata](#NotebookCellMetadata.runnable).
1215
		 * Defaults to true.
R
rebornix 已提交
1216
		 */
1217
		cellRunnable?: boolean;
R
rebornix 已提交
1218

1219
		/**
1220
		 * Default value for [cell hasExecutionOrder metadata](#NotebookCellMetadata.hasExecutionOrder).
1221 1222
		 * Defaults to true.
		 */
1223
		cellHasExecutionOrder?: boolean;
R
rebornix 已提交
1224 1225

		displayOrder?: GlobPattern[];
R
rebornix 已提交
1226 1227

		/**
1228
		 * Additional attributes of the document metadata.
R
rebornix 已提交
1229
		 */
1230
		custom?: { [key: string]: any };
R
Rob Lourens 已提交
1231 1232 1233 1234 1235

		/**
		 * The document's current run state
		 */
		runState?: NotebookRunState;
R
rebornix 已提交
1236 1237 1238 1239 1240 1241

		/**
		 * Whether the document is trusted, default to true
		 * When false, insecure outputs like HTML, JavaScript, SVG will not be rendered.
		 */
		trusted?: boolean;
R
rebornix 已提交
1242 1243
	}

R
rebornix 已提交
1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257
	export interface NotebookDocumentContentOptions {
		/**
		 * Controls if outputs change will trigger notebook document content change and if it will be used in the diff editor
		 * Default to false. If the content provider doesn't persisit the outputs in the file document, this should be set to true.
		 */
		transientOutputs: boolean;

		/**
		 * Controls if a meetadata property change will trigger notebook document content change and if it will be used in the diff editor
		 * Default to false. If the content provider doesn't persisit a metadata property in the file document, it should be set to true.
		 */
		transientMetadata: { [K in keyof NotebookCellMetadata]?: boolean };
	}

R
rebornix 已提交
1258 1259
	export interface NotebookDocument {
		readonly uri: Uri;
1260
		readonly version: number;
R
rebornix 已提交
1261
		readonly fileName: string;
R
rebornix 已提交
1262
		readonly viewType: string;
R
rebornix 已提交
1263
		readonly isDirty: boolean;
R
rebornix 已提交
1264
		readonly isUntitled: boolean;
1265
		readonly cells: ReadonlyArray<NotebookCell>;
R
rebornix 已提交
1266
		readonly contentOptions: NotebookDocumentContentOptions;
R
rebornix 已提交
1267
		languages: string[];
1268
		metadata: NotebookDocumentMetadata;
R
rebornix 已提交
1269 1270
	}

1271
	export interface NotebookConcatTextDocument {
J
Johannes Rieken 已提交
1272
		uri: Uri;
1273 1274
		isClosed: boolean;
		dispose(): void;
1275
		onDidChange: Event<void>;
1276 1277 1278
		version: number;
		getText(): string;
		getText(range: Range): string;
1279

1280 1281
		offsetAt(position: Position): number;
		positionAt(offset: number): Position;
1282 1283 1284
		validateRange(range: Range): Range;
		validatePosition(position: Position): Position;

1285 1286
		locationAt(positionOrRange: Position | Range): Location;
		positionAt(location: Location): Position;
1287
		contains(uri: Uri): boolean
R
rebornix 已提交
1288 1289
	}

1290
	export interface WorkspaceEdit {
1291
		replaceNotebookMetadata(uri: Uri, value: NotebookDocumentMetadata): void;
1292
		replaceNotebookCells(uri: Uri, start: number, end: number, cells: NotebookCellData[], metadata?: WorkspaceEditEntryMetadata): void;
1293
		replaceNotebookCellOutput(uri: Uri, index: number, outputs: (NotebookCellOutput | CellOutput)[], metadata?: WorkspaceEditEntryMetadata): void;
1294
		replaceNotebookCellMetadata(uri: Uri, index: number, cellMetadata: NotebookCellMetadata, metadata?: WorkspaceEditEntryMetadata): void;
1295 1296
	}

1297
	export interface NotebookEditorEdit {
1298
		replaceMetadata(value: NotebookDocumentMetadata): void;
1299
		replaceCells(start: number, end: number, cells: NotebookCellData[]): void;
J
renames  
Johannes Rieken 已提交
1300
		replaceCellOutput(index: number, outputs: (NotebookCellOutput | CellOutput)[]): void;
1301
		replaceCellMetadata(index: number, metadata: NotebookCellMetadata): void;
R
rebornix 已提交
1302 1303
	}

1304 1305
	export interface NotebookCellRange {
		readonly start: number;
R
rebornix 已提交
1306 1307 1308
		/**
		 * exclusive
		 */
1309 1310 1311
		readonly end: number;
	}

R
rebornix 已提交
1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327
	export enum NotebookEditorRevealType {
		/**
		 * The range will be revealed with as little scrolling as possible.
		 */
		Default = 0,
		/**
		 * The range will always be revealed in the center of the viewport.
		 */
		InCenter = 1,
		/**
		 * If the range is outside the viewport, it will be revealed in the center of the viewport.
		 * Otherwise, it will be revealed with as little scrolling as possible.
		 */
		InCenterIfOutsideViewport = 2,
	}

R
rebornix 已提交
1328
	export interface NotebookEditor {
R
rebornix 已提交
1329 1330 1331
		/**
		 * The document associated with this notebook editor.
		 */
R
rebornix 已提交
1332
		readonly document: NotebookDocument;
R
rebornix 已提交
1333 1334 1335 1336 1337

		/**
		 * The primary selected cell on this notebook editor.
		 */
		readonly selection?: NotebookCell;
1338

1339 1340 1341 1342 1343 1344

		/**
		 * The current visible ranges in the editor (vertically).
		 */
		readonly visibleRanges: NotebookCellRange[];

R
rebornix 已提交
1345 1346 1347
		/**
		 * The column in which this editor shows.
		 */
J
Johannes Rieken 已提交
1348
		readonly viewColumn?: ViewColumn;
1349

R
rebornix 已提交
1350 1351 1352 1353 1354
		/**
		 * Fired when the panel is disposed.
		 */
		readonly onDidDispose: Event<void>;

1355 1356 1357 1358 1359
		/**
		 * Active kernel used in the editor
		 */
		readonly kernel?: NotebookKernel;

1360 1361 1362 1363 1364 1365 1366 1367 1368
		/**
		 * 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.
		 *
T
Toan Nguyen 已提交
1369
		 * @param message Body of the message. This must be a string or other json serializable object.
1370 1371 1372
		 */
		postMessage(message: any): Thenable<boolean>;

R
rebornix 已提交
1373 1374 1375 1376 1377
		/**
		 * Convert a uri for the local file system to one that can be used inside outputs webview.
		 */
		asWebviewUri(localResource: Uri): Uri;

1378 1379 1380 1381 1382 1383 1384 1385 1386 1387
		/**
		 * Perform an edit on the notebook associated with this notebook editor.
		 *
		 * The given callback-function is invoked with an [edit-builder](#NotebookEditorEdit) which must
		 * be used to make edits. Note that the edit-builder is only valid while the
		 * callback executes.
		 *
		 * @param callback A function which can create edits using an [edit-builder](#NotebookEditorEdit).
		 * @return A promise that resolves with a value indicating if the edits could be applied.
		 */
1388
		edit(callback: (editBuilder: NotebookEditorEdit) => void): Thenable<boolean>;
R
rebornix 已提交
1389

R
rebornix 已提交
1390 1391
		setDecorations(decorationType: NotebookEditorDecorationType, range: NotebookCellRange): void;

R
rebornix 已提交
1392
		revealRange(range: NotebookCellRange, revealType?: NotebookEditorRevealType): void;
R
rebornix 已提交
1393 1394
	}

R
rebornix 已提交
1395
	export interface NotebookOutputSelector {
R
rebornix 已提交
1396
		mimeTypes?: string[];
R
rebornix 已提交
1397 1398
	}

1399 1400 1401 1402
	export interface NotebookRenderRequest {
		output: CellDisplayOutput;
		mimeType: string;
		outputId: string;
R
rebornix 已提交
1403 1404
	}

1405 1406 1407 1408
	export interface NotebookDocumentMetadataChangeEvent {
		readonly document: NotebookDocument;
	}

1409
	export interface NotebookCellsChangeData {
R
rebornix 已提交
1410 1411
		readonly start: number;
		readonly deletedCount: number;
1412
		readonly deletedItems: NotebookCell[];
R
rebornix 已提交
1413
		readonly items: NotebookCell[];
R
rebornix 已提交
1414 1415
	}

R
rebornix 已提交
1416
	export interface NotebookCellsChangeEvent {
R
rebornix 已提交
1417 1418 1419 1420 1421

		/**
		 * The affected document.
		 */
		readonly document: NotebookDocument;
1422
		readonly changes: ReadonlyArray<NotebookCellsChangeData>;
R
rebornix 已提交
1423 1424
	}

R
rebornix 已提交
1425
	export interface NotebookCellMoveEvent {
R
rebornix 已提交
1426 1427

		/**
R
rebornix 已提交
1428
		 * The affected document.
R
rebornix 已提交
1429
		 */
R
rebornix 已提交
1430
		readonly document: NotebookDocument;
R
rebornix 已提交
1431
		readonly index: number;
R
rebornix 已提交
1432
		readonly newIndex: number;
R
rebornix 已提交
1433 1434
	}

1435
	export interface NotebookCellOutputsChangeEvent {
R
rebornix 已提交
1436 1437 1438 1439 1440

		/**
		 * The affected document.
		 */
		readonly document: NotebookDocument;
1441
		readonly cells: NotebookCell[];
R
rebornix 已提交
1442 1443 1444
	}

	export interface NotebookCellLanguageChangeEvent {
R
rebornix 已提交
1445 1446

		/**
R
rebornix 已提交
1447
		 * The affected document.
R
rebornix 已提交
1448
		 */
R
rebornix 已提交
1449 1450 1451
		readonly document: NotebookDocument;
		readonly cell: NotebookCell;
		readonly language: string;
R
rebornix 已提交
1452 1453
	}

1454 1455 1456
	export interface NotebookCellMetadataChangeEvent {
		readonly document: NotebookDocument;
		readonly cell: NotebookCell;
R
rebornix 已提交
1457 1458
	}

1459 1460 1461 1462 1463
	export interface NotebookEditorSelectionChangeEvent {
		readonly notebookEditor: NotebookEditor;
		readonly selection?: NotebookCell;
	}

1464 1465 1466 1467 1468
	export interface NotebookEditorVisibleRangesChangeEvent {
		readonly notebookEditor: NotebookEditor;
		readonly visibleRanges: ReadonlyArray<NotebookCellRange>;
	}

R
rebornix 已提交
1469 1470 1471
	export interface NotebookCellData {
		readonly cellKind: CellKind;
		readonly source: string;
1472 1473 1474
		readonly language: string;
		readonly outputs: CellOutput[];
		readonly metadata: NotebookCellMetadata | undefined;
R
rebornix 已提交
1475 1476 1477 1478 1479 1480 1481 1482
	}

	export interface NotebookData {
		readonly cells: NotebookCellData[];
		readonly languages: string[];
		readonly metadata: NotebookDocumentMetadata;
	}

1483 1484 1485 1486 1487 1488 1489 1490
	interface NotebookDocumentContentChangeEvent {

		/**
		 * The document that the edit is for.
		 */
		readonly document: NotebookDocument;
	}

R
rebornix 已提交
1491 1492 1493 1494 1495 1496
	interface NotebookDocumentEditEvent {

		/**
		 * The document that the edit is for.
		 */
		readonly document: NotebookDocument;
1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521

		/**
		 * Undo the edit operation.
		 *
		 * This is invoked by VS Code when the user undoes this edit. To implement `undo`, your
		 * extension should restore the document and editor to the state they were in just before this
		 * edit was added to VS Code's internal edit stack by `onDidChangeCustomDocument`.
		 */
		undo(): Thenable<void> | void;

		/**
		 * Redo the edit operation.
		 *
		 * This is invoked by VS Code when the user redoes this edit. To implement `redo`, your
		 * extension should restore the document and editor to the state they were in just after this
		 * edit was added to VS Code's internal edit stack by `onDidChangeCustomDocument`.
		 */
		redo(): Thenable<void> | void;

		/**
		 * Display name describing the edit.
		 *
		 * This will be shown to users in the UI for undo/redo operations.
		 */
		readonly label?: string;
R
rebornix 已提交
1522 1523
	}

1524 1525 1526 1527
	interface NotebookDocumentBackup {
		/**
		 * Unique identifier for the backup.
		 *
R
Rob Lourens 已提交
1528
		 * This id is passed back to your extension in `openNotebook` when opening a notebook editor from a backup.
1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548
		 */
		readonly id: string;

		/**
		 * Delete the current backup.
		 *
		 * This is called by VS Code when it is clear the current backup is no longer needed, such as when a new backup
		 * is made or when the file is saved.
		 */
		delete(): void;
	}

	interface NotebookDocumentBackupContext {
		readonly destination: Uri;
	}

	interface NotebookDocumentOpenContext {
		readonly backupId?: string;
	}

1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570
	/**
	 * Communication object passed to the {@link NotebookContentProvider} and
	 * {@link NotebookOutputRenderer} to communicate with the webview.
	 */
	export interface NotebookCommunication {
		/**
		 * ID of the editor this object communicates with. A single notebook
		 * document can have multiple attached webviews and editors, when the
		 * notebook is split for instance. The editor ID lets you differentiate
		 * between them.
		 */
		readonly editorId: string;

		/**
		 * 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.
		 *
T
Toan Nguyen 已提交
1571
		 * @param message Body of the message. This must be a string or other json serializable object.
1572 1573 1574 1575 1576 1577 1578
		 */
		postMessage(message: any): Thenable<boolean>;

		/**
		 * Convert a uri for the local file system to one that can be used inside outputs webview.
		 */
		asWebviewUri(localResource: Uri): Uri;
R
rebornix 已提交
1579 1580
	}

R
rebornix 已提交
1581
	export interface NotebookContentProvider {
1582 1583 1584 1585
		readonly options?: NotebookDocumentContentOptions;
		readonly onDidChangeNotebookContentOptions?: Event<NotebookDocumentContentOptions>;
		readonly onDidChangeNotebook: Event<NotebookDocumentContentChangeEvent | NotebookDocumentEditEvent>;

1586 1587 1588 1589
		/**
		 * Content providers should always use [file system providers](#FileSystemProvider) to
		 * resolve the raw content for `uri` as the resouce is not necessarily a file on disk.
		 */
J
Johannes Rieken 已提交
1590
		// eslint-disable-next-line vscode-dts-provider-naming
1591
		openNotebook(uri: Uri, openContext: NotebookDocumentOpenContext): NotebookData | Promise<NotebookData>;
J
Johannes Rieken 已提交
1592
		// eslint-disable-next-line vscode-dts-provider-naming
1593
		// eslint-disable-next-line vscode-dts-cancellation
1594
		resolveNotebook(document: NotebookDocument, webview: NotebookCommunication): Promise<void>;
J
Johannes Rieken 已提交
1595
		// eslint-disable-next-line vscode-dts-provider-naming
R
rebornix 已提交
1596
		saveNotebook(document: NotebookDocument, cancellation: CancellationToken): Promise<void>;
J
Johannes Rieken 已提交
1597
		// eslint-disable-next-line vscode-dts-provider-naming
R
rebornix 已提交
1598
		saveNotebookAs(targetResource: Uri, document: NotebookDocument, cancellation: CancellationToken): Promise<void>;
J
Johannes Rieken 已提交
1599
		// eslint-disable-next-line vscode-dts-provider-naming
R
rebornix 已提交
1600
		backupNotebook(document: NotebookDocument, context: NotebookDocumentBackupContext, cancellation: CancellationToken): Promise<NotebookDocumentBackup>;
R
rebornix 已提交
1601 1602
	}

R
rebornix 已提交
1603
	export interface NotebookKernel {
R
rebornix 已提交
1604
		readonly id?: string;
R
rebornix 已提交
1605
		label: string;
R
rebornix 已提交
1606
		description?: string;
R
rebornix 已提交
1607
		detail?: string;
R
rebornix 已提交
1608
		isPreferred?: boolean;
R
rebornix 已提交
1609
		preloads?: Uri[];
R
Rob Lourens 已提交
1610 1611 1612 1613
		executeCell(document: NotebookDocument, cell: NotebookCell): void;
		cancelCellExecution(document: NotebookDocument, cell: NotebookCell): void;
		executeAllCells(document: NotebookDocument): void;
		cancelAllCellsExecution(document: NotebookDocument): void;
R
rebornix 已提交
1614 1615
	}

R
rebornix 已提交
1616 1617
	export type NotebookFilenamePattern = GlobPattern | { include: GlobPattern; exclude: GlobPattern };

R
rebornix 已提交
1618
	export interface NotebookDocumentFilter {
R
rebornix 已提交
1619
		viewType?: string | string[];
R
rebornix 已提交
1620
		filenamePattern?: NotebookFilenamePattern;
R
rebornix 已提交
1621 1622 1623
	}

	export interface NotebookKernelProvider<T extends NotebookKernel = NotebookKernel> {
R
rebornix 已提交
1624
		onDidChangeKernels?: Event<NotebookDocument | undefined>;
R
rebornix 已提交
1625 1626
		provideKernels(document: NotebookDocument, token: CancellationToken): ProviderResult<T[]>;
		resolveKernel?(kernel: T, document: NotebookDocument, webview: NotebookCommunication, token: CancellationToken): ProviderResult<void>;
R
rebornix 已提交
1627 1628
	}

1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657
	/**
	 * Represents the alignment of status bar items.
	 */
	export enum NotebookCellStatusBarAlignment {

		/**
		 * Aligned to the left side.
		 */
		Left = 1,

		/**
		 * Aligned to the right side.
		 */
		Right = 2
	}

	export interface NotebookCellStatusBarItem {
		readonly cell: NotebookCell;
		readonly alignment: NotebookCellStatusBarAlignment;
		readonly priority?: number;
		text: string;
		tooltip: string | undefined;
		command: string | Command | undefined;
		accessibilityInformation?: AccessibilityInformation;
		show(): void;
		hide(): void;
		dispose(): void;
	}

R
rebornix 已提交
1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668
	export interface NotebookDecorationRenderOptions {
		backgroundColor?: string | ThemeColor;
		borderColor?: string | ThemeColor;
		top: ThemableDecorationAttachmentRenderOptions;
	}

	export interface NotebookEditorDecorationType {
		readonly key: string;
		dispose(): void;
	}

R
rebornix 已提交
1669 1670 1671 1672 1673 1674 1675
	export interface NotebookDocumentShowOptions {
		viewColumn?: ViewColumn;
		preserveFocus?: boolean;
		preview?: boolean;
		selection?: NotebookCellRange;
	}

R
rebornix 已提交
1676

R
rebornix 已提交
1677
	export namespace notebook {
R
rebornix 已提交
1678
		export function registerNotebookContentProvider(
R
rebornix 已提交
1679
			notebookType: string,
1680
			provider: NotebookContentProvider,
R
rebornix 已提交
1681
			options?: NotebookDocumentContentOptions & {
1682 1683 1684
				/**
				 * Not ready for production or development use yet.
				 */
R
rebornix 已提交
1685 1686 1687 1688 1689
				viewOptions?: {
					displayName: string;
					filenamePattern: NotebookFilenamePattern[];
					exclusive?: boolean;
				};
1690
			}
R
rebornix 已提交
1691 1692
		): Disposable;

R
rebornix 已提交
1693 1694 1695 1696 1697
		export function registerNotebookKernelProvider(
			selector: NotebookDocumentFilter,
			provider: NotebookKernelProvider
		): Disposable;

R
rebornix 已提交
1698
		export function createNotebookEditorDecorationType(options: NotebookDecorationRenderOptions): NotebookEditorDecorationType;
R
rebornix 已提交
1699
		export function openNotebookDocument(uri: Uri, viewType?: string): Promise<NotebookDocument>;
R
rebornix 已提交
1700
		export const onDidOpenNotebookDocument: Event<NotebookDocument>;
R
rebornix 已提交
1701
		export const onDidCloseNotebookDocument: Event<NotebookDocument>;
R
rebornix 已提交
1702
		export const onDidSaveNotebookDocument: Event<NotebookDocument>;
R
rebornix 已提交
1703

1704 1705 1706 1707
		/**
		 * All currently known notebook documents.
		 */
		export const notebookDocuments: ReadonlyArray<NotebookDocument>;
1708
		export const onDidChangeNotebookDocumentMetadata: Event<NotebookDocumentMetadataChangeEvent>;
R
rebornix 已提交
1709
		export const onDidChangeNotebookCells: Event<NotebookCellsChangeEvent>;
1710
		export const onDidChangeCellOutputs: Event<NotebookCellOutputsChangeEvent>;
R
rebornix 已提交
1711
		export const onDidChangeCellLanguage: Event<NotebookCellLanguageChangeEvent>;
1712
		export const onDidChangeCellMetadata: Event<NotebookCellMetadataChangeEvent>;
1713
		/**
J
Johannes Rieken 已提交
1714 1715
		 * Create a document that is the concatenation of all  notebook cells. By default all code-cells are included
		 * but a selector can be provided to narrow to down the set of cells.
1716 1717 1718 1719 1720
		 *
		 * @param notebook
		 * @param selector
		 */
		export function createConcatTextDocument(notebook: NotebookDocument, selector?: DocumentSelector): NotebookConcatTextDocument;
M
Martin Aeschlimann 已提交
1721

R
rebornix 已提交
1722
		export const onDidChangeActiveNotebookKernel: Event<{ document: NotebookDocument, kernel: NotebookKernel | undefined }>;
1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733

		/**
		 * Creates a notebook cell status bar [item](#NotebookCellStatusBarItem).
		 * It will be disposed automatically when the notebook document is closed or the cell is deleted.
		 *
		 * @param cell The cell on which this item should be shown.
		 * @param alignment The alignment of the item.
		 * @param priority The priority of the item. Higher values mean the item should be shown more to the left.
		 * @return A new status bar item.
		 */
		export function createCellStatusBarItem(cell: NotebookCell, alignment?: NotebookCellStatusBarAlignment, priority?: number): NotebookCellStatusBarItem;
M
Martin Aeschlimann 已提交
1734 1735
	}

1736 1737 1738 1739 1740 1741 1742
	export namespace window {
		export const visibleNotebookEditors: NotebookEditor[];
		export const onDidChangeVisibleNotebookEditors: Event<NotebookEditor[]>;
		export const activeNotebookEditor: NotebookEditor | undefined;
		export const onDidChangeActiveNotebookEditor: Event<NotebookEditor | undefined>;
		export const onDidChangeNotebookEditorSelection: Event<NotebookEditorSelectionChangeEvent>;
		export const onDidChangeNotebookEditorVisibleRanges: Event<NotebookEditorVisibleRangesChangeEvent>;
R
rebornix 已提交
1743
		export function showNotebookDocument(document: NotebookDocument, options?: NotebookDocumentShowOptions): Promise<NotebookEditor>;
1744 1745
	}

1746 1747 1748 1749
	//#endregion

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

P
label2  
Pine Wu 已提交
1750 1751 1752 1753
	export interface CompletionItem {
		/**
		 * Will be merged into CompletionItem#label
		 */
P
Pine Wu 已提交
1754
		label2?: CompletionItemLabel;
P
label2  
Pine Wu 已提交
1755 1756
	}

1757 1758
	export interface CompletionItemLabel {
		/**
P
Pine Wu 已提交
1759
		 * The function or variable. Rendered leftmost.
1760
		 */
P
Pine Wu 已提交
1761
		name: string;
1762

P
Pine Wu 已提交
1763
		/**
1764
		 * The parameters without the return type. Render after `name`.
P
Pine Wu 已提交
1765
		 */
1766
		parameters?: string;
P
Pine Wu 已提交
1767 1768

		/**
P
Pine Wu 已提交
1769
		 * The fully qualified name, like package name or file path. Rendered after `signature`.
P
Pine Wu 已提交
1770 1771
		 */
		qualifier?: string;
1772

P
Pine Wu 已提交
1773
		/**
P
Pine Wu 已提交
1774
		 * The return-type of a function or type of a property/variable. Rendered rightmost.
P
Pine Wu 已提交
1775
		 */
P
Pine Wu 已提交
1776
		type?: string;
1777 1778 1779 1780
	}

	//#endregion

1781
	//#region @eamodio - timeline: https://github.com/microsoft/vscode/issues/84297
1782 1783 1784

	export class TimelineItem {
		/**
1785
		 * A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred.
1786
		 */
E
Eric Amodio 已提交
1787
		timestamp: number;
1788 1789

		/**
1790
		 * A human-readable string describing the timeline item.
1791 1792 1793 1794
		 */
		label: string;

		/**
1795
		 * Optional id for the timeline item. It must be unique across all the timeline items provided by this source.
1796
		 *
1797
		 * If not provided, an id is generated using the timeline item's timestamp.
1798 1799 1800 1801
		 */
		id?: string;

		/**
1802
		 * The icon path or [ThemeIcon](#ThemeIcon) for the timeline item.
1803
		 */
R
rebornix 已提交
1804
		iconPath?: Uri | { light: Uri; dark: Uri; } | ThemeIcon;
1805 1806

		/**
1807
		 * A human readable string describing less prominent details of the timeline item.
1808 1809 1810 1811 1812 1813
		 */
		description?: string;

		/**
		 * The tooltip text when you hover over the timeline item.
		 */
1814
		detail?: string;
1815 1816 1817 1818 1819 1820 1821

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

		/**
1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837
		 * 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`.
1838 1839 1840
		 */
		contextValue?: string;

1841 1842 1843 1844 1845
		/**
		 * Accessibility information used when screen reader interacts with this timeline item.
		 */
		accessibilityInformation?: AccessibilityInformation;

1846 1847
		/**
		 * @param label A human-readable string describing the timeline item
E
Eric Amodio 已提交
1848
		 * @param timestamp A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred
1849
		 */
E
Eric Amodio 已提交
1850
		constructor(label: string, timestamp: number);
1851 1852
	}

1853
	export interface TimelineChangeEvent {
E
Eric Amodio 已提交
1854
		/**
1855
		 * The [uri](#Uri) of the resource for which the timeline changed.
E
Eric Amodio 已提交
1856
		 */
E
Eric Amodio 已提交
1857
		uri: Uri;
1858

E
Eric Amodio 已提交
1859
		/**
1860
		 * A flag which indicates whether the entire timeline should be reset.
E
Eric Amodio 已提交
1861
		 */
1862 1863
		reset?: boolean;
	}
E
Eric Amodio 已提交
1864

1865 1866 1867
	export interface Timeline {
		readonly paging?: {
			/**
E
Eric Amodio 已提交
1868
			 * A provider-defined cursor specifying the starting point of timeline items which are after the ones returned.
E
Eric Amodio 已提交
1869
			 * Use `undefined` to signal that there are no more items to be returned.
1870
			 */
E
Eric Amodio 已提交
1871
			readonly cursor: string | undefined;
R
rebornix 已提交
1872
		};
E
Eric Amodio 已提交
1873 1874

		/**
1875
		 * An array of [timeline items](#TimelineItem).
E
Eric Amodio 已提交
1876
		 */
1877
		readonly items: readonly TimelineItem[];
E
Eric Amodio 已提交
1878 1879
	}

1880
	export interface TimelineOptions {
E
Eric Amodio 已提交
1881
		/**
E
Eric Amodio 已提交
1882
		 * A provider-defined cursor specifying the starting point of the timeline items that should be returned.
E
Eric Amodio 已提交
1883
		 */
1884
		cursor?: string;
E
Eric Amodio 已提交
1885 1886

		/**
1887 1888
		 * 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 已提交
1889
		 */
R
rebornix 已提交
1890
		limit?: number | { timestamp: number; id?: string; };
E
Eric Amodio 已提交
1891 1892
	}

1893
	export interface TimelineProvider {
1894
		/**
1895 1896
		 * 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`.
1897
		 */
E
Eric Amodio 已提交
1898
		onDidChange?: Event<TimelineChangeEvent | undefined>;
1899 1900

		/**
1901
		 * An identifier of the source of the timeline items. This can be used to filter sources.
1902
		 */
1903
		readonly id: string;
1904

E
Eric Amodio 已提交
1905
		/**
1906
		 * 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 已提交
1907
		 */
1908
		readonly label: string;
1909 1910

		/**
E
Eric Amodio 已提交
1911
		 * Provide [timeline items](#TimelineItem) for a [Uri](#Uri).
1912
		 *
1913
		 * @param uri The [uri](#Uri) of the file to provide the timeline for.
1914
		 * @param options A set of options to determine how results should be returned.
1915
		 * @param token A cancellation token.
E
Eric Amodio 已提交
1916
		 * @return The [timeline result](#TimelineResult) or a thenable that resolves to such. The lack of a result
1917 1918
		 * can be signaled by returning `undefined`, `null`, or an empty array.
		 */
1919
		provideTimeline(uri: Uri, options: TimelineOptions, token: CancellationToken): ProviderResult<Timeline>;
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929
	}

	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.
		 *
1930
		 * @param scheme A scheme or schemes that defines which documents this provider is applicable to. Can be `*` to target all documents.
1931 1932
		 * @param provider A timeline provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
E
Eric Amodio 已提交
1933
		*/
1934
		export function registerTimelineProvider(scheme: string | string[], provider: TimelineProvider): Disposable;
1935 1936 1937
	}

	//#endregion
1938

1939
	//#region https://github.com/microsoft/vscode/issues/91555
1940

1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954
	export enum StandardTokenType {
		Other = 0,
		Comment = 1,
		String = 2,
		RegEx = 4
	}

	export interface TokenInformation {
		type: StandardTokenType;
		range: Range;
	}

	export namespace languages {
		export function getTokenInformationAtPosition(document: TextDocument, position: Position): Promise<TokenInformation>;
K
kingwl 已提交
1955 1956 1957 1958 1959 1960 1961
	}

	//#endregion

	//@region https://github.com/microsoft/vscode/issues/16221

	export namespace languages {
K
kingwl 已提交
1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973
		/**
		 * Register a inline hints provider.
		 *
		 * 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 inline hints provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
		export function registerInlineHintsProvider(selector: DocumentSelector, provider: InlineHintsProvider): Disposable;
1974 1975
	}

K
kingwl 已提交
1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035
	export interface ThemableDecorationAttachmentRenderOptions {
		/**
		 * CSS styling property that will be applied to the decoration attachment.
		 */
		fontSize?: string;
		/**
		 * CSS styling property that will be applied to the decoration attachment.
		 */
		fontFamily?: string;
		/**
		 * CSS styling property that will be applied to the decoration attachment.
		 */
		padding?: string;
	}

	/**
	 * Inline hint information.
	 */
	export class InlineHint {
		/**
		 * The text of the hint.
		 */
		text: string;
		/**
		 * The position of the hint.
		 */
		range: Range;
		/**
		 * Whitespace before the hint.
		 */
		whitespaceBefore?: boolean;
		/**
		 * Whitespace after the hint.
		 */
		whitespaceAfter?: boolean;

		/**
		 * Creates a new inline hint information object.
		 *
		 * @param text The text of the hint.
		 * @param range The range of the hint.
		 * @param whitespaceBefore Whitespace before the hint.
		 * @param whitespaceAfter TWhitespace after the hint.
		 */
		constructor(text: string, range: Range, whitespaceBefore?: boolean, whitespaceAfter?: boolean);
	}

	/**
	 * The document formatting provider interface defines the contract between extensions and
	 * the inline hints feature.
	 */
	export interface InlineHintsProvider {
		/**
		 * @param model The document in which the command was invoked.
		 * @param token A cancellation token.
		 *
		 * @return A list of arguments labels or a thenable that resolves to such.
		 */
		provideInlineHints(model: TextDocument, range: Range, token: CancellationToken): ProviderResult<InlineHint[]>;
	}
2036
	//#endregion
2037

2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055
	//#region https://github.com/microsoft/vscode/issues/104436

	export enum ExtensionRuntime {
		/**
		 * The extension is running in a NodeJS extension host. Runtime access to NodeJS APIs is available.
		 */
		Node = 1,
		/**
		 * The extension is running in a Webworker extension host. Runtime access is limited to Webworker APIs.
		 */
		Webworker = 2
	}

	export interface ExtensionContext {
		readonly extensionRuntime: ExtensionRuntime;
	}

	//#endregion
2056 2057 2058 2059 2060


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

	export interface TextDocument {
2061 2062 2063 2064 2065

		/**
		 * The [notebook](#NotebookDocument) that contains this document as a notebook cell or `undefined` when
		 * the document is not contained by a notebook (this should be the more frequent case).
		 */
2066 2067 2068
		notebook: NotebookDocument | undefined;
	}
	//#endregion
C
Connor Peet 已提交
2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089

	//#region https://github.com/microsoft/vscode/issues/107467
	/*
		General activation events:
			- `onLanguage:*` most test extensions will want to activate when their
				language is opened to provide code lenses.
			- `onTests:*` new activation event very simiular to `workspaceContains`,
				but only fired when the user wants to run tests or opens the test explorer.
	*/
	export namespace test {
		/**
		 * Registers a provider that discovers tests for the given document
		 * selectors. It is activated when either tests need to be enumerated, or
		 * a document matching the selector is opened.
		 */
		export function registerTestProvider<T extends TestItem>(testProvider: TestProvider<T>): Disposable;

		/**
		 * Runs tests with the given options. If no options are given, then
		 * all tests are run. Returns the resulting test run.
		 */
2090
		export function runTests<T extends TestItem>(options: TestRunOptions<T>, cancellationToken?: CancellationToken): Thenable<void>;
C
Connor Peet 已提交
2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113

		/**
		 * Returns an observer that retrieves tests in the given workspace folder.
		 */
		export function createWorkspaceTestObserver(workspaceFolder: WorkspaceFolder): TestObserver;

		/**
		 * Returns an observer that retrieves tests in the given text document.
		 */
		export function createDocumentTestObserver(document: TextDocument): TestObserver;
	}

	export interface TestObserver {
		/**
		 * List of tests returned by test provider for files in the workspace.
		 */
		readonly tests: ReadonlyArray<TestItem>;

		/**
		 * An event that fires when an existing test in the collection changes, or
		 * null if a top-level test was added or removed. When fired, the consumer
		 * should check the test item and all its children for changes.
		 */
C
Connor Peet 已提交
2114
		readonly onDidChangeTest: Event<TestChangeEvent>;
C
Connor Peet 已提交
2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132

		/**
		 * An event the fires when all test providers have signalled that the tests
		 * the observer references have been discovered. Providers may continue to
		 * watch for changes and cause {@link onDidChangeTest} to fire as files
		 * change, until the observer is disposed.
		 *
		 * @todo as below
		 */
		readonly onDidDiscoverInitialTests: Event<void>;

		/**
		 * Dispose of the observer, allowing VS Code to eventually tell test
		 * providers that they no longer need to update tests.
		 */
		dispose(): void;
	}

C
Connor Peet 已提交
2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155
	export interface TestChangeEvent {
		/**
		 * List of all tests that are newly added.
		 */
		readonly added: ReadonlyArray<TestItem>;

		/**
		 * List of existing tests that have updated.
		 */
		readonly updated: ReadonlyArray<TestItem>;

		/**
		 * List of existing tests that have been removed.
		 */
		readonly removed: ReadonlyArray<TestItem>;

		/**
		 * Highest node in the test tree under which changes were made. This can
		 * be easily plugged into events like the TreeDataProvider update event.
		 */
		readonly commonChangeAncestor: TestItem | null;
	}

C
Connor Peet 已提交
2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179
	/**
	 * Tree of tests returned from the provide methods in the {@link TestProvider}.
	 */
	export interface TestHierarchy<T extends TestItem> {
		/**
		 * Root node for tests. The `testRoot` instance must not be replaced over
		 * the lifespan of the TestHierarchy, since you will need to reference it
		 * in `onDidChangeTest` when a test is added or removed.
		 */
		readonly root: T;

		/**
		 * An event that fires when an existing test under the `root` changes.
		 * This can be a result of a state change in a test run, a property update,
		 * or an update to its children. Changes made to tests will not be visible
		 * to {@link TestObserver} instances until this event is fired.
		 *
		 * This will signal a change recursively to all children of the given node.
		 * For example, firing the event with the {@link testRoot} will refresh
		 * all tests.
		 */
		readonly onDidChangeTest: Event<T>;

		/**
C
Connor Peet 已提交
2180 2181 2182
		 * Promise that should be resolved when all tests that are initially
		 * defined have been discovered. The provider should continue to watch for
		 * changes and fire `onDidChangeTest` until the hierarchy is disposed.
C
Connor Peet 已提交
2183
		 */
C
Connor Peet 已提交
2184
		readonly discoveredInitialTests?: Thenable<unknown>;
C
Connor Peet 已提交
2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212

		/**
		 * Dispose will be called when there are no longer observers interested
		 * in the hierarchy.
		 */
		dispose(): void;
	}

	/**
	 * Discovers and provides tests. It's expected that the TestProvider will
	 * ambiently listen to {@link vscode.window.onDidChangeVisibleTextEditors} to
	 * provide test information about the open files for use in code lenses and
	 * other file-specific UI.
	 *
	 * Additionally, the UI may request it to discover tests for the workspace
	 * via `addWorkspaceTests`.
	 *
	 * @todo rename from provider
	 */
	export interface TestProvider<T extends TestItem = TestItem> {
		/**
		 * Requests that tests be provided for the given workspace. This will
		 * generally be called when tests need to be enumerated for the
		 * workspace.
		 *
		 * It's guaranteed that this method will not be called again while
		 * there is a previous undisposed watcher for the given workspace folder.
		 */
J
Johannes Rieken 已提交
2213
		// eslint-disable-next-line vscode-dts-provider-naming
C
Connor Peet 已提交
2214
		createWorkspaceTestHierarchy?(workspace: WorkspaceFolder): TestHierarchy<T> | undefined;
C
Connor Peet 已提交
2215 2216 2217 2218 2219 2220

		/**
		 * Requests that tests be provided for the given document. This will
		 * be called when tests need to be enumerated for a single open file,
		 * for instance by code lens UI.
		 */
J
Johannes Rieken 已提交
2221
		// eslint-disable-next-line vscode-dts-provider-naming
C
Connor Peet 已提交
2222
		createDocumentTestHierarchy?(document: TextDocument): TestHierarchy<T> | undefined;
C
Connor Peet 已提交
2223 2224 2225 2226 2227 2228

		/**
		 * Starts a test run. This should cause {@link onDidChangeTest} to
		 * fire with update test states during the run.
		 * @todo this will eventually need to be able to return a summary report, coverage for example.
		 */
J
Johannes Rieken 已提交
2229
		// eslint-disable-next-line vscode-dts-provider-naming
C
Connor Peet 已提交
2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273
		runTests?(options: TestRunOptions<T>, cancellationToken: CancellationToken): ProviderResult<void>;
	}

	/**
	 * Options given to `TestProvider.runTests`
	 */
	export interface TestRunOptions<T extends TestItem = TestItem> {
		/**
		 * Array of specific tests to run. The {@link TestProvider.testRoot} may
		 * be provided as an indication to run all tests.
		 */
		tests: T[];

		/**
		 * Whether or not tests in this run should be debugged.
		 */
		debug: boolean;
	}

	/**
	 * A test item is an item shown in the "test explorer" view. It encompasses
	 * both a suite and a test, since they have almost or identical capabilities.
	 */
	export interface TestItem {
		/**
		 * Display name describing the test case.
		 */
		label: string;

		/**
		 * Optional description that appears next to the label.
		 */
		description?: string;

		/**
		 * Whether this test item can be run individually, defaults to `true`
		 * if not provided.
		 *
		 * In some cases, like Go's tests, test can have children but these
		 * children cannot be run independently.
		 */
		runnable?: boolean;

		/**
2274
		 * Whether this test item can be debugged. Defaults to `false` if not provided.
C
Connor Peet 已提交
2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297
		 */
		debuggable?: boolean;

		/**
		 * VS Code location.
		 */
		location?: Location;

		/**
		 * Optional list of nested tests for this item.
		 */
		children?: TestItem[];

		/**
		 * Test run state. Will generally be {@link TestRunState.Unset} by
		 * default.
		 */
		state: TestState;
	}

	export enum TestRunState {
		// Initial state
		Unset = 0,
C
Connor Peet 已提交
2298 2299
		// Test will be run, but is not currently running.
		Queued = 1,
C
Connor Peet 已提交
2300
		// Test is currently running
C
Connor Peet 已提交
2301
		Running = 2,
C
Connor Peet 已提交
2302
		// Test run has passed
C
Connor Peet 已提交
2303
		Passed = 3,
C
Connor Peet 已提交
2304
		// Test run has failed (on an assertion)
C
Connor Peet 已提交
2305
		Failed = 4,
C
Connor Peet 已提交
2306
		// Test run has been skipped
C
Connor Peet 已提交
2307
		Skipped = 5,
C
Connor Peet 已提交
2308
		// Test run failed for some other reason (compilation error, timeout, etc)
C
Connor Peet 已提交
2309
		Errored = 6
C
Connor Peet 已提交
2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382
	}

	/**
	 * TestState includes a test and its run state. This is included in the
	 * {@link TestItem} and is immutable; it should be replaced in th TestItem
	 * in order to update it. This allows consumers to quickly and easily check
	 * for changes via object identity.
	 */
	export class TestState {
		/**
		 * Current state of the test.
		 */
		readonly runState: TestRunState;

		/**
		 * Optional duration of the test run, in milliseconds.
		 */
		readonly duration?: number;

		/**
		 * Associated test run message. Can, for example, contain assertion
		 * failure information if the test fails.
		 */
		readonly messages: ReadonlyArray<Readonly<TestMessage>>;

		/**
		 * @param state Run state to hold in the test state
		 * @param messages List of associated messages for the test
		 * @param duration Length of time the test run took, if appropriate.
		 */
		constructor(runState: TestRunState, messages?: TestMessage[], duration?: number);
	}

	/**
	 * Represents the severity of test messages.
	 */
	export enum TestMessageSeverity {
		Error = 0,
		Warning = 1,
		Information = 2,
		Hint = 3
	}

	/**
	 * Message associated with the test state. Can be linked to a specific
	 * source range -- useful for assertion failures, for example.
	 */
	export interface TestMessage {
		/**
		 * Human-readable message text to display.
		 */
		message: string | MarkdownString;

		/**
		 * Message severity. Defaults to "Error", if not provided.
		 */
		severity?: TestMessageSeverity;

		/**
		 * Expected test output. If given with `actual`, a diff view will be shown.
		 */
		expectedOutput?: string;

		/**
		 * Actual test output. If given with `actual`, a diff view will be shown.
		 */
		actualOutput?: string;

		/**
		 * Associated file location.
		 */
		location?: Location;
	}
2383 2384 2385 2386 2387

	/**
	 * Additional metadata about the uri being opened
	 */
	interface OpenExternalUriContext {
2388

2389 2390
	}

C
Connor Peet 已提交
2391
	//#endregion
2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407

	//#region Opener service (https://github.com/microsoft/vscode/issues/109277)

	/**
	 * Handles opening external uris.
	 *
	 * An extension can use this to open a `http` link to a webserver inside of VS Code instead of
	 * having the link be opened by the webbrowser.
	 *
	 * Currently openers may only be registered for `http` and `https` uris.
	 */
	export interface ExternalUriOpener {

		/**
		 * Try to open a given uri.
		 *
2408 2409 2410
		 * @param uri The uri to open. This uri may have been transformed by port forwarding. To access
		 * the original uri that triggered the open, use `ctx.original`.
		 * @param ctx Additional metadata about the triggered open.
2411 2412 2413 2414 2415
		 * @param token Cancellation token.
		 *
		 * @return Optional command that opens the uri. If no command is returned, VS Code will
		 * continue checking to see if any other openers are available.
		 *
2416 2417 2418
		 * This command is given the resolved uri to open. This may be different from the original `uri` due
		 * to port forwarding.
		 *
2419 2420
		 * If multiple openers are available for a given uri, then the `Command.title` is shown in the UI.
		 */
2421
		openExternalUri(uri: Uri, ctx: OpenExternalUriContext, token: CancellationToken): ProviderResult<Command>;
2422 2423 2424 2425 2426 2427
	}

	namespace window {
		/**
		 * Register a new `ExternalUriOpener`.
		 *
M
Matt Bierner 已提交
2428
		 * When a uri is about to be opened, an `onUriOpen:SCHEME` activation event is fired.
2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439
		 *
		 * @param schemes List of uri schemes the opener is triggered for. Currently only `http`
		 * and `https` are supported.
		 * @param opener Opener to register.
		 *
		* @returns Disposable that unregisters the opener.
		 */
		export function registerExternalUriOpener(schemes: readonly string[], opener: ExternalUriOpener,): Disposable;
	}

	//#endregion
K
kingwl 已提交
2440

J
Johannes Rieken 已提交
2441
	/**
R
Rachel Macfarlane 已提交
2442 2443
	 * Represents a storage utility for secrets, information that is
	 * sensitive.
J
Johannes Rieken 已提交
2444
	 */
R
Rachel Macfarlane 已提交
2445
	export interface SecretStorage {
2446 2447 2448 2449
		/**
		 * Retrieve a secret that was stored with key. Returns undefined if there
		 * is no password matching that key.
		 * @param key The key the password was stored under.
R
Rachel Macfarlane 已提交
2450
		 * @returns The stored value or `undefined`.
2451 2452 2453 2454 2455
		 */
		get(key: string): Thenable<string | undefined>;

		/**
		 * Store a secret under a given key.
R
Rachel Macfarlane 已提交
2456 2457
		 * @param key The key to store the password under.
		 * @param value The password.
2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469
		 */
		set(key: string, value: string): Thenable<void>;

		/**
		 * Remove a secret from storage.
		 * @param key The key the password was stored under.
		 */
		delete(key: string): Thenable<void>;

		/**
		 * Fires when a secret is set or deleted.
		 */
2470
		onDidChange: Event<void>;
2471
	}
R
Rachel Macfarlane 已提交
2472

2473
	export interface ExtensionContext {
R
Rachel Macfarlane 已提交
2474
		secrets: SecretStorage;
K
kingwl 已提交
2475
	}
J
Johannes Rieken 已提交
2476
}