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

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

17 18
declare module 'vscode' {

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

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

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

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

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

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

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

66 67 68 69 70
	/**
	 * **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.
	 */
71
	export interface AuthenticationProvider {
72 73
		/**
		 * Used as an identifier for extensions trying to work with a particular
74
		 * provider: 'microsoft', 'github', etc. id must be unique, registering
75 76
		 * another provider with the same id will fail.
		 */
77 78
		readonly id: string;
		readonly displayName: string;
79 80

		/**
81
		 * An [event](#Event) which fires when the array of sessions has changed, or data
82 83
		 * within a session has changed.
		 */
84
		readonly onDidChangeSessions: Event<AuthenticationSessionsChangeEvent>;
85

86 87 88
		/**
		 * Returns an array of current sessions.
		 */
89
		getSessions(): Thenable<ReadonlyArray<AuthenticationSession>>;
90

91 92 93
		/**
		 * Prompts a user to login.
		 */
94
		login(scopes: string[]): Thenable<AuthenticationSession>;
95
		logout(sessionId: string): Thenable<void>;
96 97 98 99
	}

	export namespace authentication {
		export function registerAuthenticationProvider(provider: AuthenticationProvider): Disposable;
100 101 102 103

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

106
		/**
107
		 * An array of the ids of authentication providers that are currently registered.
108
		 */
109
		export const providerIds: string[];
110 111 112 113 114

		/**
		 * Get existing authentication sessions. Rejects if a provider with providerId is not
		 * registered, or if the user does not consent to sharing authentication information with
		 * the extension.
115 116 117
		 * @param providerId The id of the provider to use
		 * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication
		 * provider
118
		 */
119
		export function getSessions(providerId: string, scopes: string[]): Thenable<readonly AuthenticationSession[]>;
120 121 122 123 124

		/**
		* Prompt a user to login to create a new authenticaiton session. Rejects if a provider with
		* providerId is not registered, or if the user does not consent to sharing authentication
		* information with the extension.
125 126 127
		* @param providerId The id of the provider to use
		* @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication
		* provider
128 129 130
		*/
		export function login(providerId: string, scopes: string[]): Thenable<AuthenticationSession>;

131 132 133 134 135 136 137 138
		/**
		* 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>;

139
		/**
140
		* An [event](#Event) which fires when the array of sessions has changed, or data
141 142 143
		* within a session has changed for a provider. Fires with the ids of the providers
		* that have had session data change.
		*/
144
		export const onDidChangeSessions: Event<{ [providerId: string]: AuthenticationSessionsChangeEvent }>;
145 146
	}

J
Johannes Rieken 已提交
147 148
	//#endregion

149
	//#region Alex - resolvers
A
Alex Dima 已提交
150

A
Tweaks  
Alex Dima 已提交
151 152 153 154
	export interface RemoteAuthorityResolverContext {
		resolveAttempt: number;
	}

A
Alex Dima 已提交
155 156 157 158 159 160 161
	export class ResolvedAuthority {
		readonly host: string;
		readonly port: number;

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

162
	export interface ResolvedOptions {
163
		extensionHostEnv?: { [key: string]: string | null };
164 165
	}

166
	export interface TunnelOptions {
A
Alex Ross 已提交
167 168 169 170
		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;
171 172
	}

A
Alex Ross 已提交
173
	export interface TunnelDescription {
A
Alex Ross 已提交
174 175
		remoteAddress: { port: number, host: string };
		//The complete local address(ex. localhost:1234)
176
		localAddress: { port: number, host: string } | string;
A
Alex Ross 已提交
177 178 179
	}

	export interface Tunnel extends TunnelDescription {
A
Alex Ross 已提交
180 181
		// Implementers of Tunnel should fire onDidDispose when dispose is called.
		onDidDispose: Event<void>;
182
		dispose(): void;
183 184 185
	}

	/**
186 187
	 * Used as part of the ResolverResult if the extension has any candidate,
	 * published, or forwarded ports.
188 189 190 191
	 */
	export interface TunnelInformation {
		/**
		 * Tunnels that are detected by the extension. The remotePort is used for display purposes.
A
Alex Ross 已提交
192
		 * The localAddress should be the complete local address (ex. localhost:1234) for connecting to the port. Tunnels provided through
193 194
		 * detected are read-only from the forwarded ports UI.
		 */
A
Alex Ross 已提交
195
		environmentTunnels?: TunnelDescription[];
A
Alex Ross 已提交
196

197 198 199
	}

	export type ResolverResult = ResolvedAuthority & ResolvedOptions & TunnelInformation;
200

A
Tweaks  
Alex Dima 已提交
201 202 203 204 205 206 207
	export class RemoteAuthorityResolverError extends Error {
		static NotAvailable(message?: string, handled?: boolean): RemoteAuthorityResolverError;
		static TemporarilyNotAvailable(message?: string): RemoteAuthorityResolverError;

		constructor(message?: string);
	}

A
Alex Dima 已提交
208
	export interface RemoteAuthorityResolver {
209
		resolve(authority: string, context: RemoteAuthorityResolverContext): ResolverResult | Thenable<ResolverResult>;
210 211 212 213 214
		/**
		 * 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 已提交
215
		tunnelFactory?: (tunnelOptions: TunnelOptions) => Thenable<Tunnel> | undefined;
216 217 218 219 220

		/**
		 * Provides filtering for candidate ports.
		 */
		showCandidatePort?: (host: string, port: number, detail: string) => Thenable<boolean>;
221 222 223 224
	}

	export namespace workspace {
		/**
225
		 * Forwards a port. If the current resolver implements RemoteAuthorityResolver:forwardPort then that will be used to make the tunnel.
A
Alex Ross 已提交
226 227
		 * 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.
228
		 */
A
Alex Ross 已提交
229
		export function openTunnel(tunnelOptions: TunnelOptions): Thenable<Tunnel>;
230 231 232 233 234 235

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

237 238 239 240
		/**
		 * Fired when the list of tunnels has changed.
		 */
		export const onDidChangeTunnels: Event<void>;
A
Alex Dima 已提交
241 242
	}

243 244 245 246 247 248 249 250
	export interface ResourceLabelFormatter {
		scheme: string;
		authority?: string;
		formatting: ResourceLabelFormatting;
	}

	export interface ResourceLabelFormatting {
		label: string; // myLabel:/${path}
J
Johannes Rieken 已提交
251 252
		// TODO@isi
		// eslint-disable-next-line vscode-dts-literal-or-types
253 254 255 256 257 258 259
		separator: '/' | '\\' | '';
		tildify?: boolean;
		normalizeDriveLetter?: boolean;
		workspaceSuffix?: string;
		authorityPrefix?: string;
	}

A
Alex Dima 已提交
260 261
	export namespace workspace {
		export function registerRemoteAuthorityResolver(authorityPrefix: string, resolver: RemoteAuthorityResolver): Disposable;
262
		export function registerResourceLabelFormatter(formatter: ResourceLabelFormatter): Disposable;
263
	}
264

265 266
	//#endregion

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

269 270
	export interface WebviewEditorInset {
		readonly editor: TextEditor;
271 272
		readonly line: number;
		readonly height: number;
273 274 275
		readonly webview: Webview;
		readonly onDidDispose: Event<void>;
		dispose(): void;
276 277
	}

278
	export namespace window {
279
		export function createWebviewTextEditorInset(editor: TextEditor, line: number, height: number, options?: WebviewOptions): WebviewEditorInset;
A
Alex Dima 已提交
280 281 282 283
	}

	//#endregion

J
Johannes Rieken 已提交
284
	//#region read/write in chunks: https://github.com/microsoft/vscode/issues/84515
285 286

	export interface FileSystemProvider {
J
Johannes Rieken 已提交
287
		open?(resource: Uri, options: { create: boolean }): number | Thenable<number>;
288 289 290 291 292 293 294
		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 已提交
295
	//#region TextSearchProvider: https://github.com/microsoft/vscode/issues/59921
296

297 298 299
	/**
	 * The parameters of a query for text search.
	 */
300
	export interface TextSearchQuery {
301 302 303
		/**
		 * The text pattern to search for.
		 */
304
		pattern: string;
305

R
Rob Lourens 已提交
306 307 308 309 310
		/**
		 * Whether or not `pattern` should match multiple lines of text.
		 */
		isMultiline?: boolean;

311 312 313
		/**
		 * Whether or not `pattern` should be interpreted as a regular expression.
		 */
R
Rob Lourens 已提交
314
		isRegExp?: boolean;
315 316 317 318

		/**
		 * Whether or not the search should be case-sensitive.
		 */
R
Rob Lourens 已提交
319
		isCaseSensitive?: boolean;
320 321 322 323

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

327 328 329 330 331 332 333 334 335 336
	/**
	 * 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 已提交
337
	export interface SearchOptions {
338 339 340
		/**
		 * The root folder to search within.
		 */
341
		folder: Uri;
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356

		/**
		 * 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 已提交
357
		useIgnoreFiles: boolean;
358 359 360 361 362

		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
363
		followSymlinks: boolean;
P
pkoushik 已提交
364 365 366 367 368 369

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

R
Rob Lourens 已提交
372 373
	/**
	 * Options to specify the size of the result text preview.
R
Rob Lourens 已提交
374
	 * These options don't affect the size of the match itself, just the amount of preview text.
R
Rob Lourens 已提交
375
	 */
376
	export interface TextSearchPreviewOptions {
377
		/**
R
Rob Lourens 已提交
378
		 * The maximum number of lines in the preview.
R
Rob Lourens 已提交
379
		 * Only search providers that support multiline search will ever return more than one line in the match.
380
		 */
R
Rob Lourens 已提交
381
		matchLines: number;
R
Rob Lourens 已提交
382 383 384 385

		/**
		 * The maximum number of characters included per line.
		 */
R
Rob Lourens 已提交
386
		charsPerLine: number;
387 388
	}

389 390 391
	/**
	 * Options that apply to text search.
	 */
R
Rob Lourens 已提交
392
	export interface TextSearchOptions extends SearchOptions {
393
		/**
394
		 * The maximum number of results to be returned.
395
		 */
396 397
		maxResults: number;

R
Rob Lourens 已提交
398 399 400
		/**
		 * Options to specify the size of the result text preview.
		 */
401
		previewOptions?: TextSearchPreviewOptions;
402 403 404 405

		/**
		 * Exclude files larger than `maxFileSize` in bytes.
		 */
406
		maxFileSize?: number;
407 408 409 410 411

		/**
		 * Interpret files using this encoding.
		 * See the vscode setting `"files.encoding"`
		 */
412
		encoding?: string;
413 414 415 416 417 418 419 420 421 422

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

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

425 426 427 428 429 430 431 432 433 434 435 436 437 438
	/**
	 * 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 已提交
439 440 441
	/**
	 * A preview of the text result.
	 */
442
	export interface TextSearchMatchPreview {
443
		/**
R
Rob Lourens 已提交
444
		 * The matching lines of text, or a portion of the matching line that contains the match.
445 446 447 448 449
		 */
		text: string;

		/**
		 * The Range within `text` corresponding to the text of the match.
450
		 * The number of matches must match the TextSearchMatch's range property.
451
		 */
452
		matches: Range | Range[];
453 454 455 456 457
	}

	/**
	 * A match from a text search
	 */
458
	export interface TextSearchMatch {
459 460 461
		/**
		 * The uri for the matching document.
		 */
462
		uri: Uri;
463 464

		/**
465
		 * The range of the match within the document, or multiple ranges for multiple matches.
466
		 */
467
		ranges: Range | Range[];
R
Rob Lourens 已提交
468

469
		/**
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
		 * 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.
492
		 */
493
		lineNumber: number;
494 495
	}

496 497
	export type TextSearchResult = TextSearchMatch | TextSearchContext;

R
Rob Lourens 已提交
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541
	/**
	 * 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;
	}

542
	/**
R
Rob Lourens 已提交
543 544 545 546 547 548 549
	 * 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.
550
	 */
551
	export interface FileSearchProvider {
552 553 554 555 556 557
		/**
		 * 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.
		 */
558
		provideFileSearchResults(query: FileSearchQuery, options: FileSearchOptions, token: CancellationToken): ProviderResult<Uri[]>;
559
	}
560

R
Rob Lourens 已提交
561
	export namespace workspace {
562
		/**
R
Rob Lourens 已提交
563 564 565 566 567 568 569
		 * 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.
570
		 */
R
Rob Lourens 已提交
571 572 573 574 575 576 577 578 579 580 581 582
		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;
583 584
	}

R
Rob Lourens 已提交
585 586 587 588
	//#endregion

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

589 590 591
	/**
	 * Options that can be set on a findTextInFiles search.
	 */
R
Rob Lourens 已提交
592
	export interface FindTextInFilesOptions {
593 594 595 596 597
		/**
		 * 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).
		 */
598
		include?: GlobPattern;
599 600 601

		/**
		 * A [glob pattern](#GlobPattern) that defines files and folders to exclude. The glob pattern
602 603
		 * will be matched against the file paths of resulting matches relative to their workspace. When `undefined`, default excludes will
		 * apply.
604
		 */
605 606 607 608 609 610
		exclude?: GlobPattern;

		/**
		 * Whether to use the default and user-configured excludes. Defaults to true.
		 */
		useDefaultExcludes?: boolean;
611 612 613 614

		/**
		 * The maximum number of results to search for
		 */
R
Rob Lourens 已提交
615
		maxResults?: number;
616 617 618 619 620

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

P
pkoushik 已提交
623 624 625 626
		/**
		 * Whether global files that exclude files, like .gitignore, should be respected.
		 * See the vscode setting `"search.useGlobalIgnoreFiles"`.
		 */
627
		useGlobalIgnoreFiles?: boolean;
P
pkoushik 已提交
628

629 630 631 632
		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
633
		followSymlinks?: boolean;
634 635 636 637 638

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

R
Rob Lourens 已提交
641 642 643
		/**
		 * Options to specify the size of the result text preview.
		 */
644
		previewOptions?: TextSearchPreviewOptions;
645 646 647 648 649 650 651 652 653 654

		/**
		 * 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 已提交
655 656
	}

657
	export namespace workspace {
658 659 660 661 662 663 664
		/**
		 * 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.
		 */
665
		export function findTextInFiles(query: TextSearchQuery, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
666 667 668 669 670 671 672 673 674

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

J
Johannes Rieken 已提交
678
	//#endregion
679

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

J
Joao Moreno 已提交
682 683 684
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
685 686 687 688 689 690 691
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709
	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;
	}
710

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

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

715
	export class Decoration {
716
		letter?: string;
717 718 719
		title?: string;
		color?: ThemeColor;
		priority?: number;
720
		bubble?: boolean;
721 722
	}

723
	export interface DecorationProvider {
724
		onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
725
		provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<Decoration>;
726 727 728
	}

	export namespace window {
729
		export function registerDecorationProvider(provider: DecorationProvider): Disposable;
730 731 732
	}

	//#endregion
733

734 735 736
	//#region debug: https://github.com/microsoft/vscode/issues/88230

	/**
737
	 * A DebugConfigurationProviderTriggerKind specifies when the `provideDebugConfigurations` method of a `DebugConfigurationProvider` is triggered.
738 739
	 * Currently there are two situations: to provide the initial debug configurations for a newly created launch.json or
	 * to provide dynamically generated debug configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command).
740
	 * A trigger kind is used when registering a `DebugConfigurationProvider` with #debug.registerDebugConfigurationProvider.
741
	 */
742
	export enum DebugConfigurationProviderTriggerKind {
743
		/**
744
		 *	`DebugConfigurationProvider.provideDebugConfigurations` is called to provide the initial debug configurations for a newly created launch.json.
745 746 747
		 */
		Initial = 1,
		/**
748
		 * `DebugConfigurationProvider.provideDebugConfigurations` is called to provide dynamically generated debug configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command).
749 750 751 752 753 754 755
		 */
		Dynamic = 2
	}

	export namespace debug {
		/**
		 * Register a [debug configuration provider](#DebugConfigurationProvider) for a specific debug type.
756 757 758 759 760
		 * The optional [triggerKind](#DebugConfigurationProviderTriggerKind) can be used to specify when the `provideDebugConfigurations` method of the provider is triggered.
		 * Currently two trigger kinds are possible: with the value `Initial` (or if no trigger kind argument is given) the `provideDebugConfigurations` method is used to provide the initial debug configurations to be copied into a newly created launch.json.
		 * With the trigger kind `Dynamic` the `provideDebugConfigurations` method is used to dynamically determine debug configurations to be presented to the user (in addition to the static configurations from the launch.json).
		 * Please note that the `triggerKind` argument only applies to the `provideDebugConfigurations` method: so the `resolveDebugConfiguration` methods are not affected at all.
		 * Registering a single provider with resolve methods for different trigger kinds, results in the same resolve methods called multiple times.
761 762 763 764
		 * More than one provider can be registered for the same type.
		 *
		 * @param type The debug type for which the provider is registered.
		 * @param provider The [debug configuration provider](#DebugConfigurationProvider) to register.
765
		 * @param triggerKind The [trigger](#DebugConfigurationProviderTrigger) for which the 'provideDebugConfiguration' method of the provider is registered.
766 767
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
768
		export function registerDebugConfigurationProvider(debugType: string, provider: DebugConfigurationProvider, triggerKind?: DebugConfigurationProviderTriggerKind): Disposable;
769 770 771
	}

	// deprecated debug API
A
Andre Weinand 已提交
772

773
	export interface DebugConfigurationProvider {
774
		/**
A
Andre Weinand 已提交
775 776
		 * Deprecated, use DebugAdapterDescriptorFactory.provideDebugAdapter instead.
		 * @deprecated Use DebugAdapterDescriptorFactory.createDebugAdapterDescriptor instead
777 778
		 */
		debugAdapterExecutable?(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult<DebugAdapterExecutable>;
779 780
	}

J
Johannes Rieken 已提交
781 782
	//#endregion

783 784 785
	//#region LogLevel: https://github.com/microsoft/vscode/issues/85992

	/**
786
	 * @deprecated DO NOT USE, will be removed
787 788 789 790 791 792 793 794 795 796 797 798 799
	 */
	export enum LogLevel {
		Trace = 1,
		Debug = 2,
		Info = 3,
		Warning = 4,
		Error = 5,
		Critical = 6,
		Off = 7
	}

	export namespace env {
		/**
800
		 * @deprecated DO NOT USE, will be removed
801 802 803 804
		 */
		export const logLevel: LogLevel;

		/**
805
		 * @deprecated DO NOT USE, will be removed
806 807 808 809 810 811
		 */
		export const onDidChangeLogLevel: Event<LogLevel>;
	}

	//#endregion

J
Johannes Rieken 已提交
812
	//#region Joao: SCM validation
813

J
Joao Moreno 已提交
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858
	/**
	 * 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 已提交
859

J
Johannes Rieken 已提交
860 861
	//#endregion

862 863 864 865 866 867 868 869 870 871 872 873 874
	//#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>;
875 876 877 878
	}

	//#endregion

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

881 882 883 884 885 886 887 888 889 890 891
	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 已提交
892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917
	namespace window {
		/**
		 * An event which fires when the terminal's pty slave pseudo-device is written to. In other
		 * words, this provides access to the raw data stream from the process running within the
		 * terminal, including VT sequences.
		 */
		export const onDidWriteTerminalData: Event<TerminalDataWriteEvent>;
	}

	//#endregion

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

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

D
Daniel Imms 已提交
919
	export namespace window {
D
Daniel Imms 已提交
920 921 922 923 924 925 926
		/**
		 * An event which fires when the [dimensions](#Terminal.dimensions) of the terminal change.
		 */
		export const onDidChangeTerminalDimensions: Event<TerminalDimensionsChangeEvent>;
	}

	export interface Terminal {
927
		/**
928 929 930
		 * 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.
931
		 */
932
		readonly dimensions: TerminalDimensions | undefined;
D
Daniel Imms 已提交
933 934
	}

935 936
	//#endregion

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 964 965 966 967


	//#region Terminal link handlers https://github.com/microsoft/vscode/issues/91606

	export namespace window {
		/**
		 * Register a [TerminalLinkHandler](#TerminalLinkHandler) that can be used to intercept and
		 * handle links that are activated within terminals.
		 * @param handler The link handler being registered.
		 * @return A disposable that unregisters the link handler.
		 */
		export function registerTerminalLinkHandler(handler: TerminalLinkHandler): Disposable;
	}

	/**
	 * Describes how to handle terminal links.
	 */
	export interface TerminalLinkHandler {
		/**
		 * Handles a link that is activated within the terminal.
		 *
		 * @param terminal The terminal the link was activated on.
		 * @param link The text of the link activated.
		 * @return Whether the link was handled, if the link was handled this link will not be
		 * considered by any other extension or by the default built-in link handler.
		 */
		handleLink(terminal: Terminal, link: string): ProviderResult<boolean>;
	}

	//#endregion

D
Daniel Imms 已提交
968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996
	//#region Contribute to terminal environment https://github.com/microsoft/vscode/issues/46696

	export enum EnvironmentVariableMutatorType {
		/**
		 * Replace the variable's existing value.
		 */
		Replace = 1,
		/**
		 * Append to the end of the variable's existing value.
		 */
		Append = 2,
		/**
		 * Prepend to the start of the variable's existing value.
		 */
		Prepend = 3
	}

	export interface EnvironmentVariableMutator {
		/**
		 * The type of mutation that will occur to the variable.
		 */
		readonly type: EnvironmentVariableMutatorType;

		/**
		 * The value to use for the variable.
		 */
		readonly value: string;
	}

997 998 999
	/**
	 * A collection of mutations that an extension can apply to a process environment.
	 */
D
Daniel Imms 已提交
1000
	export interface EnvironmentVariableCollection {
1001 1002 1003 1004 1005 1006 1007 1008 1009
		/**
		 * Whether the collection should be cached for the workspace and applied to the terminal
		 * across window reloads. When true the collection will be active immediately such when the
		 * window reloads. Additionally, this API will return the cached version if it exists. The
		 * collection will be invalidated when the extension is uninstalled or when the collection
		 * is cleared. Defaults to true.
		 */
		persistent: boolean;

1010 1011 1012 1013 1014 1015
		/**
		 * Replace an environment variable with a value.
		 *
		 * Note that an extension can only make a single change to any one variable, so this will
		 * overwrite any previous calls to replace, append or prepend.
		 */
D
Daniel Imms 已提交
1016
		replace(variable: string, value: string): void;
1017 1018 1019 1020 1021 1022 1023

		/**
		 * Append a value to an environment variable.
		 *
		 * Note that an extension can only make a single change to any one variable, so this will
		 * overwrite any previous calls to replace, append or prepend.
		 */
D
Daniel Imms 已提交
1024
		append(variable: string, value: string): void;
1025 1026 1027 1028 1029 1030 1031

		/**
		 * Prepend a value to an environment variable.
		 *
		 * Note that an extension can only make a single change to any one variable, so this will
		 * overwrite any previous calls to replace, append or prepend.
		 */
D
Daniel Imms 已提交
1032
		prepend(variable: string, value: string): void;
1033 1034 1035 1036

		/**
		 * Gets the mutator that this collection applies to a variable, if any.
		 */
D
Daniel Imms 已提交
1037
		get(variable: string): EnvironmentVariableMutator | undefined;
1038 1039 1040 1041

		/**
		 * Iterate over each mutator in this collection.
		 */
1042
		forEach(callback: (variable: string, mutator: EnvironmentVariableMutator, collection: EnvironmentVariableCollection) => any, thisArg?: any): void;
1043 1044 1045 1046

		/**
		 * Deletes this collection's mutator for a variable.
		 */
D
Daniel Imms 已提交
1047
		delete(variable: string): void;
1048 1049 1050 1051

		/**
		 * Clears all mutators from this collection.
		 */
D
Daniel Imms 已提交
1052 1053 1054
		clear(): void;
	}

1055
	export interface ExtensionContext {
D
Daniel Imms 已提交
1056
		/**
1057 1058
		 * Gets the extension's environment variable collection for this workspace, enabling changes
		 * to be applied to terminal environment variables.
D
Daniel Imms 已提交
1059
		 */
1060
		readonly environmentVariableCollection: EnvironmentVariableCollection;
D
Daniel Imms 已提交
1061 1062 1063 1064
	}

	//#endregion

1065 1066 1067 1068 1069 1070 1071
	//#region Joh -> exclusive document filters

	export interface DocumentFilter {
		exclusive?: boolean;
	}

	//#endregion
C
Christof Marti 已提交
1072

1073 1074 1075 1076 1077 1078 1079 1080
	//#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
1081

1082
	//#region Tree View: https://github.com/microsoft/vscode/issues/61313
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093
	/**
	 * Label describing the [Tree item](#TreeItem)
	 */
	export interface TreeItemLabel {

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

		/**
S
Sandeep Somavarapu 已提交
1094
		 * Ranges in the label to highlight. A range is defined as a tuple of two number where the
S
Sandeep Somavarapu 已提交
1095
		 * first is the inclusive start index and the second the exclusive end index
1096
		 */
S
Sandeep Somavarapu 已提交
1097
		highlights?: [number, number][];
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112

	}

	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);
	}
1113
	//#endregion
1114

1115
	//#region CustomExecution: https://github.com/microsoft/vscode/issues/81007
1116 1117 1118
	/**
	 * A task to execute
	 */
G
Gabriel DeBacker 已提交
1119
	export class Task2 extends Task {
1120
		detail?: string;
1121
	}
G
Gabriel DeBacker 已提交
1122

1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133
	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>);
	}
1134
	//#endregion
1135

1136
	//#region Task presentation group: https://github.com/microsoft/vscode/issues/47265
1137 1138 1139 1140 1141 1142 1143
	export interface TaskPresentationOptions {
		/**
		 * Controls whether the task is executed in a specific terminal group using split panes.
		 */
		group?: string;
	}
	//#endregion
1144

1145
	//#region Status bar item with ID and Name: https://github.com/microsoft/vscode/issues/74972
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191

	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
1192

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

P
Pine Wu 已提交
1195 1196 1197 1198
	/**
	 * The rename provider interface defines the contract between extensions and
	 * the live-rename feature.
	 */
A
Alexandru Dima 已提交
1199
	export interface OnTypeRenameProvider {
P
Pine Wu 已提交
1200 1201 1202 1203 1204 1205 1206 1207 1208
		/**
		 * Provide a list of ranges that can be live renamed together.
		 *
		 * @param document The document in which the command was invoked.
		 * @param position The position at which the command was invoked.
		 * @param token A cancellation token.
		 * @return A list of ranges that can be live-renamed togehter. The ranges must have
		 * identical length and contain identical text content. The ranges cannot overlap.
		 */
A
Alexandru Dima 已提交
1209 1210 1211 1212
		provideOnTypeRenameRanges(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Range[]>;
	}

	namespace languages {
P
Pine Wu 已提交
1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225
		/**
		 * Register a rename provider that works on type.
		 *
		 * Multiple providers can be registered for a language. In that case providers are sorted
		 * by their [score](#languages.match) and the best-matching provider is used. Failure
		 * of the selected provider will cause a failure of the whole operation.
		 *
		 * @param selector A selector that defines the documents this provider is applicable to.
		 * @param provider An on type rename provider.
		 * @param stopPattern Stop on type renaming when input text matches the regular expression. Defaults to `^\s`.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
		export function registerOnTypeRenameProvider(selector: DocumentSelector, provider: OnTypeRenameProvider, stopPattern?: RegExp): Disposable;
A
Alexandru Dima 已提交
1226 1227 1228 1229
	}

	//#endregion

1230 1231 1232
	//#region Custom editor https://github.com/microsoft/vscode/issues/77131

	/**
M
Matt Bierner 已提交
1233
	 * Represents a custom document used by a [`CustomEditorProvider`](#CustomEditorProvider).
1234
	 *
M
Matt Bierner 已提交
1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253
	 * Custom documents are only used within a given `CustomEditorProvider`. The lifecycle of a `CustomDocument` is
	 * managed by VS Code. When no more references remain to a `CustomDocument`, it is disposed of.
	 */
	interface CustomDocument {
		/**
		 * The associated uri for this document.
		 */
		readonly uri: Uri;

		/**
		 * Dispose of the custom document.
		 *
		 * This is invoked by VS Code when there are no more references to a given `CustomDocument` (for example when
		 * all editors associated with the document have been closed.)
		 */
		dispose(): void;
	}

	/**
1254
	 * Event triggered by extensions to signal to VS Code that an edit has occurred on an [`CustomDocument`](#CustomDocument).
1255
	 *
1256
	 * @see [`CustomDocumentProvider.onDidChangeCustomDocument`](#CustomDocumentProvider.onDidChangeCustomDocument).
M
Matt Bierner 已提交
1257
	 */
1258
	interface CustomDocumentEditEvent<T extends CustomDocument = CustomDocument> {
1259 1260 1261 1262

		/**
		 * The document that the edit is for.
		 */
1263
		readonly document: T;
1264

M
Matt Bierner 已提交
1265 1266 1267 1268 1269
		/**
		 * Undo the edit operation.
		 *
		 * This is invoked by VS Code when the user triggers an undo.
		 */
1270
		undo(): Thenable<void> | void;
M
Matt Bierner 已提交
1271 1272 1273 1274 1275 1276

		/**
		 * Redo the edit operation.
		 *
		 * This is invoked by VS Code when the user triggers a redo.
		 */
1277
		redo(): Thenable<void> | void;
M
Matt Bierner 已提交
1278 1279 1280 1281 1282 1283 1284 1285 1286

		/**
		 * Display name describing the edit.
		 *
		 * This is shown in the UI to users.
		 */
		readonly label?: string;
	}

1287
	/**
1288
	 * Event triggered by extensions to signal to VS Code that the content of a [`CustomDocument`](#CustomDocument)
1289 1290
	 * has changed.
	 *
1291
	 * @see [`CustomDocumentProvider.onDidChangeCustomDocument`](#CustomDocumentProvider.onDidChangeCustomDocument).
1292
	 */
1293
	interface CustomDocumentContentChangeEvent<T extends CustomDocument = CustomDocument> {
1294 1295 1296
		/**
		 * The document that the change is for.
		 */
1297
		readonly document: T;
1298 1299
	}

M
Matt Bierner 已提交
1300
	/**
1301
	 * A backup for an [`CustomDocument`](#CustomDocument).
M
Matt Bierner 已提交
1302 1303 1304 1305 1306 1307 1308
	 */
	interface CustomDocumentBackup {
		/**
		 * Unique identifier for the backup.
		 *
		 * This id is passed back to your extension in `openCustomDocument` when opening a custom editor from a backup.
		 */
1309
		readonly id: string;
M
Matt Bierner 已提交
1310 1311

		/**
1312
		 * Delete the current backup.
M
Matt Bierner 已提交
1313
		 *
1314 1315
		 * 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.
M
Matt Bierner 已提交
1316
		 */
1317 1318 1319 1320
		delete(): void;
	}

	/**
M
Matt Bierner 已提交
1321
	 * Additional information used to implement [`CustomEditableDocument.backup`](#CustomEditableDocument.backup).
1322 1323 1324
	 */
	interface CustomDocumentBackupContext {
		/**
1325 1326 1327
		 * Suggested file location to write the new backup.
		 *
		 * Note that your extension is free to ignore this and use its own strategy for backup.
1328
		 *
1329
		 * For editors for workspace resource, this destination will be in the workspace storage. The path may not
1330
		 */
1331
		readonly destination: Uri;
M
Matt Bierner 已提交
1332 1333 1334
	}

	/**
1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347
	 * Additional information about the opening custom document.
	 */
	interface CustomDocumentOpenContext {
		/**
		 * The id of the backup to restore the document from or `undefined` if there is no backup.
		 *
		 * If this is provided, your extension should restore the editor from the backup instead of reading the file
		 * the user's workspace.
		 */
		readonly backupId?: string;
	}

	/**
M
Matt Bierner 已提交
1348
	 * Provider for readonly custom editors that use a custom document model.
1349
	 *
1350 1351 1352 1353 1354 1355
	 * Custom editors use [`CustomDocument`](#CustomDocument) as their document model instead of a [`TextDocument`](#TextDocument).
	 *
	 * You should use this type of custom editor when dealing with binary files or more complex scenarios. For simple
	 * text based documents, use [`CustomTextEditorProvider`](#CustomTextEditorProvider) instead.
	 *
	 * @param T Type of the custom document returned by this provider.
1356
	 */
1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373
	export interface CustomReadonlyEditorProvider<T extends CustomDocument = CustomDocument> {

		/**
		 * Create a new document for a given resource.
		 *
		 * `openCustomDocument` is called when the first editor for a given resource is opened, and the resolve document
		 * is passed to `resolveCustomEditor`. The resolved `CustomDocument` is re-used for subsequent editor opens.
		 * If all editors for a given resource are closed, the `CustomDocument` is disposed of. Opening an editor at
		 * this point will trigger another call to `openCustomDocument`.
		 *
		 * @param uri Uri of the document to open.
		 * @param openContext Additional information about the opening custom document.
		 * @param token A cancellation token that indicates the result is no longer needed.
		 *
		 * @return The custom document.
		 */
		openCustomDocument(uri: Uri, openContext: CustomDocumentOpenContext, token: CancellationToken): Thenable<T> | T;
J
Johannes Rieken 已提交
1374

1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392
		/**
		 * Resolve a custom editor for a given resource.
		 *
		 * This is called whenever the user opens a new editor for this `CustomEditorProvider`.
		 *
		 * To resolve a custom editor, the provider must fill in its initial html content and hook up all
		 * the event listeners it is interested it. The provider can also hold onto the `WebviewPanel` to use later,
		 * for example in a command. See [`WebviewPanel`](#WebviewPanel) for additional details.
		 *
		 * @param document Document for the resource being resolved.
		 * @param webviewPanel Webview to resolve.
		 * @param token A cancellation token that indicates the result is no longer needed.
		 *
		 * @return Optional thenable indicating that the custom editor has been resolved.
		 */
		resolveCustomEditor(document: T, webviewPanel: WebviewPanel, token: CancellationToken): Thenable<void> | void;
	}

M
Matt Bierner 已提交
1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403
	/**
	 * Provider for editiable custom editors that use a custom document model.
	 *
	 * Custom editors use [`CustomDocument`](#CustomDocument) as their document model instead of a [`TextDocument`](#TextDocument).
	 * This gives extensions full control over actions such as edit, save, and backup.
	 *
	 * You should use this type of custom editor when dealing with binary files or more complex scenarios. For simple
	 * text based documents, use [`CustomTextEditorProvider`](#CustomTextEditorProvider) instead.
	 *
	 * @param T Type of the custom document returned by this provider.
	 */
1404
	export interface CustomEditorProvider<T extends CustomDocument = CustomDocument> extends CustomReadonlyEditorProvider<T> {
J
Johannes Rieken 已提交
1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424
		/**
		 * Signal that an edit has occurred inside a custom editor.
		 *
		 * This event must be fired by your extension whenever an edit happens in a custom editor. An edit can be
		 * anything from changing some text, to cropping an image, to reordering a list. Your extension is free to
		 * define what an edit is and what data is stored on each edit.
		 *
		 * Firing `onDidChange` causes VS Code to mark the editors as being dirty. This is cleared when the user either
		 * saves or reverts the file.
		 *
		 * Editors that support undo/redo must fire a `CustomDocumentEditEvent` whenever an edit happens. This allows
		 * users to undo and redo the edit using VS Code's standard VS Code keyboard shortcuts. VS Code will also mark
		 * the editor as no longer being dirty if the user undoes all edits to the last saved state.
		 *
		 * Editors that support editing but cannot use VS Code's standard undo/redo mechanism must fire a `CustomDocumentContentChangeEvent`.
		 * The only way for a user to clear the dirty state of an editor that does not support undo/redo is to either
		 * `save` or `revert` the file.
		 *
		 * An editor should only ever fire `CustomDocumentEditEvent` events, or only ever fire `CustomDocumentContentChangeEvent` events.
		 */
1425
		readonly onDidChangeCustomDocument: Event<CustomDocumentEditEvent<T>> | Event<CustomDocumentContentChangeEvent<T>>;
J
Johannes Rieken 已提交
1426

1427
		/**
1428
		 * Save a custom document.
1429 1430 1431 1432
		 *
		 * This method is invoked by VS Code when the user saves a custom editor. This can happen when the user
		 * triggers save while the custom editor is active, by commands such as `save all`, or by auto save if enabled.
		 *
M
Matt Bierner 已提交
1433
		 * To implement `save`, the implementer must persist the custom editor. This usually means writing the
1434 1435 1436
		 * file data for the custom document to disk. After `save` completes, any associated editor instances will
		 * no longer be marked as dirty.
		 *
1437
		 * @param document Document to save.
1438 1439 1440 1441
		 * @param cancellation Token that signals the save is no longer required (for example, if another save was triggered).
		 *
		 * @return Thenable signaling that saving has completed.
		 */
1442
		saveCustomDocument(document: T, cancellation: CancellationToken): Thenable<void>;
1443 1444

		/**
1445
		 * Save a custom document to a different location.
1446
		 *
1447 1448
		 * This method is invoked by VS Code when the user triggers 'save as' on a custom editor. The implementer must
		 * persist the custom editor to `destination`.
1449
		 *
M
Matt Bierner 已提交
1450
		 * When the user accepts save as, the current editor is be replaced by an editor for the newly saved file.
1451
		 *
1452 1453
		 * @param document Document to save.
		 * @param destination Location to save to.
1454 1455 1456 1457
		 * @param cancellation Token that signals the save is no longer required.
		 *
		 * @return Thenable signaling that saving has completed.
		 */
1458
		saveCustomDocumentAs(document: T, destination: Uri, cancellation: CancellationToken): Thenable<void>;
1459 1460

		/**
1461
		 * Revert a custom document to its last saved state.
1462 1463 1464 1465
		 *
		 * This method is invoked by VS Code when the user triggers `File: Revert File` in a custom editor. (Note that
		 * this is only used using VS Code's `File: Revert File` command and not on a `git revert` of the file).
		 *
M
Matt Bierner 已提交
1466
		 * To implement `revert`, the implementer must make sure all editor instances (webviews) for `document`
1467 1468 1469
		 * are displaying the document in the same state is saved in. This usually means reloading the file from the
		 * workspace.
		 *
1470
		 * @param document Document to revert.
M
Matt Bierner 已提交
1471
		 * @param cancellation Token that signals the revert is no longer required.
1472 1473 1474
		 *
		 * @return Thenable signaling that the change has completed.
		 */
1475
		revertCustomDocument(document: T, cancellation: CancellationToken): Thenable<void>;
1476 1477

		/**
1478
		 * Back up a dirty custom document.
1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489
		 *
		 * 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 ).
		 *
1490
		 * @param document Document to backup.
1491
		 * @param context Information that can be used to backup the document.
1492 1493 1494 1495 1496
		 * @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.
		 */
1497
		backupCustomDocument(document: T, context: CustomDocumentBackupContext, cancellation: CancellationToken): Thenable<CustomDocumentBackup>;
1498 1499
	}

M
Matt Bierner 已提交
1500 1501 1502 1503 1504 1505
	namespace window {
		/**
		 * Temporary overload for `registerCustomEditorProvider` that takes a `CustomEditorProvider`.
		 */
		export function registerCustomEditorProvider2(
			viewType: string,
1506
			provider: CustomReadonlyEditorProvider | CustomEditorProvider,
M
Matt Bierner 已提交
1507 1508
			options?: {
				readonly webviewOptions?: WebviewPanelOptions;
1509 1510

				/**
1511 1512
				 * Only applies to `CustomReadonlyEditorProvider | CustomEditorProvider`.
				 *
1513 1514 1515 1516 1517 1518 1519 1520 1521 1522
				 * Indicates that the provider allows multiple editor instances to be open at the same time for
				 * the same resource.
				 *
				 * If not set, VS Code only allows one editor instance to be open at a time for each resource. If the
				 * user tries to open a second editor instance for the resource, the first one is instead moved to where
				 * the second one was to be opened.
				 *
				 * When set, users can split and create copies of the custom editor. The custom editor must make sure it
				 * can properly synchronize the states of all editor instances for a resource so that they are consistent.
				 */
1523
				readonly supportsMultipleEditorsPerDocument?: boolean;
M
Matt Bierner 已提交
1524 1525 1526 1527
			}
		): Disposable;
	}

1528 1529
	// #endregion

1530
	//#region Custom editor move https://github.com/microsoft/vscode/issues/86146
1531

1532
	// TODO: Also for custom editor
1533

1534
	export interface CustomTextEditorProvider {
M
Matt Bierner 已提交
1535

1536 1537 1538 1539 1540 1541 1542 1543 1544

		/**
		 * 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.
1545
		 * @param token A cancellation token that indicates the result is no longer needed.
1546 1547 1548
		 *
		 * @return Thenable indicating that the webview editor has been moved.
		 */
1549
		moveCustomTextEditor?(newDocument: TextDocument, existingWebviewPanel: WebviewPanel, token: CancellationToken): Thenable<void>;
1550 1551 1552
	}

	//#endregion
1553

P
Peter Elmers 已提交
1554

J
Johannes Rieken 已提交
1555
	//#region allow QuickPicks to skip sorting: https://github.com/microsoft/vscode/issues/73904
P
Peter Elmers 已提交
1556 1557 1558

	export interface QuickPick<T extends QuickPickItem> extends QuickInput {
		/**
1559 1560
		 * An optional flag to sort the final results by index of first query match in label. Defaults to true.
		 */
P
Peter Elmers 已提交
1561 1562 1563 1564
		sortByLabel: boolean;
	}

	//#endregion
M
Matt Bierner 已提交
1565

E
Eric Amodio 已提交
1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576
	//#region Allow theme icons in hovers: https://github.com/microsoft/vscode/issues/84695

	export interface MarkdownString {

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

	//#endregion
S
Sandeep Somavarapu 已提交
1577

R
rebornix 已提交
1578 1579
	//#region Peng: Notebook

R
rebornix 已提交
1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590
	export enum CellKind {
		Markdown = 1,
		Code = 2
	}

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

R
rebornix 已提交
1591
	export interface CellStreamOutput {
R
rebornix 已提交
1592
		outputKind: CellOutputKind.Text;
R
rebornix 已提交
1593 1594 1595
		text: string;
	}

R
rebornix 已提交
1596
	export interface CellErrorOutput {
R
rebornix 已提交
1597
		outputKind: CellOutputKind.Error;
R
rebornix 已提交
1598 1599 1600 1601 1602 1603 1604
		/**
		 * Exception Name
		 */
		ename: string;
		/**
		 * Exception Value
		 */
R
rebornix 已提交
1605
		evalue: string;
R
rebornix 已提交
1606 1607 1608
		/**
		 * Exception call stack
		 */
R
rebornix 已提交
1609 1610 1611
		traceback: string[];
	}

R
rebornix 已提交
1612
	export interface CellDisplayOutput {
R
rebornix 已提交
1613
		outputKind: CellOutputKind.Rich;
R
rebornix 已提交
1614 1615 1616 1617 1618 1619
		/**
		 * { mime_type: value }
		 *
		 * Example:
		 * ```json
		 * {
R
rebornix 已提交
1620
		 *   "outputKind": vscode.CellOutputKind.Rich,
R
rebornix 已提交
1621 1622 1623 1624 1625 1626 1627 1628 1629 1630
		 *   "data": {
		 *      "text/html": [
		 *          "<h1>Hello</h1>"
		 *       ],
		 *      "text/plain": [
		 *        "<IPython.lib.display.IFrame at 0x11dee3e80>"
		 *      ]
		 *   }
		 * }
		 */
R
rebornix 已提交
1631
		data: { [key: string]: any };
R
rebornix 已提交
1632 1633
	}

R
rebornix 已提交
1634
	export type CellOutput = CellStreamOutput | CellErrorOutput | CellDisplayOutput;
R
rebornix 已提交
1635

R
Rob Lourens 已提交
1636 1637 1638 1639 1640 1641 1642
	export enum NotebookCellRunState {
		Running = 1,
		Idle = 2,
		Success = 3,
		Error = 4
	}

R
rebornix 已提交
1643
	export interface NotebookCellMetadata {
1644 1645 1646
		/**
		 * Controls if the content of a cell is editable or not.
		 */
R
rebornix 已提交
1647
		editable?: boolean;
R
rebornix 已提交
1648 1649 1650 1651 1652

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

		/**
1656
		 * The order in which this cell was executed.
R
rebornix 已提交
1657
		 */
1658
		executionOrder?: number;
R
Rob Lourens 已提交
1659 1660 1661 1662 1663 1664 1665 1666 1667 1668

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

		/**
		 * The cell's current run state
		 */
		runState?: NotebookCellRunState;
R
rebornix 已提交
1669 1670
	}

R
rebornix 已提交
1671
	export interface NotebookCell {
1672
		readonly uri: Uri;
R
rebornix 已提交
1673
		readonly cellKind: CellKind;
1674 1675
		readonly document: TextDocument;
		// API remove `source` or doc it as shorthand for document.getText()
R
rebornix 已提交
1676
		readonly source: string;
R
rebornix 已提交
1677
		language: string;
R
rebornix 已提交
1678
		outputs: CellOutput[];
R
rebornix 已提交
1679
		metadata: NotebookCellMetadata;
R
rebornix 已提交
1680 1681 1682
	}

	export interface NotebookDocumentMetadata {
1683 1684
		/**
		 * Controls if users can add or delete cells
1685
		 * Defaults to true
1686
		 */
1687
		editable?: boolean;
R
rebornix 已提交
1688

1689 1690 1691 1692 1693 1694
		/**
		 * Controls whether the full notebook can be run at once.
		 * Defaults to true
		 */
		runnable?: boolean;

1695 1696
		/**
		 * Default value for [cell editable metadata](#NotebookCellMetadata.editable).
1697
		 * Defaults to true.
1698
		 */
1699
		cellEditable?: boolean;
R
rebornix 已提交
1700 1701 1702

		/**
		 * Default value for [cell runnable metadata](#NotebookCellMetadata.runnable).
1703
		 * Defaults to true.
R
rebornix 已提交
1704
		 */
1705
		cellRunnable?: boolean;
R
rebornix 已提交
1706

1707 1708 1709 1710
		/**
		 * Whether the [execution order](#NotebookCellMetadata.executionOrder) indicator will be displayed.
		 * Defaults to true.
		 */
1711
		hasExecutionOrder?: boolean;
R
rebornix 已提交
1712 1713
	}

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

	export interface NotebookConcatTextDocument {
1725 1726
		isClosed: boolean;
		dispose(): void;
1727
		onDidChange: Event<void>;
1728 1729 1730 1731 1732 1733 1734
		version: number;
		getText(): string;
		getText(range: Range): string;
		offsetAt(position: Position): number;
		positionAt(offset: number): Position;
		locationAt(positionOrRange: Position | Range): Location;
		positionAt(location: Location): Position;
R
rebornix 已提交
1735 1736
	}

R
rebornix 已提交
1737
	export interface NotebookEditorCellEdit {
R
rebornix 已提交
1738
		insert(index: number, content: string | string[], language: string, type: CellKind, outputs: CellOutput[], metadata: NotebookCellMetadata | undefined): void;
R
rebornix 已提交
1739 1740 1741
		delete(index: number): void;
	}

R
rebornix 已提交
1742
	export interface NotebookEditor {
R
rebornix 已提交
1743 1744 1745
		/**
		 * The document associated with this notebook editor.
		 */
R
rebornix 已提交
1746
		readonly document: NotebookDocument;
R
rebornix 已提交
1747 1748 1749 1750 1751

		/**
		 * The primary selected cell on this notebook editor.
		 */
		readonly selection?: NotebookCell;
R
rebornix 已提交
1752
		viewColumn?: ViewColumn;
1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765
		/**
		 * Fired when the output hosting webview posts a message.
		 */
		readonly onDidReceiveMessage: Event<any>;
		/**
		 * Post a message to the output hosting webview.
		 *
		 * Messages are only delivered if the editor is live.
		 *
		 * @param message Body of the message. This must be a string or other json serilizable object.
		 */
		postMessage(message: any): Thenable<boolean>;

R
rebornix 已提交
1766
		edit(callback: (editBuilder: NotebookEditorCellEdit) => void): Thenable<boolean>;
R
rebornix 已提交
1767 1768 1769
	}

	export interface NotebookProvider {
R
rebornix 已提交
1770
		resolveNotebook(editor: NotebookEditor): Promise<void>;
1771
		executeCell(document: NotebookDocument, cell: NotebookCell | undefined, token: CancellationToken): Promise<void>;
R
rebornix 已提交
1772
		save(document: NotebookDocument): Promise<boolean>;
R
rebornix 已提交
1773 1774
	}

R
rebornix 已提交
1775
	export interface NotebookOutputSelector {
R
rebornix 已提交
1776 1777 1778 1779 1780
		type: string;
		subTypes?: string[];
	}

	export interface NotebookOutputRenderer {
R
rebornix 已提交
1781 1782 1783
		/**
		 *
		 * @returns HTML fragment. We can probably return `CellOutput` instead of string ?
1784
		 *
R
rebornix 已提交
1785
		 */
R
rebornix 已提交
1786
		render(document: NotebookDocument, output: CellDisplayOutput, mimeType: string): string;
R
rebornix 已提交
1787
		preloads?: Uri[];
R
rebornix 已提交
1788 1789
	}

R
rebornix 已提交
1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803
	export interface NotebookDocumentChangeEvent {

		/**
		 * The affected document.
		 */
		readonly document: NotebookDocument;

		/**
		 * An array of content changes.
		 */
		// readonly contentChanges: ReadonlyArray<TextDocumentContentChangeEvent>;
	}

	export namespace notebook {
R
rebornix 已提交
1804 1805 1806 1807
		export function registerNotebookProvider(
			notebookType: string,
			provider: NotebookProvider
		): Disposable;
R
rebornix 已提交
1808

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

1811
		// remove activeNotebookDocument, now that there is activeNotebookEditor.document
R
rebornix 已提交
1812
		export let activeNotebookDocument: NotebookDocument | undefined;
R
rebornix 已提交
1813

R
rebornix 已提交
1814 1815
		export let activeNotebookEditor: NotebookEditor | undefined;

1816
		export const onDidChangeNotebookDocument: Event<NotebookDocumentChangeEvent>;
1817 1818

		/**
J
Johannes Rieken 已提交
1819 1820
		 * 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.
1821 1822 1823 1824 1825
		 *
		 * @param notebook
		 * @param selector
		 */
		export function createConcatTextDocument(notebook: NotebookDocument, selector?: DocumentSelector): NotebookConcatTextDocument;
R
rebornix 已提交
1826 1827 1828
	}

	//#endregion
R
rebornix 已提交
1829

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

P
label2  
Pine Wu 已提交
1832 1833 1834 1835
	export interface CompletionItem {
		/**
		 * Will be merged into CompletionItem#label
		 */
P
Pine Wu 已提交
1836
		label2?: CompletionItemLabel;
P
label2  
Pine Wu 已提交
1837 1838
	}

1839 1840
	export interface CompletionItemLabel {
		/**
P
Pine Wu 已提交
1841
		 * The function or variable. Rendered leftmost.
1842
		 */
P
Pine Wu 已提交
1843
		name: string;
1844

P
Pine Wu 已提交
1845
		/**
1846
		 * The parameters without the return type. Render after `name`.
P
Pine Wu 已提交
1847
		 */
1848
		parameters?: string;
P
Pine Wu 已提交
1849 1850

		/**
P
Pine Wu 已提交
1851
		 * The fully qualified name, like package name or file path. Rendered after `signature`.
P
Pine Wu 已提交
1852 1853
		 */
		qualifier?: string;
1854

P
Pine Wu 已提交
1855
		/**
P
Pine Wu 已提交
1856
		 * The return-type of a function or type of a property/variable. Rendered rightmost.
P
Pine Wu 已提交
1857
		 */
P
Pine Wu 已提交
1858
		type?: string;
1859 1860 1861 1862
	}

	//#endregion

1863

1864 1865 1866 1867
	//#region eamodio - timeline: https://github.com/microsoft/vscode/issues/84297

	export class TimelineItem {
		/**
1868
		 * A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred.
1869
		 */
E
Eric Amodio 已提交
1870
		timestamp: number;
1871 1872

		/**
1873
		 * A human-readable string describing the timeline item.
1874 1875 1876 1877
		 */
		label: string;

		/**
1878
		 * Optional id for the timeline item. It must be unique across all the timeline items provided by this source.
1879
		 *
1880
		 * If not provided, an id is generated using the timeline item's timestamp.
1881 1882 1883 1884
		 */
		id?: string;

		/**
1885
		 * The icon path or [ThemeIcon](#ThemeIcon) for the timeline item.
1886
		 */
1887
		iconPath?: Uri | { light: Uri; dark: Uri } | ThemeIcon;
1888 1889

		/**
1890
		 * A human readable string describing less prominent details of the timeline item.
1891 1892 1893 1894 1895 1896
		 */
		description?: string;

		/**
		 * The tooltip text when you hover over the timeline item.
		 */
1897
		detail?: string;
1898 1899 1900 1901 1902 1903 1904

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

		/**
1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920
		 * 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`.
1921 1922 1923 1924 1925
		 */
		contextValue?: string;

		/**
		 * @param label A human-readable string describing the timeline item
E
Eric Amodio 已提交
1926
		 * @param timestamp A timestamp (in milliseconds since 1 January 1970 00:00:00) for when the timeline item occurred
1927
		 */
E
Eric Amodio 已提交
1928
		constructor(label: string, timestamp: number);
1929 1930
	}

1931
	export interface TimelineChangeEvent {
E
Eric Amodio 已提交
1932
		/**
1933
		 * The [uri](#Uri) of the resource for which the timeline changed.
E
Eric Amodio 已提交
1934
		 */
E
Eric Amodio 已提交
1935
		uri: Uri;
1936

E
Eric Amodio 已提交
1937
		/**
1938
		 * A flag which indicates whether the entire timeline should be reset.
E
Eric Amodio 已提交
1939
		 */
1940 1941
		reset?: boolean;
	}
E
Eric Amodio 已提交
1942

1943 1944 1945
	export interface Timeline {
		readonly paging?: {
			/**
E
Eric Amodio 已提交
1946
			 * A provider-defined cursor specifying the starting point of timeline items which are after the ones returned.
E
Eric Amodio 已提交
1947
			 * Use `undefined` to signal that there are no more items to be returned.
1948
			 */
E
Eric Amodio 已提交
1949
			readonly cursor: string | undefined;
1950
		}
E
Eric Amodio 已提交
1951 1952

		/**
1953
		 * An array of [timeline items](#TimelineItem).
E
Eric Amodio 已提交
1954
		 */
1955
		readonly items: readonly TimelineItem[];
E
Eric Amodio 已提交
1956 1957
	}

1958
	export interface TimelineOptions {
E
Eric Amodio 已提交
1959
		/**
E
Eric Amodio 已提交
1960
		 * A provider-defined cursor specifying the starting point of the timeline items that should be returned.
E
Eric Amodio 已提交
1961
		 */
1962
		cursor?: string;
E
Eric Amodio 已提交
1963 1964

		/**
1965 1966
		 * 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 已提交
1967
		 */
1968
		limit?: number | { timestamp: number; id?: string };
E
Eric Amodio 已提交
1969 1970
	}

1971
	export interface TimelineProvider {
1972
		/**
1973 1974
		 * 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`.
1975
		 */
E
Eric Amodio 已提交
1976
		onDidChange?: Event<TimelineChangeEvent | undefined>;
1977 1978

		/**
1979
		 * An identifier of the source of the timeline items. This can be used to filter sources.
1980
		 */
1981
		readonly id: string;
1982

E
Eric Amodio 已提交
1983
		/**
1984
		 * 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 已提交
1985
		 */
1986
		readonly label: string;
1987 1988

		/**
E
Eric Amodio 已提交
1989
		 * Provide [timeline items](#TimelineItem) for a [Uri](#Uri).
1990
		 *
1991
		 * @param uri The [uri](#Uri) of the file to provide the timeline for.
1992
		 * @param options A set of options to determine how results should be returned.
1993
		 * @param token A cancellation token.
E
Eric Amodio 已提交
1994
		 * @return The [timeline result](#TimelineResult) or a thenable that resolves to such. The lack of a result
1995 1996
		 * can be signaled by returning `undefined`, `null`, or an empty array.
		 */
1997
		provideTimeline(uri: Uri, options: TimelineOptions, token: CancellationToken): ProviderResult<Timeline>;
1998 1999 2000 2001 2002 2003 2004 2005 2006 2007
	}

	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.
		 *
2008
		 * @param scheme A scheme or schemes that defines which documents this provider is applicable to. Can be `*` to target all documents.
2009 2010
		 * @param provider A timeline provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
E
Eric Amodio 已提交
2011
		*/
2012
		export function registerTimelineProvider(scheme: string | string[], provider: TimelineProvider): Disposable;
2013 2014 2015
	}

	//#endregion
2016

2017 2018 2019 2020 2021 2022
	//#region https://github.com/microsoft/vscode/issues/86788

	export interface CodeActionProviderMetadata {
		/**
		 * Static documentation for a class of code actions.
		 *
M
Matt Bierner 已提交
2023 2024
		 * The documentation is shown in the code actions menu if either:
		 *
M
Matt Bierner 已提交
2025 2026 2027 2028
		 * - Code actions of `kind` are requested by VS Code. In this case, VS Code will show the documentation that
		 *   most closely matches the requested code action kind. For example, if a provider has documentation for
		 *   both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`,
		 *   VS Code will use the documentation for `RefactorExtract` intead of the documentation for `Refactor`.
M
Matt Bierner 已提交
2029 2030
		 *
		 * - Any code actions of `kind` are returned by the provider.
2031 2032 2033 2034 2035
		 */
		readonly documentation?: ReadonlyArray<{ readonly kind: CodeActionKind, readonly command: Command }>;
	}

	//#endregion
2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048

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

	/**
	 * Options to configure the behaviour of a file open dialog.
	 *
	 * * Note 1: A dialog can select files, folders, or both. This is not true for Windows
	 * which enforces to open either files or folder, but *not both*.
	 * * Note 2: Explicitly setting `canSelectFiles` and `canSelectFolders` to `false` is futile
	 * and the editor then silently adjusts the options to select files.
	 */
	export interface OpenDialogOptions {
		/**
2049 2050 2051 2052
		 * Dialog title.
		 *
		 * Depending on the underlying operating system this parameter might be ignored, since some
		 * systems do not present title on open dialogs.
2053 2054 2055 2056 2057 2058 2059 2060 2061
		 */
		title?: string;
	}

	/**
	 * Options to configure the behaviour of a file save dialog.
	 */
	export interface SaveDialogOptions {
		/**
2062 2063 2064 2065
		 * Dialog title.
		 *
		 * Depending on the underlying operating system this parameter might be ignored, since some
		 * systems do not present title on save dialogs.
2066 2067 2068 2069 2070
		 */
		title?: string;
	}

	//#endregion
2071

2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092
	//#region Comment
	export interface CommentOptions {
		/**
		 * An optional string to show on the comment input box when it's collapsed.
		 */
		prompt?: string;

		/**
		 * An optional string to show as placeholder in the comment input box when it's focused.
		 */
		placeHolder?: string;
	}

	export interface CommentController {
		/**
		 * Comment controller options
		 */
		options?: CommentOptions;
	}

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