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

	//#region Joh: readable diagnostics
15

16 17 18 19
	export interface DiagnosticChangeEvent {
		uris: Uri[];
	}

20
	export namespace languages {
21 22 23 24

		/**
		 *
		 */
25
		export const onDidChangeDiagnostics: Event<DiagnosticChangeEvent>;
26

27 28 29
		/**
		 *
		 */
30 31 32 33 34 35
		export function getDiagnostics(resource: Uri): Diagnostic[];

		/**
		 *
		 */
		export function getDiagnostics(): [Uri, Diagnostic[]][];
36 37 38 39
	}

	//#endregion

J
Johannes Rieken 已提交
40 41
	//#region Aeschli: folding

42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
	export class FoldingRangeList {

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

		/**
		 * Creates mew folding range list.
		 *
		 * @param ranges The folding ranges
		 */
		constructor(ranges: FoldingRange[]);
	}


	export class FoldingRange {

		/**
M
Martin Aeschlimann 已提交
61
		 * The start line number (zero-based) of the range to fold. The hidden area starts after the last character of that line.
62 63 64 65
		 */
		startLine: number;

		/**
M
Martin Aeschlimann 已提交
66
		 * The end line number (0-based) of the range to fold. The hidden area ends at the last character of that line.
67 68 69 70 71 72 73 74 75 76 77 78 79 80
		 */
		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
		 */
81
		constructor(startLineNumber: number, endLineNumber: number, type?: FoldingRangeType | string);
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
	}

	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 已提交
99 100 101 102 103 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
	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

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 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
	// 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,
	// }

181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
	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 {
199
		id: number | string;
200
		mtime: number;
J
Johannes Rieken 已提交
201
		// atime: number;
202 203 204 205
		size: number;
		type: FileType;
	}

J
Johannes Rieken 已提交
206
	// todo@joh discover files etc
J
Johannes Rieken 已提交
207
	// todo@joh CancellationToken everywhere
J
Johannes Rieken 已提交
208
	// todo@joh add open/close calls?
J
Johannes Rieken 已提交
209
	export interface FileSystemProvider {
D
Dirk Baeumer 已提交
210

J
Johannes Rieken 已提交
211
		readonly onDidChange?: Event<FileChange[]>;
212 213 214

		// more...
		//
J
Johannes Rieken 已提交
215
		utimes(resource: Uri, mtime: number, atime: number): Thenable<FileStat>;
216

217
		stat(resource: Uri): Thenable<FileStat>;
218

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

J
Johannes Rieken 已提交
221
		// todo@joh - have an option to create iff not exist
222 223 224 225
		// todo@remote
		// offset - byte offset to start
		// count - number of bytes to write
		// Thenable<number> - number of bytes actually written
226
		write(resource: Uri, content: Uint8Array): Thenable<void>;
227 228 229

		// todo@remote
		// Thenable<FileStat>
230 231 232 233 234
		move(resource: Uri, target: Uri): Thenable<FileStat>;

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

		// todo@remote
		// Thenable<FileStat>
238
		mkdir(resource: Uri): Thenable<FileStat>;
239

240 241 242 243 244
		readdir(resource: Uri): Thenable<[Uri, FileStat][]>;

		// todo@remote
		// ? merge both
		// ? recursive del
245
		rmdir(resource: Uri): Thenable<void>;
246 247 248 249
		unlink(resource: Uri): Thenable<void>;

		// todo@remote
		// create(resource: Uri): Thenable<FileStat>;
250 251 252 253 254
	}

	export namespace workspace {
		export function registerFileSystemProvider(scheme: string, provider: FileSystemProvider): Disposable;
	}
J
Johannes Rieken 已提交
255

256 257 258 259 260 261
	//#endregion

	//#region Joh: remote, search provider

	export interface TextSearchQuery {
		pattern: string;
262
		isRegExp?: boolean;
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
		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>;
280
		provideTextSearchResults?(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): Thenable<void>;
281 282
	}

283
	export namespace workspace {
284
		export function registerSearchProvider(scheme: string, provider: SearchProvider): Disposable;
285 286
	}

J
Johannes Rieken 已提交
287
	//#endregion
288

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

J
Joao Moreno 已提交
291 292 293
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
294 295 296 297 298 299 300
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
	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;
	}
319

J
Johannes Rieken 已提交
320 321 322
	//#endregion

	//#region Joh: decorations
323 324 325 326 327

	//todo@joh -> make class
	export interface DecorationData {
		priority?: number;
		title?: string;
328
		bubble?: boolean;
329 330
		abbreviation?: string;
		color?: ThemeColor;
331
		source?: string;
332 333
	}

334 335 336 337 338 339
	export interface SourceControlResourceDecorations {
		source?: string;
		letter?: string;
		color?: ThemeColor;
	}

340
	export interface DecorationProvider {
341
		onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
342 343 344 345
		provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<DecorationData>;
	}

	export namespace window {
346
		export function registerDecorationProvider(provider: DecorationProvider): Disposable;
347 348 349
	}

	//#endregion
350

J
Johannes Rieken 已提交
351 352
	//#region André: debug

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

		/**
A
Andre Weinand 已提交
365
		 * Optional arguments passed to the debug adapter executable.
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
		 */
		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>;
	}

386 387 388 389 390 391 392
	export interface Breakpoint {
		/**
		 * An optional message that gets logged when this breakpoint is hit.
		 */
		readonly logMessage?: string;
	}

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

J
Johannes Rieken 已提交
449 450
	export interface RenameContext {
		range?: Range;
451
		newName?: string;
J
Johannes Rieken 已提交
452
		message?: string;
453 454 455 456 457
	}

	export interface RenameProvider2 extends RenameProvider {

		/**
J
Johannes Rieken 已提交
458 459 460 461 462 463 464
		 * 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.
		 * @return A `RenameContext` with more information. The lack of a result can signaled by returning `undefined` or `null`.
465
		 */
J
Johannes Rieken 已提交
466 467
		resolveRenameLocation?(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<RenameContext>;

468 469
	}

J
Johannes Rieken 已提交
470
	//#endregion
M
Martin Aeschlimann 已提交
471

J
Johannes Rieken 已提交
472
	//#region Joao: SCM validation
473

J
Joao Moreno 已提交
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 513 514 515 516 517 518
	/**
	 * 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 已提交
519

J
Johannes Rieken 已提交
520 521 522 523
	//#endregion

	//#region Matt: WebView

M
Matt Bierner 已提交
524 525 526 527 528
	/**
	 * Content settings for a webview.
	 */
	export interface WebviewOptions {
		/**
529
		 * Should scripts be enabled in the webview content?
M
Matt Bierner 已提交
530 531 532 533 534 535
		 *
		 * Defaults to false (scripts-disabled).
		 */
		readonly enableScripts?: boolean;

		/**
M
Matt Bierner 已提交
536
		 * Should command uris be enabled in webview content?
M
Matt Bierner 已提交
537 538 539 540 541
		 *
		 * Defaults to false.
		 */
		readonly enableCommandUris?: boolean;

542 543 544 545 546 547 548
		/**
		 * Should the find widget be enabled in the webview?
		 *
		 * Defaults to false.
		 */
		readonly enableFindWidget?: boolean;

M
Matt Bierner 已提交
549
		/**
550
		 * Should the webview's context be kept around even when the webview is no longer visible?
M
Matt Bierner 已提交
551
		 *
552
		 * Normally a webview's context is created when the webview becomes visible
M
Matt Bierner 已提交
553
		 * and destroyed when the webview is hidden. Apps that have complex state
554 555 556 557
		 * 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 已提交
558
		 *
559
		 * `retainContextWhenHidden` has a high memory overhead and should only be used if
560
		 * your webview's context cannot be quickly saved and restored.
M
Matt Bierner 已提交
561
		 */
562
		readonly retainContextWhenHidden?: boolean;
563 564

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

574 575 576 577 578
	export interface WebViewOnDidChangeViewStateEvent {
		readonly viewColumn: ViewColumn;
		readonly active: boolean;
	}

M
Matt Bierner 已提交
579
	/**
580
	 * A webview displays html content, like an iframe.
M
Matt Bierner 已提交
581 582 583
	 */
	export interface Webview {
		/**
584
		 * The type of the webview, such as `'markdownw.preview'`
M
Matt Bierner 已提交
585
		 */
586
		readonly viewType: string;
M
Matt Bierner 已提交
587 588 589 590

		/**
		 * Content settings for the webview.
		 */
M
Matt Bierner 已提交
591 592 593 594 595 596 597 598 599 600 601 602 603
		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 已提交
604

M
Matt Bierner 已提交
605 606 607 608 609
		/**
		 * The column in which the webview is showing.
		 */
		readonly viewColumn?: ViewColumn;

M
Matt Bierner 已提交
610 611 612
		/**
		 * Fired when the webview content posts a message.
		 */
613
		readonly onDidReceiveMessage: Event<any>;
M
Matt Bierner 已提交
614 615

		/**
M
Matt Bierner 已提交
616
		 * Fired when the webview is disposed.
M
Matt Bierner 已提交
617
		 */
618
		readonly onDidDispose: Event<void>;
M
Matt Bierner 已提交
619 620

		/**
621
		 * Fired when the webview's view state changes.
M
Matt Bierner 已提交
622
		 */
623
		readonly onDidChangeViewState: Event<WebViewOnDidChangeViewStateEvent>;
M
Matt Bierner 已提交
624 625 626 627 628 629 630 631

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

634 635 636 637 638 639 640 641
		/**
		 * Shows the webview in a given column.
		 *
		 * A webview may only show in a single column at a time. If it is already showing, this
		 * command moves it to a new column.
		 */
		show(viewColumn: ViewColumn): void;

M
Matt Bierner 已提交
642
		/**
M
Matt Bierner 已提交
643 644 645 646 647
		 * 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 已提交
648 649 650 651 652 653 654 655
		 */
		dispose(): any;
	}

	namespace window {
		/**
		 * Create and show a new webview.
		 *
656
		 * @param viewType Identifier the type of the webview.
M
Matt Bierner 已提交
657
		 * @param title Title of the webview.
M
Matt Bierner 已提交
658
		 * @param column Editor column to show the new webview in.
M
Matt Bierner 已提交
659 660
		 * @param options Content settings for the webview.
		 */
661
		export function createWebview(viewType: string, title: string, column: ViewColumn, options: WebviewOptions): Webview;
M
Matt Bierner 已提交
662
	}
S
Sandeep Somavarapu 已提交
663

J
Johannes Rieken 已提交
664 665 666 667
	//#endregion

	//#region Sandeep: TreeView

S
Sandeep Somavarapu 已提交
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687
	export namespace window {

		/**
		 * Register a [TreeDataProvider](#TreeDataProvider) for the view contributed using the extension point `views`.
		 * @param viewId Id of the view contributed using the extension point `views`.
		 * @param treeDataProvider A [TreeDataProvider](#TreeDataProvider) that provides tree data for the view
		 * @return handle to the [treeview](#TreeView) that can be disposable.
		 */
		export function registerTreeDataProvider<T>(viewId: string, treeDataProvider: TreeDataProvider<T>): TreeView<T>;

	}

	/**
	 * Represents a Tree view
	 */
	export interface TreeView<T> extends Disposable {

		/**
		 * Reveal an element. By default revealed element is selected.
		 *
S
Sandeep Somavarapu 已提交
688
		 * In order to not to select, set the option `select` to `false`.
S
Sandeep Somavarapu 已提交
689 690 691
		 *
		 * **NOTE:** [TreeDataProvider](#TreeDataProvider) is required to implement [getParent](#TreeDataProvider.getParent) method to access this API.
		 */
S
Sandeep Somavarapu 已提交
692
		reveal(element: T, options?: { select?: boolean }): Thenable<void>;
S
Sandeep Somavarapu 已提交
693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732
	}

	/**
	 * A data provider that provides tree data
	 */
	export interface TreeDataProvider<T> {
		/**
		 * An optional event to signal that an element or root has changed.
		 * This will trigger the view to update the changed element/root and its children recursively (if shown).
		 * To signal that root has changed, do not pass any argument or pass `undefined` or `null`.
		 */
		onDidChangeTreeData?: Event<T | undefined | null>;

		/**
		 * Get [TreeItem](#TreeItem) representation of the `element`
		 *
		 * @param element The element for which [TreeItem](#TreeItem) representation is asked for.
		 * @return [TreeItem](#TreeItem) representation of the element
		 */
		getTreeItem(element: T): TreeItem | Thenable<TreeItem>;

		/**
		 * Get the children of `element` or root if no element is passed.
		 *
		 * @param element The element from which the provider gets children. Can be `undefined`.
		 * @return Children of `element` or root if no element is passed.
		 */
		getChildren(element?: T): ProviderResult<T[]>;

		/**
		 * Optional method to return the parent of `element`.
		 * Return `null` or `undefined` if `element` is a child of root.
		 *
		 * **NOTE:** This method should be implemented in order to access [reveal](#TreeView.reveal) API.
		 *
		 * @param element The element for which the parent has to be returned.
		 * @return Parent of `element`.
		 */
		getParent?(element: T): ProviderResult<T>;
	}
733

J
Johannes Rieken 已提交
734 735 736
	//#endregion

	//#region Alex: TextEditor.visibleRange and related event
737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767

	export interface TextEditor {
		/**
		 * The current visible ranges in the editor (vertically).
		 * This accounts only for vertical scrolling, and not for horizontal scrolling.
		 */
		readonly visibleRanges: Range[];
	}

	/**
	 * Represents an event describing the change in a [text editor's visible ranges](#TextEditor.visibleRanges).
	 */
	export interface TextEditorVisibleRangesChangeEvent {
		/**
		 * The [text editor](#TextEditor) for which the visible ranges have changed.
		 */
		textEditor: TextEditor;
		/**
		 * The new value for the [text editor's visible ranges](#TextEditor.visibleRanges).
		 */
		visibleRanges: Range[];
	}

	export namespace window {
		/**
		 * An [event](#Event) which fires when the selection in an editor has changed.
		 */
		export const onDidChangeTextEditorVisibleRanges: Event<TextEditorVisibleRangesChangeEvent>;
	}

	//#endregion
768 769 770 771

	//#region Tasks

	/**
772 773
	 * An object representing an executed Task. It can be used
	 * to terminate a task.
774
	 */
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798
	export interface TaskExecution {
	}

	/**
	 * An event signaling the start of a task execution.
	 */
	interface TaskStartEvent {
		/**
		 * The task item representing the task that got started.
		 */
		execution: TaskExecution;
	}

	/**
	 * An event signaling the end of an executed task.
	 */
	interface TaskEndEvent {
		/**
		 * The task item representing the task that finished.
		 */
		execution: TaskExecution;
	}

	export namespace workspace {
799 800

		/**
801 802 803
		 * Fetches all task available in the systems. This includes tasks
		 * from `tasks.json` files as well as tasks from task providers
		 * contributed through extensions.
804
		 */
805
		export function fetchTasks(): Thenable<Task[]>;
806 807

		/**
808 809 810 811
		 * 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
812
		 */
813
		export function executeTask(task: Task): Thenable<TaskExecution>;
D
Dirk Baeumer 已提交
814 815

		/**
816 817 818 819 820 821 822 823
		 * Fires when a task starts.
		 */
		export const onDidStartTask: Event<TaskStartEvent>;

		/**
		 * Terminates a task that was previously started using `executeTask`
		 *
		 * @param task the task to terminate
D
Dirk Baeumer 已提交
824
		 */
825
		export function terminateTask(task: TaskExecution): void;
826 827

		/**
828
		 * Fires when a task ends.
829
		 */
830
		export const onDidEndTask: Event<TaskEndEvent>;
831 832 833
	}

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