vscode.proposed.d.ts 20.5 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 14 15
	export namespace window {
		export function sampleFunction(): Thenable<any>;
	}

	//#region Aeschli: folding

16 17 18 19 20 21 22 23
	export class FoldingRangeList {

		/**
		 * The folding ranges.
		 */
		ranges: FoldingRange[];

		/**
Y
Yemi Bedu @ P&amp;R 已提交
24
		 * Creates new folding range list.
25 26 27 28 29 30 31 32 33 34
		 *
		 * @param ranges The folding ranges
		 */
		constructor(ranges: FoldingRange[]);
	}


	export class FoldingRange {

		/**
M
Martin Aeschlimann 已提交
35
		 * The start line number (zero-based) of the range to fold. The hidden area starts after the last character of that line.
36 37 38 39
		 */
		startLine: number;

		/**
M
Martin Aeschlimann 已提交
40
		 * The end line number (0-based) of the range to fold. The hidden area ends at the last character of that line.
41 42 43 44 45 46 47 48 49 50 51 52 53 54
		 */
		endLine: number;

		/**
		 * The actual color value for this color range.
		 */
		type?: FoldingRangeType | string;

		/**
		 * Creates a new folding range.
		 *
		 * @param startLineNumber The first line of the fold
		 * @param type The last line of the fold
		 */
55
		constructor(startLineNumber: number, endLineNumber: number, type?: FoldingRangeType | string);
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
	}

	export enum FoldingRangeType {
		/**
		 * Folding range for a comment
		 */
		Comment = 'comment',
		/**
		 * Folding range for a imports or includes
		 */
		Imports = 'imports',
		/**
		 * Folding range for a region (e.g. `#region`)
		 */
		Region = 'region'
	}

J
Johannes Rieken 已提交
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
	export namespace languages {

		/**
		 * Register a folding provider.
		 *
		 * Multiple folding 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 A folding provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
		export function registerFoldingProvider(selector: DocumentSelector, provider: FoldingProvider): Disposable;
	}

	export interface FoldingContext {
		maxRanges?: number;
	}

	export interface FoldingProvider {
		/**
		 * Returns a list of folding ranges or null if the provider does not want to participate or was cancelled.
		 */
		provideFoldingRanges(document: TextDocument, context: FoldingContext, token: CancellationToken): ProviderResult<FoldingRangeList>;
	}

	//#endregion

	//#region Joh: file system provider

104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
	// export enum FileErrorCodes {
	// 	/**
	// 	 * Not owner.
	// 	 */
	// 	EPERM = 1,
	// 	/**
	// 	 * No such file or directory.
	// 	 */
	// 	ENOENT = 2,
	// 	/**
	// 	 * I/O error.
	// 	 */
	// 	EIO = 5,
	// 	/**
	// 	 * Permission denied.
	// 	 */
	// 	EACCES = 13,
	// 	/**
	// 	 * File exists.
	// 	 */
	// 	EEXIST = 17,
	// 	/**
	// 	 * Not a directory.
	// 	 */
	// 	ENOTDIR = 20,
	// 	/**
	// 	 * Is a directory.
	// 	 */
	// 	EISDIR = 21,
	// 	/**
	// 	 *  File too large.
	// 	 */
	// 	EFBIG = 27,
	// 	/**
	// 	 * No space left on device.
	// 	 */
	// 	ENOSPC = 28,
	// 	/**
	// 	 * Directory is not empty.
	// 	 */
	// 	ENOTEMPTY = 66,
	// 	/**
	// 	 * Invalid file handle.
	// 	 */
	// 	ESTALE = 70,
	// 	/**
	// 	 * Illegal NFS file handle.
	// 	 */
	// 	EBADHANDLE = 10001,
	// }

155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
	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 {
173
		id: number | string;
174
		mtime: number;
J
Johannes Rieken 已提交
175
		// atime: number;
176 177 178 179
		size: number;
		type: FileType;
	}

J
Johannes Rieken 已提交
180
	// todo@joh discover files etc
J
Johannes Rieken 已提交
181
	// todo@joh CancellationToken everywhere
J
Johannes Rieken 已提交
182
	// todo@joh add open/close calls?
J
Johannes Rieken 已提交
183
	export interface FileSystemProvider {
D
Dirk Baeumer 已提交
184

J
Johannes Rieken 已提交
185
		readonly onDidChange?: Event<FileChange[]>;
186 187

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

191
		stat(resource: Uri): Thenable<FileStat>;
192

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

J
Johannes Rieken 已提交
195
		// todo@joh - have an option to create iff not exist
196 197 198 199
		// todo@remote
		// offset - byte offset to start
		// count - number of bytes to write
		// Thenable<number> - number of bytes actually written
200
		write(resource: Uri, content: Uint8Array): Thenable<void>;
201 202 203

		// todo@remote
		// Thenable<FileStat>
204 205 206 207 208
		move(resource: Uri, target: Uri): Thenable<FileStat>;

		// todo@remote
		// helps with performance bigly
		// copy?(from: Uri, to: Uri): Thenable<void>;
209 210 211

		// todo@remote
		// Thenable<FileStat>
212
		mkdir(resource: Uri): Thenable<FileStat>;
213

214 215 216 217 218
		readdir(resource: Uri): Thenable<[Uri, FileStat][]>;

		// todo@remote
		// ? merge both
		// ? recursive del
219
		rmdir(resource: Uri): Thenable<void>;
220 221 222 223
		unlink(resource: Uri): Thenable<void>;

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

226 227 228 229 230 231 232 233 234
	// todo@joh discover files etc
	// todo@joh CancellationToken everywhere
	// todo@joh add open/close calls?
	export interface FileSystemProvider2 {

		_version: 2;

		readonly onDidChange?: Event<FileChange[]>;

J
Johannes Rieken 已提交
235
		stat(uri: Uri, token: CancellationToken): Thenable<FileStat>;
236

J
Johannes Rieken 已提交
237
		readdir(uri: Uri, token: CancellationToken): Thenable<[Uri, FileStat][]>;
238

J
Johannes Rieken 已提交
239
		readFile(uri: Uri, token: CancellationToken): Thenable<Uint8Array>;
240

J
Johannes Rieken 已提交
241
		writeFile(uri: Uri, content: Uint8Array, token: CancellationToken): Thenable<void>;
242 243 244

		// todo@remote
		// Thenable<FileStat>
J
Johannes Rieken 已提交
245
		rename(oldUri: Uri, newUri: Uri): Thenable<FileStat>;
246 247 248 249 250 251 252 253 254 255 256 257 258

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

		// todo@remote
		// ? useTrash, expose trash
		delete(resource: Uri, options: { recursive?: boolean; }): Thenable<void>;

		// todo@remote
		create(resource: Uri, options: { type: FileType }): Thenable<FileStat>;
	}

259
	export namespace workspace {
260
		export function registerFileSystemProvider(scheme: string, provider: FileSystemProvider, newProvider?: FileSystemProvider2): Disposable;
261
	}
J
Johannes Rieken 已提交
262

263 264 265 266 267 268
	//#endregion

	//#region Joh: remote, search provider

	export interface TextSearchQuery {
		pattern: string;
269
		isRegExp?: boolean;
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
		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>;
287
		provideTextSearchResults?(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): Thenable<void>;
288 289
	}

290
	export namespace workspace {
291
		export function registerSearchProvider(scheme: string, provider: SearchProvider): Disposable;
292 293
	}

J
Johannes Rieken 已提交
294
	//#endregion
295

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

J
Joao Moreno 已提交
298 299 300
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
301 302 303 304 305 306 307
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
	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;
	}
326

J
Johannes Rieken 已提交
327 328 329
	//#endregion

	//#region Joh: decorations
330 331 332 333 334

	//todo@joh -> make class
	export interface DecorationData {
		priority?: number;
		title?: string;
335
		bubble?: boolean;
336 337
		abbreviation?: string;
		color?: ThemeColor;
338
		source?: string;
339 340
	}

341 342 343 344 345 346
	export interface SourceControlResourceDecorations {
		source?: string;
		letter?: string;
		color?: ThemeColor;
	}

347
	export interface DecorationProvider {
348
		onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
349 350 351 352
		provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<DecorationData>;
	}

	export namespace window {
353
		export function registerDecorationProvider(provider: DecorationProvider): Disposable;
354 355 356
	}

	//#endregion
357

J
Johannes Rieken 已提交
358 359
	//#region André: debug

360 361 362 363 364 365
	/**
	 * 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 已提交
366
		 * A command must be either an absolute path or the name of an executable looked up via the PATH environment variable.
367 368 369 370 371
		 * The special value 'node' will be mapped to VS Code's built-in node runtime.
		 */
		readonly command: string;

		/**
A
Andre Weinand 已提交
372
		 * Optional arguments passed to the debug adapter executable.
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392
		 */
		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 已提交
393 394 395 396
	//#endregion

	//#region Rob, Matt: logging

397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
	/**
	 * 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 已提交
424
		 * This extension's logger
425 426
		 */
		logger: Logger;
427 428 429 430 431 432 433

		/**
		 * 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;
434
	}
435

M
Matt Bierner 已提交
436 437 438 439 440 441 442 443 444
	export namespace env {
		/**
		 * Current logging level.
		 *
		 * @readonly
		 */
		export const logLevel: LogLevel;
	}

J
Johannes Rieken 已提交
445 446 447 448
	//#endregion

	//#region Joh: rename context

449 450 451
	export interface RenameProvider2 extends RenameProvider {

		/**
J
Johannes Rieken 已提交
452 453 454 455 456 457
		 * Optional function for resolving and validating a position at which rename is
		 * being carried out.
		 *
		 * @param document The document in which rename will be invoked.
		 * @param position The position at which rename will be invoked.
		 * @param token A cancellation token.
458
		 * @return The range of the identifier that is to be renamed. The lack of a result can signaled by returning `undefined` or `null`.
459
		 */
460
		resolveRenameLocation?(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Range>;
J
Johannes Rieken 已提交
461

462 463
	}

J
Johannes Rieken 已提交
464
	//#endregion
M
Martin Aeschlimann 已提交
465

J
Johannes Rieken 已提交
466
	//#region Joao: SCM validation
467

J
Joao Moreno 已提交
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
	/**
	 * 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 已提交
513

J
Johannes Rieken 已提交
514 515 516 517
	//#endregion

	//#region Matt: WebView

M
Matt Bierner 已提交
518 519 520 521 522
	/**
	 * Content settings for a webview.
	 */
	export interface WebviewOptions {
		/**
523
		 * Should scripts be enabled in the webview content?
M
Matt Bierner 已提交
524 525 526 527 528 529
		 *
		 * Defaults to false (scripts-disabled).
		 */
		readonly enableScripts?: boolean;

		/**
M
Matt Bierner 已提交
530
		 * Should command uris be enabled in webview content?
M
Matt Bierner 已提交
531 532 533 534 535
		 *
		 * Defaults to false.
		 */
		readonly enableCommandUris?: boolean;

536 537 538 539 540 541 542
		/**
		 * Should the find widget be enabled in the webview?
		 *
		 * Defaults to false.
		 */
		readonly enableFindWidget?: boolean;

M
Matt Bierner 已提交
543
		/**
544
		 * Should the webview's context be kept around even when the webview is no longer visible?
M
Matt Bierner 已提交
545
		 *
546
		 * Normally a webview's context is created when the webview becomes visible
M
Matt Bierner 已提交
547
		 * and destroyed when the webview is hidden. Apps that have complex state
548 549 550 551
		 * 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
		 * the webview becomes visible again, the context is automatically restored
		 * in the exact same state it was in originally.
M
Matt Bierner 已提交
552
		 *
553
		 * `retainContextWhenHidden` has a high memory overhead and should only be used if
554
		 * your webview's context cannot be quickly saved and restored.
M
Matt Bierner 已提交
555
		 */
556
		readonly retainContextWhenHidden?: boolean;
557 558

		/**
559
		 * Root paths from which the webview can load local (filesystem) resources using the `vscode-resource:` scheme.
560
		 *
561
		 * Default to the root folders of the current workspace plus the extension's install directory.
562 563 564 565
		 *
		 * Pass in an empty array to disallow access to any local resources.
		 */
		readonly localResourceRoots?: Uri[];
M
Matt Bierner 已提交
566 567
	}

M
Matt Bierner 已提交
568
	export interface WebviewOnDidChangeViewStateEvent {
569 570 571 572
		readonly viewColumn: ViewColumn;
		readonly active: boolean;
	}

M
Matt Bierner 已提交
573
	/**
574
	 * A webview displays html content, like an iframe.
M
Matt Bierner 已提交
575 576 577
	 */
	export interface Webview {
		/**
578
		 * The type of the webview, such as `'markdown.preview'`
M
Matt Bierner 已提交
579
		 */
580
		readonly viewType: string;
M
Matt Bierner 已提交
581 582 583 584

		/**
		 * Content settings for the webview.
		 */
M
Matt Bierner 已提交
585 586 587 588 589 590 591 592 593 594 595 596 597
		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 已提交
598

M
Matt Bierner 已提交
599 600 601 602 603
		/**
		 * The column in which the webview is showing.
		 */
		readonly viewColumn?: ViewColumn;

M
Matt Bierner 已提交
604 605 606
		/**
		 * Fired when the webview content posts a message.
		 */
607
		readonly onDidReceiveMessage: Event<any>;
M
Matt Bierner 已提交
608 609

		/**
M
Matt Bierner 已提交
610
		 * Fired when the webview is disposed.
M
Matt Bierner 已提交
611
		 */
612
		readonly onDidDispose: Event<void>;
M
Matt Bierner 已提交
613 614

		/**
615
		 * Fired when the webview's view state changes.
M
Matt Bierner 已提交
616
		 */
M
Matt Bierner 已提交
617
		readonly onDidChangeViewState: Event<WebviewOnDidChangeViewStateEvent>;
M
Matt Bierner 已提交
618 619 620 621 622 623 624 625

		/**
		 * 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 已提交
626
		postMessage(message: any): Thenable<boolean>;
M
Matt Bierner 已提交
627

628 629 630
		/**
		 * Shows the webview in a given column.
		 *
631
		 * A webview may only be in a single column at a time. If it is already showing, this
632 633
		 * command moves it to a new column.
		 */
634
		reveal(viewColumn: ViewColumn): void;
635

M
Matt Bierner 已提交
636
		/**
M
Matt Bierner 已提交
637 638 639 640 641
		 * Dispose of the the webview.
		 *
		 * This closes the webview if it showing and disposes of the resources owned by the webview.
		 * Webview are also disposed when the user closes the webview editor. Both cases fire `onDispose`
		 * event. Trying to use the webview after it has been disposed throws an exception.
M
Matt Bierner 已提交
642 643 644 645
		 */
		dispose(): any;
	}

646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668
	/**
	 * Save and restore webviews that have been persisted when vscode shuts down.
	 */
	interface WebviewSerializer {
		/**
		 * Save a webview's `state`.
		 *
		 * Called before shutdown. Webview may or may not be visible.
		 *
		 * @param webview Webview to serialize.
		 *
		 * @returns JSON serializable state blob.
		 */
		serializeWebview(webview: Webview): Thenable<any>;

		/**
		 * Restore a webview from its `state`.
		 *
		 * Called when a serialized webview first becomes active.
		 *
		 * @param webview Webview to restore. The serializer should take ownership of this webview.
		 * @param state Persisted state.
		 */
669
		deserializeWebview(webview: Webview, state: any): Thenable<void>;
670 671
	}

M
Matt Bierner 已提交
672 673 674 675
	namespace window {
		/**
		 * Create and show a new webview.
		 *
676
		 * @param viewType Identifies the type of the webview.
M
Matt Bierner 已提交
677
		 * @param title Title of the webview.
M
Matt Bierner 已提交
678
		 * @param column Editor column to show the new webview in.
M
Matt Bierner 已提交
679 680
		 * @param options Content settings for the webview.
		 */
681
		export function createWebview(viewType: string, title: string, column: ViewColumn, options: WebviewOptions): Webview;
682 683 684 685 686 687 688 689 690 691 692 693 694

		/**
		 * Registers a webview serializer.
		 *
		 * Extensions that support reviving should have an `"onView:viewType"` activation method and
		 * make sure that `registerWebviewSerializer` is called during activation.
		 *
		 * Only a single serializer may be registered at a time for a given `viewType`.
		 *
		 * @param viewType Type of the webview that can be serialized.
		 * @param reviver Webview serializer.
		 */
		export function registerWebviewSerializer(viewType: string, reviver: WebviewSerializer): Disposable;
M
Matt Bierner 已提交
695
	}
S
Sandeep Somavarapu 已提交
696

J
Johannes Rieken 已提交
697 698
	//#endregion

699 700 701
	//#region Tasks

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

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

	/**
	 * An event signaling the start of a task execution.
D
Dirk Baeumer 已提交
721 722
	 *
	 * This interface is not intended to be implemented.
723 724 725 726 727 728 729 730 731 732
	 */
	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 已提交
733 734
	 *
	 * This interface is not intended to be implemented.
735 736 737 738 739 740 741 742 743
	 */
	interface TaskEndEvent {
		/**
		 * The task item representing the task that finished.
		 */
		execution: TaskExecution;
	}

	export namespace workspace {
744 745

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

		/**
753 754 755 756
		 * 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
757
		 */
758
		export function executeTask(task: Task): Thenable<TaskExecution>;
D
Dirk Baeumer 已提交
759 760

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

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

	//#endregion
M
Matt Bierner 已提交
772

773 774 775 776 777 778
	interface CommentInfo {
		threads: CommentThread[];
		commentingRanges?: Range[];
		reply?: Command;
	}

M
Matt Bierner 已提交
779
	interface CommentThread {
780
		threadId: string;
781
		resource: Uri;
M
Matt Bierner 已提交
782 783
		range: Range;
		comments: Comment[];
P
Peng Lyu 已提交
784
		reply?: Command;
M
Matt Bierner 已提交
785 786 787
	}

	interface Comment {
P
Peng Lyu 已提交
788
		commentId: string;
M
Matt Bierner 已提交
789 790
		body: MarkdownString;
		userName: string;
791
		gravatar: string;
M
Matt Bierner 已提交
792 793
	}

794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810
	export interface CommentThreadChangedEvent {
		/**
		 * Added comment threads.
		 */
		readonly added: CommentThread[];

		/**
		 * Removed comment threads.
		 */
		readonly removed: CommentThread[];

		/**
		 * Changed comment threads.
		 */
		readonly changed: CommentThread[];
	}

M
Matt Bierner 已提交
811 812 813 814 815
	/**
	 * TODO: force update event?
	 * TODO: resolve step?
	 */
	interface CommentProvider {
816
		provideComments(document: TextDocument, token: CancellationToken): Promise<CommentInfo>;
817
		provideAllComments?(token: CancellationToken): Promise<CommentThread[]>;
818
		onDidChangeCommentThreads?: Event<CommentThreadChangedEvent>;
M
Matt Bierner 已提交
819 820 821 822 823
	}

	namespace workspace {
		export function registerCommentProvider(provider: CommentProvider): Disposable;
	}
J
Johannes Rieken 已提交
824
}