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

// This is the place for API experiments and proposal.

declare module 'vscode' {

J
Johannes Rieken 已提交
10 11 12 13
	export namespace window {
		export function sampleFunction(): Thenable<any>;
	}

14
	//#region Joh: file system provider (OLD)
J
Johannes Rieken 已提交
15

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
	export enum FileChangeType {
		Updated = 0,
		Added = 1,
		Deleted = 2
	}

	export interface FileChange {
		type: FileChangeType;
		resource: Uri;
	}

	export enum FileType {
		File = 0,
		Dir = 1,
		Symlink = 2
	}

	export interface FileStat {
34
		id: number | string;
35
		mtime: number;
J
Johannes Rieken 已提交
36
		// atime: number;
37 38 39 40
		size: number;
		type: FileType;
	}

J
Johannes Rieken 已提交
41
	// todo@joh discover files etc
J
Johannes Rieken 已提交
42
	// todo@joh CancellationToken everywhere
J
Johannes Rieken 已提交
43
	// todo@joh add open/close calls?
J
Johannes Rieken 已提交
44
	export interface FileSystemProvider {
D
Dirk Baeumer 已提交
45

J
Johannes Rieken 已提交
46
		readonly onDidChange?: Event<FileChange[]>;
47 48

		// more...
49
		// @deprecated - will go away
J
Johannes Rieken 已提交
50
		utimes(resource: Uri, mtime: number, atime: number): Thenable<FileStat>;
51

52
		stat(resource: Uri): Thenable<FileStat>;
53

54
		read(resource: Uri, offset: number, length: number, progress: Progress<Uint8Array>): Thenable<number>;
55

J
Johannes Rieken 已提交
56
		// todo@joh - have an option to create iff not exist
57 58 59 60
		// todo@remote
		// offset - byte offset to start
		// count - number of bytes to write
		// Thenable<number> - number of bytes actually written
61
		write(resource: Uri, content: Uint8Array): Thenable<void>;
62 63 64

		// todo@remote
		// Thenable<FileStat>
65 66 67 68 69
		move(resource: Uri, target: Uri): Thenable<FileStat>;

		// todo@remote
		// helps with performance bigly
		// copy?(from: Uri, to: Uri): Thenable<void>;
70 71 72

		// todo@remote
		// Thenable<FileStat>
73
		mkdir(resource: Uri): Thenable<FileStat>;
74

75 76 77 78 79
		readdir(resource: Uri): Thenable<[Uri, FileStat][]>;

		// todo@remote
		// ? merge both
		// ? recursive del
80
		rmdir(resource: Uri): Thenable<void>;
81 82 83 84
		unlink(resource: Uri): Thenable<void>;

		// todo@remote
		// create(resource: Uri): Thenable<FileStat>;
85 86
	}

87 88 89 90 91 92 93 94 95 96 97 98 99 100
	export type DeprecatedFileChangeType = FileChangeType;
	export type DeprecatedFileType = FileType;
	export type DeprecatedFileChange = FileChange;
	export type DeprecatedFileStat = FileStat;
	export type DeprecatedFileSystemProvider = FileSystemProvider;

	export namespace workspace {
		export function registerDeprecatedFileSystemProvider(scheme: string, provider: DeprecatedFileSystemProvider): Disposable;
	}

	//#endregion

	//#region Joh: file system provider (new)

J
Johannes Rieken 已提交
101
	/**
102
	 *
J
Johannes Rieken 已提交
103 104
	 */
	export class FileError extends Error {
105

J
Johannes Rieken 已提交
106 107 108 109
		static EntryExists(message?: string): FileError;
		static EntryNotFound(message?: string): FileError;
		static EntryNotADirectory(message?: string): FileError;
		static EntryIsADirectory(message?: string): FileError;
110

J
Johannes Rieken 已提交
111 112
		constructor(message?: string);
	}
113

114 115 116 117 118 119 120 121
	export enum FileChangeType2 {
		Changed = 1,
		Created = 2,
		Deleted = 3,
	}

	export interface FileChange2 {
		type: FileChangeType2;
122
		uri: Uri;
123 124 125 126 127 128 129 130 131 132 133 134 135 136
	}

	export enum FileType2 {
		File = 0b001,
		Directory = 0b010,
		SymbolicLink = 0b100,
	}

	export interface FileStat2 {
		type: FileType2;
		mtime: number;
		size: number;
	}

137 138 139 140 141 142
	export enum FileOpenFlags {
		Read = 0b0001,
		Write = 0b0010,
		Create = 0b0100,
		Exclusive = 0b1000
	}
143

144 145 146
	/**
	 *
	 */
147 148
	export interface FileSystemProvider2 {

149
		_version: 8;
150

J
Johannes Rieken 已提交
151
		/**
152 153 154
		 * An event to signal that a resource has been created, changed, or deleted. This
		 * event should fire for resources that are being [watched](#FileSystemProvider2.watch)
		 * by clients of this provider.
J
Johannes Rieken 已提交
155
		 */
156 157 158
		readonly onDidChangeFile: Event<FileChange2[]>;

		/**
159 160 161
		 * Subscribe to events in the file or folder denoted by `uri`.
		 * @param uri
		 * @param options
162 163
		 */
		watch(uri: Uri, options: { recursive?: boolean; excludes?: string[] }): Disposable;
164

J
Johannes Rieken 已提交
165
		/**
166 167
		 * Retrieve metadata about a file. Throw an [`EntryNotFound`](#FileError.EntryNotFound)-error
		 * in case the file does not exist.
J
Johannes Rieken 已提交
168 169 170
		 *
		 * @param uri The uri of the file to retrieve meta data about.
		 * @param token A cancellation token.
J
Johannes Rieken 已提交
171
		 * @return The file metadata about the file.
J
Johannes Rieken 已提交
172
		 */
173
		stat(uri: Uri, options: { /*future: followSymlinks*/ }, token: CancellationToken): FileStat2 | Thenable<FileStat2>;
174

J
Johannes Rieken 已提交
175 176 177 178 179
		/**
		 * Retrieve the meta data of all entries of a [directory](#FileType2.Directory)
		 *
		 * @param uri The uri of the folder.
		 * @param token A cancellation token.
180
		 * @return A thenable that resolves to an array of tuples of file names and files stats.
J
Johannes Rieken 已提交
181
		 */
182
		readDirectory(uri: Uri, options: { /*future: onlyType?*/ }, token: CancellationToken): [string, FileStat2][] | Thenable<[string, FileStat2][]>;
183

184 185
		/**
		 * Create a new directory. *Note* that new files are created via `write`-calls.
186
		 *
187 188 189
		 * @param uri The uri of the *new* folder.
		 * @param token A cancellation token.
		 */
190
		createDirectory(uri: Uri, options: { /*future: permissions?*/ }, token: CancellationToken): FileStat2 | Thenable<FileStat2>;
191

J
Johannes Rieken 已提交
192 193 194 195 196 197 198
		/**
		 * Read the entire contents of a file.
		 *
		 * @param uri The uri of the file.
		 * @param token A cancellation token.
		 * @return A thenable that resolves to an array of bytes.
		 */
199
		readFile(uri: Uri, options: { flags: FileOpenFlags }, token: CancellationToken): Uint8Array | Thenable<Uint8Array>;
200

J
Johannes Rieken 已提交
201 202 203 204 205 206 207
		/**
		 * Write data to a file, replacing its entire contents.
		 *
		 * @param uri The uri of the file.
		 * @param content The new content of the file.
		 * @param token A cancellation token.
		 */
208
		writeFile(uri: Uri, content: Uint8Array, options: { flags: FileOpenFlags }, token: CancellationToken): void | Thenable<void>;
209

210
		/**
211 212
		 * Delete a file or folder from the underlying storage.
		 *
213 214 215 216 217 218
		 * @param uri The resource that is to be deleted
		 * @param options Options bag for future use
		 * @param token A cancellation token.
		 */
		delete(uri: Uri, options: { /*future: useTrash?, followSymlinks?*/ }, token: CancellationToken): void | Thenable<void>;

J
Johannes Rieken 已提交
219 220 221
		/**
		 * Rename a file or folder.
		 *
222 223
		 * @param oldUri The existing file or folder.
		 * @param newUri The target location.
J
Johannes Rieken 已提交
224 225
		 * @param token A cancellation token.
		 */
226
		rename(oldUri: Uri, newUri: Uri, options: { flags: FileOpenFlags }, token: CancellationToken): FileStat2 | Thenable<FileStat2>;
227

228 229 230 231 232 233 234 235 236
		/**
		 * Copy files or folders. Implementing this function is optional but it will speedup
		 * the copy operation.
		 *
		 * @param uri The existing file or folder.
		 * @param target The target location.
		 * @param token A cancellation token.
		 */
		copy?(uri: Uri, target: Uri, options: { flags: FileOpenFlags }, token: CancellationToken): FileStat2 | Thenable<FileStat2>;
237 238
	}

239
	export namespace workspace {
240
		export function registerFileSystemProvider(scheme: string, provider: FileSystemProvider, newProvider?: FileSystemProvider2): Disposable;
241
	}
J
Johannes Rieken 已提交
242

243 244 245 246 247 248
	//#endregion

	//#region Joh: remote, search provider

	export interface TextSearchQuery {
		pattern: string;
249
		isRegExp?: boolean;
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
		isCaseSensitive?: boolean;
		isWordMatch?: boolean;
	}

	export interface TextSearchOptions {
		includes: GlobPattern[];
		excludes: GlobPattern[];
	}

	export interface TextSearchResult {
		uri: Uri;
		range: Range;
		preview: { leading: string, matching: string, trailing: string };
	}

	export interface SearchProvider {
		provideFileSearchResults?(query: string, progress: Progress<Uri>, token: CancellationToken): Thenable<void>;
267
		provideTextSearchResults?(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): Thenable<void>;
268 269
	}

270
	export namespace workspace {
271
		export function registerSearchProvider(scheme: string, provider: SearchProvider): Disposable;
272 273
	}

J
Johannes Rieken 已提交
274
	//#endregion
275

J
Johannes Rieken 已提交
276
	//#region Joao: diff command
P
Pine Wu 已提交
277

J
Joao Moreno 已提交
278 279 280
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
281 282 283 284 285 286 287
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
	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;
	}
306

J
Johannes Rieken 已提交
307 308 309
	//#endregion

	//#region Joh: decorations
310 311 312 313 314

	//todo@joh -> make class
	export interface DecorationData {
		priority?: number;
		title?: string;
315
		bubble?: boolean;
316 317
		abbreviation?: string;
		color?: ThemeColor;
318
		source?: string;
319 320
	}

321 322 323 324 325 326
	export interface SourceControlResourceDecorations {
		source?: string;
		letter?: string;
		color?: ThemeColor;
	}

327
	export interface DecorationProvider {
328
		onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
329 330 331 332
		provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<DecorationData>;
	}

	export namespace window {
333
		export function registerDecorationProvider(provider: DecorationProvider): Disposable;
334 335 336
	}

	//#endregion
337

J
Johannes Rieken 已提交
338 339
	//#region André: debug

340 341 342 343 344 345
	/**
	 * Represents a debug adapter executable and optional arguments passed to it.
	 */
	export class DebugAdapterExecutable {
		/**
		 * The command path of the debug adapter executable.
A
Andre Weinand 已提交
346
		 * A command must be either an absolute path or the name of an executable looked up via the PATH environment variable.
347 348 349 350 351
		 * The special value 'node' will be mapped to VS Code's built-in node runtime.
		 */
		readonly command: string;

		/**
A
Andre Weinand 已提交
352
		 * Optional arguments passed to the debug adapter executable.
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
		 */
		readonly args: string[];

		/**
		 * Create a new debug adapter specification.
		 */
		constructor(command: string, args?: string[]);
	}

	export interface DebugConfigurationProvider {
		/**
		 * This optional method is called just before a debug adapter is started to determine its excutable path and arguments.
		 * Registering more than one debugAdapterExecutable for a type results in an error.
		 * @param folder The workspace folder from which the configuration originates from or undefined for a folderless setup.
		 * @param token A cancellation token.
		 * @return a [debug adapter's executable and optional arguments](#DebugAdapterExecutable) or undefined.
		 */
		debugAdapterExecutable?(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult<DebugAdapterExecutable>;
	}

J
Johannes Rieken 已提交
373 374 375 376
	//#endregion

	//#region Rob, Matt: logging

377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403
	/**
	 * The severity level of a log message
	 */
	export enum LogLevel {
		Trace = 1,
		Debug = 2,
		Info = 3,
		Warning = 4,
		Error = 5,
		Critical = 6,
		Off = 7
	}

	/**
	 * A logger for writing to an extension's log file, and accessing its dedicated log directory.
	 */
	export interface Logger {
		trace(message: string, ...args: any[]): void;
		debug(message: string, ...args: any[]): void;
		info(message: string, ...args: any[]): void;
		warn(message: string, ...args: any[]): void;
		error(message: string | Error, ...args: any[]): void;
		critical(message: string | Error, ...args: any[]): void;
	}

	export interface ExtensionContext {
		/**
R
Rob Lourens 已提交
404
		 * This extension's logger
405 406
		 */
		logger: Logger;
407 408 409 410 411 412 413

		/**
		 * Path where an extension can write log files.
		 *
		 * Extensions must create this directory before writing to it. The parent directory will always exist.
		 */
		readonly logDirectory: string;
414
	}
415

M
Matt Bierner 已提交
416 417 418 419 420 421 422 423 424
	export namespace env {
		/**
		 * Current logging level.
		 *
		 * @readonly
		 */
		export const logLevel: LogLevel;
	}

J
Johannes Rieken 已提交
425 426 427
	//#endregion

	//#region Joao: SCM validation
428

J
Joao Moreno 已提交
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473
	/**
	 * 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 已提交
474

J
Johannes Rieken 已提交
475 476 477 478
	//#endregion

	//#region Matt: WebView

M
Matt Bierner 已提交
479 480 481 482 483
	/**
	 * Content settings for a webview.
	 */
	export interface WebviewOptions {
		/**
484
		 * Should scripts be enabled in the webview content?
M
Matt Bierner 已提交
485 486 487 488 489 490
		 *
		 * Defaults to false (scripts-disabled).
		 */
		readonly enableScripts?: boolean;

		/**
M
Matt Bierner 已提交
491
		 * Should command uris be enabled in webview content?
M
Matt Bierner 已提交
492 493 494 495 496
		 *
		 * Defaults to false.
		 */
		readonly enableCommandUris?: boolean;

497
		/**
498
		 * Root paths from which the webview can load local (filesystem) resources using the `vscode-resource:` scheme.
499
		 *
500
		 * Default to the root folders of the current workspace plus the extension's install directory.
501 502 503
		 *
		 * Pass in an empty array to disallow access to any local resources.
		 */
504
		readonly localResourceRoots?: ReadonlyArray<Uri>;
M
Matt Bierner 已提交
505 506 507
	}

	/**
508
	 * A webview displays html content, like an iframe.
M
Matt Bierner 已提交
509 510 511 512 513
	 */
	export interface Webview {
		/**
		 * Content settings for the webview.
		 */
M
Matt Bierner 已提交
514 515 516 517 518 519 520 521 522 523 524 525 526
		readonly options: WebviewOptions;

		/**
		 * Title of the webview shown in UI.
		 */
		title: string;

		/**
		 * Contents of the webview.
		 *
		 * Should be a complete html document.
		 */
		html: string;
M
Matt Bierner 已提交
527

M
Matt Bierner 已提交
528
		/**
529
		 * Fired when the webview content posts a message.
M
Matt Bierner 已提交
530
		 */
531
		readonly onDidReceiveMessage: Event<any>;
M
Matt Bierner 已提交
532

M
Matt Bierner 已提交
533
		/**
534 535 536 537 538
		 * Post a message to the webview content.
		 *
		 * Messages are only develivered if the webview is visible.
		 *
		 * @param message Body of the message.
M
Matt Bierner 已提交
539
		 */
540 541 542 543
		postMessage(message: any): Thenable<boolean>;
	}

	/**
544
	 * Content settings for a webview panel.
545
	 */
546
	export interface WebviewPanelOptions {
547
		/**
548
		 * Should the find widget be enabled in the panel?
549 550 551 552
		 *
		 * Defaults to false.
		 */
		readonly enableFindWidget?: boolean;
M
Matt Bierner 已提交
553 554

		/**
555
		 * Should the webview panel's content (iframe) be kept around even when the panel
556 557
		 * is no longer visible?
		 *
558 559
		 * Normally the webview panel's html context is created when the panel becomes visible
		 * and destroyed when it is is hidden. Extensions that have complex state
560 561
		 * or UI can set the `retainContextWhenHidden` to make VS Code keep the webview
		 * context around, even when the webview moves to a background tab. When
562
		 * the panel becomes visible again, the context is automatically restored
563 564 565
		 * in the exact same state it was in originally.
		 *
		 * `retainContextWhenHidden` has a high memory overhead and should only be used if
566
		 * your panel's context cannot be quickly saved and restored.
M
Matt Bierner 已提交
567
		 */
568 569
		readonly retainContextWhenHidden?: boolean;
	}
M
Matt Bierner 已提交
570

571
	/**
572
	 * A panel that contains a webview.
573
	 */
574
	interface WebviewPanel {
M
Matt Bierner 已提交
575
		/**
576
		 * Type of the webview panel, such as `'markdown.preview'`.
M
Matt Bierner 已提交
577
		 */
578
		readonly viewType: string;
M
Matt Bierner 已提交
579 580

		/**
581
		 * Webview belonging to the panel.
582 583 584 585
		 */
		readonly webview: Webview;

		/**
586
		 * Content settings for the webview panel.
587
		 */
588
		readonly options: WebviewPanelOptions;
589 590

		/**
591
		 * Editor position of the panel.
592
		 */
593
		readonly position?: ViewColumn;
594

595 596 597 598 599
		/**
		 * Is the panel current visible?
		 */
		readonly visible: boolean;

600
		/**
601
		 * Fired when the panel's view state changes.
602
		 */
603
		readonly onDidChangeViewState: Event<WebviewPanelOnDidChangeViewStateEvent>;
604 605

		/**
606
		 * Fired when the panel is disposed.
M
Matt Bierner 已提交
607
		 *
608
		 * This may be because the user closed the panel or because `.dispose()` was
609
		 * called on it.
M
Matt Bierner 已提交
610
		 *
611
		 * Trying to use the panel after it has been disposed throws an exception.
M
Matt Bierner 已提交
612
		 */
613
		readonly onDidDispose: Event<void>;
M
Matt Bierner 已提交
614

615
		/**
616
		 * Show the webview panel in a given column.
617
		 *
618 619
		 * A webview panel may only show in a single column at a time. If it is already showing, this
		 * method moves it to a new column.
620
		 */
621
		reveal(viewColumn: ViewColumn): void;
622

M
Matt Bierner 已提交
623
		/**
624
		 * Dispose of the webview panel.
M
Matt Bierner 已提交
625
		 *
626 627 628
		 * This closes the panel if it showing and disposes of the resources owned by the webview.
		 * Webview panels are also disposed when the user closes the webview panel. Both cases
		 * fire the `onDispose` event.
M
Matt Bierner 已提交
629 630 631 632
		 */
		dispose(): any;
	}

633 634 635
	/**
	 * Event fired when a webview panel's view state changes.
	 */
636
	export interface WebviewPanelOnDidChangeViewStateEvent {
637
		/**
638
		 * Webview panel whose view state changed.
639 640
		 */
		readonly webviewPanel: WebviewPanel;
641 642
	}

643
	/**
644
	 * Save and restore webview panels that have been persisted when vscode shuts down.
645
	 */
646
	interface WebviewPanelSerializer {
647
		/**
648
		 * Save a webview panel's `state`.
649
		 *
650 651
		 * Called before shutdown. Extensions have a 250ms timeframe to return a state. If serialization
		 * takes longer than 250ms, the panel will not be serialized.
652
		 *
653
		 * @param webviewPanel webview Panel to serialize. May or may not be visible.
654 655 656
		 *
		 * @returns JSON serializable state blob.
		 */
657
		serializeWebviewPanel(webviewPanel: WebviewPanel): Thenable<any>;
658 659

		/**
660
		 * Restore a webview panel from its seriailzed `state`.
661
		 *
662
		 * Called when a serialized webview first becomes visible.
663
		 *
664
		 * @param webviewPanel Webview panel to restore. The serializer should take ownership of this panel.
665
		 * @param state Persisted state.
666 667
		 *
		 * @return Thanble indicating that the webview has been fully restored.
668
		 */
669
		deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any): Thenable<void>;
670 671
	}

M
Matt Bierner 已提交
672 673
	namespace window {
		/**
674
		 * Create and show a new webview panel.
M
Matt Bierner 已提交
675
		 *
676
		 * @param viewType Identifies the type of the webview panel.
677 678
		 * @param title Title of the panel.
		 * @param position Editor column to show the new panel in.
679
		 * @param options Settings for the new webview panel.
680 681
		 *
		 * @return New webview panel.
M
Matt Bierner 已提交
682
		 */
683
		export function createWebviewPanel(viewType: string, title: string, position: ViewColumn, options: WebviewPanelOptions & WebviewOptions): WebviewPanel;
684 685

		/**
686
		 * Registers a webview panel serializer.
687 688
		 *
		 * Extensions that support reviving should have an `"onView:viewType"` activation method and
689
		 * make sure that [registerWebviewPanelSerializer](#registerWebviewPanelSerializer) is called during activation.
690 691 692
		 *
		 * Only a single serializer may be registered at a time for a given `viewType`.
		 *
693
		 * @param viewType Type of the webview panel that can be serialized.
694 695
		 * @param reviver Webview serializer.
		 */
696
		export function registerWebviewPanelSerializer(viewType: string, reviver: WebviewPanelSerializer): Disposable;
M
Matt Bierner 已提交
697
	}
S
Sandeep Somavarapu 已提交
698

J
Johannes Rieken 已提交
699 700
	//#endregion

701 702 703
	//#region Tasks

	/**
704 705
	 * An object representing an executed Task. It can be used
	 * to terminate a task.
D
Dirk Baeumer 已提交
706 707
	 *
	 * This interface is not intended to be implemented.
708
	 */
709
	export interface TaskExecution {
D
Dirk Baeumer 已提交
710 711 712 713 714 715 716 717 718
		/**
		 * The task that got started.
		 */
		task: Task;

		/**
		 * Terminates the task execution.
		 */
		terminate(): void;
719 720 721 722
	}

	/**
	 * An event signaling the start of a task execution.
D
Dirk Baeumer 已提交
723 724
	 *
	 * This interface is not intended to be implemented.
725 726 727 728 729 730 731 732 733 734
	 */
	interface TaskStartEvent {
		/**
		 * The task item representing the task that got started.
		 */
		execution: TaskExecution;
	}

	/**
	 * An event signaling the end of an executed task.
D
Dirk Baeumer 已提交
735 736
	 *
	 * This interface is not intended to be implemented.
737 738 739 740 741 742 743 744 745
	 */
	interface TaskEndEvent {
		/**
		 * The task item representing the task that finished.
		 */
		execution: TaskExecution;
	}

	export namespace workspace {
746 747

		/**
748
		 * Fetches all task available in the systems. Thisweweb includes tasks
749 750
		 * from `tasks.json` files as well as tasks from task providers
		 * contributed through extensions.
751
		 */
752
		export function fetchTasks(): Thenable<Task[]>;
753 754

		/**
755 756 757 758
		 * Executes a task that is managed by VS Code. The returned
		 * task execution can be used to terminate the task.
		 *
		 * @param task the task to execute
759
		 */
760
		export function executeTask(task: Task): Thenable<TaskExecution>;
D
Dirk Baeumer 已提交
761 762

		/**
763 764 765 766
		 * Fires when a task starts.
		 */
		export const onDidStartTask: Event<TaskStartEvent>;

767
		/**
768
		 * Fires when a task ends.
769
		 */
770
		export const onDidEndTask: Event<TaskEndEvent>;
771 772 773
	}

	//#endregion
774 775 776 777

	//#region Terminal

	export namespace window {
D
Daniel Imms 已提交
778
		/**
D
jsdoc  
Daniel Imms 已提交
779 780
		 * The currently active terminals or an empty array.
		 *
D
Daniel Imms 已提交
781 782 783 784
		 * @readonly
		 */
		export let terminals: Terminal[];

D
jsdoc  
Daniel Imms 已提交
785 786 787 788
		/**
		 * An [event](#Event) which fires when a terminal has been created, either through the
		 * [createTerminal](#window.createTerminal) API or commands.
		 */
789 790 791 792
		export const onDidOpenTerminal: Event<Terminal>;
	}

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