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' {

10
	/**
J
Johannes Rieken 已提交
11
	 * Defines a generalized way of reporing progress updates.
12 13
	 */
	export interface Progress<T> {
J
Johannes Rieken 已提交
14 15 16 17 18 19

		/**
		 * Report a progress update.
		 * @param value A progress item, like a message or an updated percentage value
		 */
		report(value: T): void
20 21
	}

22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 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 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 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 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
	/**
	 * Defines a problem pattern
	 */
	export interface ProblemPattern {

		/**
		 * The regular expression to find a problem in the console output of an
		 * executed task.
		 */
		regexp: RegExp;

		/**
		 * The match group index of the filename.
		 *
		 * Defaults to 1 if omitted.
		 */
		file?: number;

		/**
		 * The match group index of the problems's location. Valid location
		 * patterns are: (line), (line,column) and (startLine,startColumn,endLine,endColumn).
		 * If omitted the line and colum properties are used.
		 */
		location?: number;

		/**
		 * The match group index of the problem's line in the source file.
		 *
		 * Defaults to 2 if omitted.
		 */
		line?: number;

		/**
		 * The match group index of the problem's character in the source file.
		 *
		 * Defaults to 3 if omitted.
		 */
		character?: number;

		/**
		 * The match group index of the problem's end line in the source file.
		 *
		 * Defaults to undefined. No end line is captured.
		 */
		endLine?: number;

		/**
		 * The match group index of the problem's end character in the source file.
		 *
		 * Defaults to undefined. No end column is captured.
		 */
		endCharacter?: number;

		/**
		 * The match group index of the problem's severity.
		 *
		 * Defaults to undefined. In this case the problem matcher's severity
		 * is used.
		*/
		severity?: number;

		/**
		 * The match group index of the problems's code.
		 *
		 * Defaults to undefined. No code is captured.
		 */
		code?: number;

		/**
		 * The match group index of the message. If omitted it defaults
		 * to 4 if location is specified. Otherwise it defaults to 5.
		 */
		message?: number;

		/**
		 * Specifies if the last pattern in a multi line problem matcher should
		 * loop as long as it does match a line consequently. Only valid on the
		 * last problem pattern in a multi line problem matcher.
		 */
		loop?: boolean;
	}

	/**
	 * A multi line problem pattern.
	 */
	export type MultiLineProblemPattern = ProblemPattern[];

	/**
	 * The way how the file location is interpreted
	 */
	export enum FileLocationKind {
		/**
		 * VS Code should decide based on whether the file path found in the
		 * output is absolute or relative. A relative file path will be treated
		 * relative to the workspace root.
		 */
		Auto = 1,

		/**
		 * Always treat the file path relative.
		 */
		Relative = 2,

		/**
		 * Always treat the file path absolute.
		 */
		Absolute = 3
	}

	/**
	 * Controls to which kind of documents problems are applied.
	 */
	export enum ApplyToKind {
		/**
		 * Problems are applied to all documents.
		 */
		AllDocuments = 1,
		/**
		 * Problems are applied to open documents only.
		 */
		OpenDocuments = 2,

		/**
		 * Problems are applied to closed documents only.
		 */
		ClosedDocuments = 3
	}


	/**
	 * A background monitor pattern
	 */
	export interface BackgroundPattern {
		/**
		 * The actual regular expression
		 */
		regexp: RegExp;

		/**
		 * The match group index of the filename. If provided the expression
		 * is matched for that file only.
		 */
		file?: number;
	}

	/**
	 * A description to control the activity of a problem matcher
	 * watching a background task.
	 */
	export interface BackgroundMonitor {
		/**
		 * If set to true the monitor is in active mode when the task
		 * starts. This is equals of issuing a line that matches the
		 * beginPattern.
		 */
		activeOnStart?: boolean;

		/**
		 * If matched in the output the start of a background activity is signaled.
		 */
		beginsPattern: RegExp | BackgroundPattern;

		/**
		 * If matched in the output the end of a background activity is signaled.
		 */
		endsPattern: RegExp | BackgroundPattern;
	}

	/**
	 * Defines a problem matcher
	 */
	export interface ProblemMatcher {
		/**
		 * The owner of a problem. Defaults to a generated id
		 * if omitted.
		 */
		owner?: string;

		/**
		 * The type of documents problems detected by this matcher
		 * apply to. Default to `ApplyToKind.AllDocuments` if omitted.
		 */
		applyTo?: ApplyToKind;

		/**
		 * How a file location recognize by a matcher should be interpreted. If omitted the file location
		 * if `FileLocationKind.Auto`.
		 */
		fileLocation?: FileLocationKind | string;

		/**
		 * The actual pattern used by the problem matcher.
		 */
		pattern: ProblemPattern | MultiLineProblemPattern;

		/**
		 * The default severity of a detected problem in the output. Used
		 * if the `ProblemPattern` doesn't define a severity match group.
		 */
		severity?: DiagnosticSeverity;

		/**
		 * A background monitor for tasks that are running in the background.
		 */
		backgound?: BackgroundMonitor;
	}

	/**
	 * Controls the behaviour of the terminal's visibility.
	 */
	export enum RevealKind {
		/**
		 * Always brings the terminal to front if the task is executed.
		 */
		Always = 1,

		/**
		 * Only brings the terminal to front if a problem is detected executing the task
		 * (e.g. the task couldn't be started because).
		 */
		Silent = 2,

		/**
		 * The terminal never comes to front when the task is executed.
		 */
		Never = 3
	}

	/**
	 * Controls terminal specific behaviour.
	 */
	export interface TerminalBehaviour {
		/**
		 * Controls whether the terminal executing a task is brought to front or not.
		 * Defaults to `RevealKind.Always`.
		 */
		reveal?: RevealKind;
D
Dirk Baeumer 已提交
259 260 261 262 263

		/**
		 * Controls whether the command is echoed in the terminal or not.
		 */
		echo?: boolean;
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
	}


	export interface ProcessOptions {
		/**
		 * The current working directory of the executed program or shell.
		 * If omitted VSCode's current workspace root is used.
		 */
		cwd?: string;

		/**
		 * The additional environment of the executed program or shell. If omitted
		 * the parent process' environment is used. If provided it is merged with
		 * the parent process' environment.
		 */
		env?: { [key: string]: string };
	}

	/**
	 * A task that starts an external process.
	 */
	export class ProcessTask {

		/**
		 * Creates a process task.
		 *
		 * @param name the task's name. Is presented in the user interface.
		 * @param process the process to start.
		 * @param problemMatchers the problem matchers to use.
		 */
		constructor(name: string, process: string, ...problemMatchers: ProblemMatcher[]);

		/**
		 * Creates a process task.
		 *
		 * @param name the task's name. Is presented in the user interface.
		 * @param process the process to start.
		 * @param args arguments to be passed to the process.
		 * @param problemMatchers the problem matchers to use.
		 */
		constructor(name: string, process: string, args: string[], ...problemMatchers: ProblemMatcher[]);

		/**
		 * Creates a process task.
		 *
		 * @param name the task's name. Is presented in the user interface.
		 * @param process the process to start.
		 * @param args arguments to be passed to the process.
		 * @param options additional options for the started process.
		 * @param problemMatchers the problem matchers to use.
		 */
		constructor(name: string, process: string, args: string[], options: ProcessOptions, ...problemMatchers: ProblemMatcher[]);

		/**
		 * The task's name
		 */
		readonly name: string;

		/**
		 * The task's identifier. If omitted the name is
		 * used as an identifier.
		 */
		identifier: string;

		/**
		 * Whether the task is a background task or not.
		 */
		isBackground: boolean;

		/**
		 * The process to be executed.
		 */
		readonly process: string;

		/**
D
Dirk Baeumer 已提交
339
		 * The arguments passed to the process. Defaults to an empty array.
340
		 */
D
Dirk Baeumer 已提交
341
		args: string[];
342 343

		/**
D
Dirk Baeumer 已提交
344 345
		 * The process options used when the process is executed.
		 * Defaults to an empty object literal.
346
		 */
D
Dirk Baeumer 已提交
347
		options: ProcessOptions;
348 349

		/**
D
Dirk Baeumer 已提交
350
		 * The terminal options. Defaults to an empty object literal.
351
		 */
D
Dirk Baeumer 已提交
352
		terminal: TerminalBehaviour;
353 354

		/**
D
Dirk Baeumer 已提交
355 356
		 * The problem matchers attached to the task. Defaults to an empty
		 * array.
357
		 */
D
Dirk Baeumer 已提交
358
		problemMatchers: ProblemMatcher[];
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 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 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
	}

	export interface ShellOptions {
		/**
		 * The shell executable.
		 */
		executable?: string;

		/**
		 * The arguments to be passed to the shell executable.
		 */
		args?: string[];

		/**
		 * The current working directory of the executed shell.
		 * If omitted VSCode's current workspace root is used.
		 */
		cwd?: string;

		/**
		 * The additional environment of the executed shell. If omitted
		 * the parent process' environment is used. If provided it is merged with
		 * the parent process' environment.
		 */
		env?: { [key: string]: string };
	}

	/**
	 * A task that executes a shell command.
	 */
	export class ShellTask {

		/**
		 * Creates a shell task.
		 *
		 * @param name the task's name. Is presented in the user interface.
		 * @param commandLine the command line to execute.
		 * @param problemMatchers the problem matchers to use.
		 */
		constructor(name: string, commandLine: string, ...problemMatchers: ProblemMatcher[]);

		/**
		 * Creates a shell task.
		 *
		 * @param name the task's name. Is presented in the user interface.
		 * @param commandLine the command line to execute.
		 * @param options additional options used when creating the shell.
		 * @param problemMatchers the problem matchers to use.
		 */
		constructor(name: string, commandLine: string, options: ShellOptions, ...problemMatchers: ProblemMatcher[]);

		/**
		 * The task's name
		 */
		readonly name: string;

		/**
		 * The task's identifier. If omitted the name is
		 * used as an identifier.
		 */
		identifier: string;

		/**
		 * Whether the task is a background task or not.
		 */
		isBackground: boolean;

		/**
		 * The command line to execute.
		 */
		readonly commandLine: string;

		/**
D
Dirk Baeumer 已提交
432 433
		 * The shell options used when the shell is executed. Defaults to an
		 * empty object literal.
434
		 */
D
Dirk Baeumer 已提交
435
		options: ShellOptions;
436 437

		/**
D
Dirk Baeumer 已提交
438
		 * The terminal options. Defaults to an empty object literal.
439
		 */
D
Dirk Baeumer 已提交
440
		terminal: TerminalBehaviour;
441 442

		/**
D
Dirk Baeumer 已提交
443 444
		 * The problem matchers attached to the task. Defaults to an empty
		 * array.
445
		 */
D
Dirk Baeumer 已提交
446
		problemMatchers: ProblemMatcher[];
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 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497
	}

	export type Task = ProcessTask | ShellTask;

	/**
	 * Result return from a task provider.
	 */
	export interface TaskSet {
		/**
		 * The actual tasks returned.
		 */
		tasks: Task[];

		/**
		 * The build tasks provided. Tasks must be identified using
		 * `Task.identifier`
		 */
		buildTasks?: string[];

		/**
		 * The test tasks provided. Tasks must be identified using
		 * `Task.identifier`
		 */
		testTasks?: string[];
	}


	/**
	 * A task provider allows to add tasks to the task service.
	 * A task provider is registerd via #workspace.registerTaskProvider.
	 */
	export interface TaskProvider {
		/**
		 * Provides additional tasks.
		 * @param token A cancellation token.
		 * @return a #TaskSet
		 */
		provideTasks(token: CancellationToken): ProviderResult<TaskSet>;
	}

	export namespace workspace {
		/**
		 * Register a task provider.
		 *
		 * @param provider A task provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
		export function registerTaskProvider(provider: TaskProvider): Disposable;

	}

498 499
	export namespace window {

J
Johannes Rieken 已提交
500 501
		/**
		 * Show window-wide progress, e.g. in the status bar, for the provided task. The task is
J
Johannes Rieken 已提交
502
		 * considering running as long as the promise it returned isn't resolved or rejected.
J
Johannes Rieken 已提交
503 504 505
		 *
		 * @param task A function callback that represents a long running operation.
		 */
506
		export function withWindowProgress<R>(title: string, task: (progress: Progress<string>, token: CancellationToken) => Thenable<R>): Thenable<R>;
507

508
		export function withScmProgress<R>(task: (progress: Progress<number>) => Thenable<R>): Thenable<R>;
509

510 511
		export function sampleFunction(): Thenable<any>;
	}
P
Pine Wu 已提交
512

513
	export namespace window {
P
Pine Wu 已提交
514 515 516 517 518 519 520 521 522 523 524 525 526 527

		/**
		 * Register a [TreeExplorerNodeProvider](#TreeExplorerNodeProvider).
		 *
		 * @param providerId A unique id that identifies the provider.
		 * @param provider A [TreeExplorerNodeProvider](#TreeExplorerNodeProvider).
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
		export function registerTreeExplorerNodeProvider(providerId: string, provider: TreeExplorerNodeProvider<any>): Disposable;
	}

	/**
	 * A node provider for a tree explorer contribution.
	 *
P
Pine Wu 已提交
528
	 * Providers are registered through (#window.registerTreeExplorerNodeProvider) with a
P
Pine Wu 已提交
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585
	 * `providerId` that corresponds to the `treeExplorerNodeProviderId` in the extension's
	 * `contributes.explorer` section.
	 *
	 * The contributed tree explorer will ask the corresponding provider to provide the root
	 * node and resolve children for each node. In addition, the provider could **optionally**
	 * provide the following information for each node:
	 * - label: A human-readable label used for rendering the node.
	 * - hasChildren: Whether the node has children and is expandable.
	 * - clickCommand: A command to execute when the node is clicked.
	 */
	export interface TreeExplorerNodeProvider<T> {

		/**
		 * Provide the root node. This function will be called when the tree explorer is activated
		 * for the first time. The root node is hidden and its direct children will be displayed on the first level of
		 * the tree explorer.
		 *
		 * @return The root node.
		 */
		provideRootNode(): T | Thenable<T>;

		/**
		 * Resolve the children of `node`.
		 *
		 * @param node The node from which the provider resolves children.
		 * @return Children of `node`.
		 */
		resolveChildren(node: T): T[] | Thenable<T[]>;

		/**
		 * Provide a human-readable string that will be used for rendering the node. Default to use
		 * `node.toString()` if not provided.
		 *
		 * @param node The node from which the provider computes label.
		 * @return A human-readable label.
		 */
		getLabel?(node: T): string;

		/**
		 * Determine if `node` has children and is expandable. Default to `true` if not provided.
		 *
		 * @param node The node to determine if it has children and is expandable.
		 * @return A boolean that determines if `node` has children and is expandable.
		 */
		getHasChildren?(node: T): boolean;

		/**
		 * Get the command to execute when `node` is clicked.
		 *
		 * Commands can be registered through [registerCommand](#commands.registerCommand). `node` will be provided
		 * as the first argument to the command's callback function.
		 *
		 * @param node The node that the command is associated with.
		 * @return The command to execute when `node` is clicked.
		 */
		getClickCommand?(node: T): string;
	}
J
Joao Moreno 已提交
586

J
Joao Moreno 已提交
587 588 589
	/**
	 * The theme-aware decorations for a [SCM resource](#SCMResource).
	 */
J
Joao Moreno 已提交
590
	export interface SCMResourceThemableDecorations {
J
Joao Moreno 已提交
591 592 593 594

		/**
		 * The icon path for a specific [SCM resource](#SCMResource).
		 */
J
Joao Moreno 已提交
595
		readonly iconPath?: string | Uri;
J
Joao Moreno 已提交
596 597
	}

J
Joao Moreno 已提交
598 599 600 601
	/**
	 * The decorations for a [SCM resource](#SCMResource). Can be specified
	 * for light and dark themes, independently.
	 */
J
Joao Moreno 已提交
602
	export interface SCMResourceDecorations extends SCMResourceThemableDecorations {
J
Joao Moreno 已提交
603 604 605 606 607

		/**
		 * Whether the [SCM resource](#SCMResource) should be striked-through
		 * in the UI.
		 */
J
Joao Moreno 已提交
608
		readonly strikeThrough?: boolean;
J
Joao Moreno 已提交
609 610 611 612

		/**
		 * The light theme decorations.
		 */
J
Joao Moreno 已提交
613
		readonly light?: SCMResourceThemableDecorations;
J
Joao Moreno 已提交
614 615 616 617

		/**
		 * The dark theme decorations.
		 */
J
Joao Moreno 已提交
618
		readonly dark?: SCMResourceThemableDecorations;
J
Joao Moreno 已提交
619 620
	}

J
Joao Moreno 已提交
621
	/**
622 623 624 625 626 627 628 629
	 * An SCM resource represents a state of an underlying workspace resource
	 * within a certain SCM provider state.
	 *
	 * For example, consider file A to be modified. An SCM resource which would
	 * represent such state could have the following properties:
	 *
	 *   - `uri = 'git:workingtree/A'`
	 *   - `sourceUri = 'file:A'`
J
Joao Moreno 已提交
630
	 */
J
Joao Moreno 已提交
631
	export interface SCMResource {
J
Joao Moreno 已提交
632 633

		/**
634
		 * The [uri](#Uri) of this SCM resource.
J
Joao Moreno 已提交
635
		 */
J
Joao Moreno 已提交
636
		readonly uri: Uri;
J
Joao Moreno 已提交
637

638 639 640 641 642
		/**
		 * The [uri](#Uri) of the underlying resource inside the workspace.
		 */
		readonly sourceUri: Uri;

J
Joao Moreno 已提交
643 644 645
		/**
		 * The [decorations](#SCMResourceDecorations) for this SCM resource.
		 */
J
Joao Moreno 已提交
646
		readonly decorations?: SCMResourceDecorations;
J
Joao Moreno 已提交
647 648
	}

J
Joao Moreno 已提交
649 650 651
	/**
	 * An SCM resource group is a collection of [SCM resources](#SCMResource).
	 */
J
Joao Moreno 已提交
652
	export interface SCMResourceGroup {
J
Joao Moreno 已提交
653 654

		/**
655 656 657 658 659 660 661
		 * The [uri](#Uri) of this SCM resource group.
		 */
		readonly uri: Uri;

		/**
		 * The identifier of the SCM resource group, which will be used to populate
		 * the value of the `scmResourceGroup` context key.
J
Joao Moreno 已提交
662
		 */
J
Joao Moreno 已提交
663
		readonly id: string;
J
Joao Moreno 已提交
664 665

		/**
666
		 * The UI label of the SCM resource group.
J
Joao Moreno 已提交
667
		 */
J
Joao Moreno 已提交
668
		readonly label: string;
J
Joao Moreno 已提交
669 670

		/**
671
		 * The collection of [SCM resources](#SCMResource) within the SCM resource group.
J
Joao Moreno 已提交
672
		 */
J
Joao Moreno 已提交
673
		readonly resources: SCMResource[];
J
Joao Moreno 已提交
674 675
	}

J
Joao Moreno 已提交
676 677 678 679
	/**
	 * An SCM provider is able to provide [SCM resources](#SCMResource) to Code,
	 * notify of changes in them and interact with Code in several SCM related ways.
	 */
J
Joao Moreno 已提交
680
	export interface SCMProvider {
J
Joao Moreno 已提交
681 682

		/**
683 684
		 * The identifier of the SCM provider, which will be used to populate
		 * the value of the `scmProvider` context key.
685 686 687 688 689
		 */
		readonly id: string;

		/**
		 * A human-readable label for the name of the SCM Provider.
J
Joao Moreno 已提交
690
		 */
J
Joao Moreno 已提交
691
		readonly label: string;
J
Joao Moreno 已提交
692 693 694 695

		/**
		 * The list of SCM resource groups.
		 */
J
Joao Moreno 已提交
696
		readonly resources: SCMResourceGroup[];
J
Joao Moreno 已提交
697 698 699 700 701 702 703 704 705 706

		/**
		 * A count of resources, used in the UI as the label for the SCM changes count.
		 */
		readonly count?: number;

		/**
		 * A state identifier, which will be used to populate the value of the
		 * `scmProviderState` context key.
		 */
J
Joao Moreno 已提交
707
		readonly state?: string;
J
Joao Moreno 已提交
708

J
Joao Moreno 已提交
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724
		/**
		 * An [event](#Event) which should fire when any of the following attributes
		 * have changed:
		 *   - [resources](#SCMProvider.resources)
		 *   - [count](#SCMProvider.count)
		 *   - [state](#SCMProvider.state)
		 */
		readonly onDidChange: Event<SCMResourceGroup[]>;

		/**
		 * Provide a [uri](#Uri) to the original resource of any given resource uri.
		 *
		 * @param uri The uri of the resource open in a text editor.
		 * @param token A cancellation token.
		 * @return A thenable that resolves to uri of the matching original resource.
		 */
J
Joao Moreno 已提交
725
		getOriginalResource?(uri: Uri, token: CancellationToken): ProviderResult<Uri>;
J
Joao Moreno 已提交
726 727 728 729 730 731 732 733 734

		/**
		 * Open a specific [SCM resource](#SCMResource). Called when SCM resources
		 * are clicked in the UI, for example.
		 *
		 * @param resource The [SCM resource](#SCMResource) which should be open.
		 * @param token A cancellation token.
		 * @return A thenable which resolves when the resource is open.
		 */
J
Joao Moreno 已提交
735
		open?(resource: SCMResource, token: CancellationToken): ProviderResult<void>;
J
Joao Moreno 已提交
736 737

		// TODO@joao: move to SCMInput?
J
Joao Moreno 已提交
738
		acceptChanges?(token: CancellationToken): ProviderResult<void>;
J
Joao Moreno 已提交
739 740
	}

J
Joao Moreno 已提交
741 742 743
	/**
	 * Represents the input box in the SCM view.
	 */
744
	export interface SCMInputBox {
J
Joao Moreno 已提交
745 746 747 748

		/**
		 * Setter and getter for the contents of the input box.
		 */
749
		value: string;
J
Joao Moreno 已提交
750 751 752 753

		/**
		 * An [event](#Event) which fires when the input box value has changed.
		 */
754 755 756
		readonly onDidChange: Event<string>;
	}

J
Joao Moreno 已提交
757
	export namespace scm {
J
Joao Moreno 已提交
758 759 760 761 762

		/**
		 * An [event](#Event) which fires when the active [SCM provider](#SCMProvider)
		 * has changed.
		 */
J
Joao Moreno 已提交
763
		export const onDidChangeActiveProvider: Event<SCMProvider>;
J
Joao Moreno 已提交
764 765 766 767

		/**
		 * The currently active [SCM provider](#SCMProvider).
		 */
J
Joao Moreno 已提交
768
		export let activeProvider: SCMProvider | undefined;
J
Joao Moreno 已提交
769 770 771 772

		/**
		 * The [input box](#SCMInputBox) in the SCM view.
		 */
773 774
		export const inputBox: SCMInputBox;

J
Joao Moreno 已提交
775 776 777 778
		/**
		 * Registers an [SCM provider](#SCMProvider).
		 *
		 * @param id The provider's id.
779
		 * @return A disposable which unregisters the provider.
J
Joao Moreno 已提交
780
		 */
781
		export function registerSCMProvider(provider: SCMProvider): Disposable;
J
Joao Moreno 已提交
782
	}
J
Joao Moreno 已提交
783

J
Joao Moreno 已提交
784 785 786
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
787 788 789 790 791 792 793
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812
	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;
	}
}