vscode.proposed.d.ts 23.9 KB
Newer Older
1 2 3 4 5 6 7
/*---------------------------------------------------------------------------------------------
 *  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.

8 9
import { QuickPickItem } from 'vscode';

10 11
declare module 'vscode' {

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

16
	//#region Rob: search provider
17

18 19 20
	/**
	 * The parameters of a query for text search.
	 */
21
	export interface TextSearchQuery {
22 23 24
		/**
		 * The text pattern to search for.
		 */
25
		pattern: string;
26 27 28 29

		/**
		 * Whether or not `pattern` should be interpreted as a regular expression.
		 */
R
Rob Lourens 已提交
30
		isRegExp?: boolean;
31 32 33 34

		/**
		 * Whether or not the search should be case-sensitive.
		 */
R
Rob Lourens 已提交
35
		isCaseSensitive?: boolean;
36 37 38 39

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

43 44 45 46 47 48 49 50 51 52
	/**
	 * A file glob pattern to match file paths against.
	 * TODO@roblou - merge this with the GlobPattern docs/definition in vscode.d.ts.
	 * @see [GlobPattern](#GlobPattern)
	 */
	export type GlobString = string;

	/**
	 * Options common to file and text search
	 */
R
Rob Lourens 已提交
53
	export interface SearchOptions {
54 55 56
		/**
		 * The root folder to search within.
		 */
57
		folder: Uri;
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

		/**
		 * Files that match an `includes` glob pattern should be included in the search.
		 */
		includes: GlobString[];

		/**
		 * Files that match an `excludes` glob pattern should be excluded from the search.
		 */
		excludes: GlobString[];

		/**
		 * Whether external files that exclude files, like .gitignore, should be respected.
		 * See the vscode setting `"search.useIgnoreFiles"`.
		 */
R
Rob Lourens 已提交
73
		useIgnoreFiles: boolean;
74 75 76 77 78

		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
79
		followSymlinks: boolean;
80 81
	}

82 83 84
	/**
	 * Options that apply to text search.
	 */
R
Rob Lourens 已提交
85
	export interface TextSearchOptions extends SearchOptions {
86 87 88 89 90
		/**
		 * The maximum number of results to be returned.
		 */
		maxResults: number;

91 92 93 94 95 96 97 98
		/**
		 *  TODO@roblou - total length? # of context lines? leading and trailing # of chars?
		 */
		previewOptions?: any;

		/**
		 * Exclude files larger than `maxFileSize` in bytes.
		 */
99
		maxFileSize?: number;
100 101 102 103 104

		/**
		 * Interpret files using this encoding.
		 * See the vscode setting `"files.encoding"`
		 */
105
		encoding?: string;
106 107
	}

108 109 110
	/**
	 * The parameters of a query for file search.
	 */
111
	export interface FileSearchQuery {
112 113 114
		/**
		 * The search pattern to match against file paths.
		 */
115 116 117
		pattern: string;
	}

118 119 120
	/**
	 * Options that apply to file search.
	 */
121 122 123 124 125 126 127 128 129 130 131
	export interface FileSearchOptions extends SearchOptions {
		/**
		 * The maximum number of results to be returned.
		 */
		maxResults: number;
	}

	/**
	 * Options that apply to requesting the file index.
	 */
	export interface FileIndexOptions extends SearchOptions { }
132

133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
	export interface TextSearchResultPreview {
		/**
		 * The matching line of text, or a portion of the matching line that contains the match.
		 * For now, this can only be a single line.
		 */
		text: string;

		/**
		 * The Range within `text` corresponding to the text of the match.
		 */
		match: Range;
	}

	/**
	 * A match from a text search
	 */
149
	export interface TextSearchResult {
150 151 152
		/**
		 * The uri for the matching document.
		 */
153
		uri: Uri;
154 155 156 157

		/**
		 * The range of the match within the document.
		 */
158
		range: Range;
R
Rob Lourens 已提交
159

160 161 162 163
		/**
		 * A preview of the matching line
		 */
		preview: TextSearchResultPreview;
164 165
	}

R
Rob Lourens 已提交
166 167 168 169 170 171 172 173 174 175 176
	/**
	 * A FileIndexProvider provides a list of files in the given folder. VS Code will filter that list for searching with quickopen or from other extensions.
	 *
	 * A FileIndexProvider is the simpler of two ways to implement file search in VS Code. Use a FileIndexProvider if you are able to provide a listing of all files
	 * in a folder, and want VS Code to filter them according to the user's search query.
	 *
	 * The FileIndexProvider will be invoked once when quickopen is opened, and VS Code will filter the returned list. It will also be invoked when
	 * `workspace.findFiles` is called.
	 *
	 * If a [`FileSearchProvider`](#FileSearchProvider) is registered for the scheme, that provider will be used instead.
	 */
177
	export interface FileIndexProvider {
178
		/**
R
Rob Lourens 已提交
179
		 * Provide the set of files in the folder.
180 181 182
		 * @param options A set of options to consider while searching.
		 * @param token A cancellation token.
		 */
183
		provideFileIndex(options: FileIndexOptions, token: CancellationToken): Thenable<Uri[]>;
184 185
	}

186
	/**
R
Rob Lourens 已提交
187 188 189 190 191 192 193 194 195
	 * A FileSearchProvider provides search results for files in the given folder that match a query string. It can be invoked by quickopen or other extensions.
	 *
	 * A FileSearchProvider is the more powerful of two ways to implement file search in VS Code. Use a FileSearchProvider if you wish to search within a folder for
	 * all files that match the user's query.
	 *
	 * The FileSearchProvider will be invoked on every keypress in quickopen. When `workspace.findFiles` is called, it will be invoked with an empty query string,
	 * and in that case, every file in the folder should be returned.
	 *
	 * @see [FileIndexProvider](#FileIndexProvider)
196
	 */
197
	export interface FileSearchProvider {
198 199 200 201 202 203 204
		/**
		 * Provide the set of files that match a certain file path pattern.
		 * @param query The parameters for this query.
		 * @param options A set of options to consider while searching files.
		 * @param progress A progress callback that must be invoked for all results.
		 * @param token A cancellation token.
		 */
205
		provideFileSearchResults(query: FileSearchQuery, options: FileSearchOptions, token: CancellationToken): Thenable<Uri[]>;
206 207
	}

R
Rob Lourens 已提交
208 209 210 211 212 213 214 215 216 217 218 219 220 221
	/**
	 * A TextSearchProvider provides search results for text results inside files in the workspace.
	 */
	export interface TextSearchProvider {
		/**
		 * Provide results that match the given text pattern.
		 * @param query The parameters for this query.
		 * @param options A set of options to consider while searching.
		 * @param progress A progress callback that must be invoked for all results.
		 * @param token A cancellation token.
		 */
		provideTextSearchResults(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): Thenable<void>;
	}

222 223 224
	/**
	 * Options that can be set on a findTextInFiles search.
	 */
R
Rob Lourens 已提交
225
	export interface FindTextInFilesOptions {
226 227 228 229 230
		/**
		 * A [glob pattern](#GlobPattern) that defines the files to search for. The glob pattern
		 * will be matched against the file paths of files relative to their workspace. Use a [relative pattern](#RelativePattern)
		 * to restrict the search results to a [workspace folder](#WorkspaceFolder).
		 */
231
		include?: GlobPattern;
232 233 234 235 236 237 238 239 240 241 242

		/**
		 * A [glob pattern](#GlobPattern) that defines files and folders to exclude. The glob pattern
		 * will be matched against the file paths of resulting matches relative to their workspace. When `undefined` only default excludes will
		 * apply, when `null` no excludes will apply.
		 */
		exclude?: GlobPattern | null;

		/**
		 * The maximum number of results to search for
		 */
R
Rob Lourens 已提交
243
		maxResults?: number;
244 245 246 247 248

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

		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
255
		followSymlinks?: boolean;
256 257 258 259 260

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

264
	export namespace workspace {
265 266 267 268 269
		/**
		 * DEPRECATED
		 */
		export function registerSearchProvider(): Disposable;

270
		/**
R
Rob Lourens 已提交
271
		 * Register a file index provider.
272 273 274 275 276 277 278
		 *
		 * Only one provider can be registered per scheme.
		 *
		 * @param scheme The provider will be invoked for workspace folders that have this file scheme.
		 * @param provider The provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
R
Rob Lourens 已提交
279
		export function registerFileIndexProvider(scheme: string, provider: FileIndexProvider): Disposable;
280

281
		/**
R
Rob Lourens 已提交
282
		 * Register a search provider.
283 284 285 286 287 288 289
		 *
		 * Only one provider can be registered per scheme.
		 *
		 * @param scheme The provider will be invoked for workspace folders that have this file scheme.
		 * @param provider The provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
R
Rob Lourens 已提交
290
		export function registerFileSearchProvider(scheme: string, provider: FileSearchProvider): Disposable;
291

292
		/**
R
Rob Lourens 已提交
293
		 * Register a text search provider.
294 295 296 297 298 299 300
		 *
		 * Only one provider can be registered per scheme.
		 *
		 * @param scheme The provider will be invoked for workspace folders that have this file scheme.
		 * @param provider The provider.
		 * @return A [disposable](#Disposable) that unregisters this provider when being disposed.
		 */
R
Rob Lourens 已提交
301
		export function registerTextSearchProvider(scheme: string, provider: TextSearchProvider): Disposable;
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319

		/**
		 * Search text in files across all [workspace folders](#workspace.workspaceFolders) in the workspace.
		 * @param query The query parameters for the search - the search string, whether it's case-sensitive, or a regex, or matches whole words.
		 * @param callback A callback, called for each result
		 * @param token A token that can be used to signal cancellation to the underlying search engine.
		 * @return A thenable that resolves when the search is complete.
		 */
		export function findTextInFiles(query: TextSearchQuery, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<void>;

		/**
		 * Search text in files across all [workspace folders](#workspace.workspaceFolders) in the workspace.
		 * @param query The query parameters for the search - the search string, whether it's case-sensitive, or a regex, or matches whole words.
		 * @param options An optional set of query options. Include and exclude patterns, maxResults, etc.
		 * @param callback A callback, called for each result
		 * @param token A token that can be used to signal cancellation to the underlying search engine.
		 * @return A thenable that resolves when the search is complete.
		 */
R
Rob Lourens 已提交
320
		export function findTextInFiles(query: TextSearchQuery, options: FindTextInFilesOptions, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<void>;
321 322
	}

J
Johannes Rieken 已提交
323
	//#endregion
324

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

J
Joao Moreno 已提交
327 328 329
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
330 331 332 333 334 335 336
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
	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;
	}
355

J
Johannes Rieken 已提交
356 357 358
	//#endregion

	//#region Joh: decorations
359 360 361 362 363

	//todo@joh -> make class
	export interface DecorationData {
		priority?: number;
		title?: string;
364
		bubble?: boolean;
J
Johannes Rieken 已提交
365
		abbreviation?: string; // letter, not optional
366
		color?: ThemeColor;
J
Johannes Rieken 已提交
367
		source?: string; // hacky... we should remove it and use equality under the hood
368 369
	}

370 371 372 373 374 375
	export interface SourceControlResourceDecorations {
		source?: string;
		letter?: string;
		color?: ThemeColor;
	}

376
	export interface DecorationProvider {
377
		onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
378 379 380 381
		provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<DecorationData>;
	}

	export namespace window {
382
		export function registerDecorationProvider(provider: DecorationProvider): Disposable;
383 384 385
	}

	//#endregion
386

J
Johannes Rieken 已提交
387 388
	//#region André: debug

389 390 391 392 393 394
	/**
	 * 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 已提交
395
		 * A command must be either an absolute path or the name of an executable looked up via the PATH environment variable.
396 397 398 399 400
		 * The special value 'node' will be mapped to VS Code's built-in node runtime.
		 */
		readonly command: string;

		/**
A
Andre Weinand 已提交
401
		 * Optional arguments passed to the debug adapter executable.
402 403 404 405 406 407 408 409 410 411 412
		 */
		readonly args: string[];

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

	export interface DebugConfigurationProvider {
		/**
413
		 * This optional method is called just before a debug adapter is started to determine its executable path and arguments.
414 415 416 417 418 419 420 421
		 * 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 已提交
422 423 424 425
	//#endregion

	//#region Rob, Matt: logging

426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
	/**
	 * 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 已提交
453
		 * This extension's logger
454 455
		 */
		logger: Logger;
456 457 458 459 460 461 462

		/**
		 * 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;
463
	}
464

M
Matt Bierner 已提交
465 466 467 468 469 470 471 472 473
	export namespace env {
		/**
		 * Current logging level.
		 *
		 * @readonly
		 */
		export const logLevel: LogLevel;
	}

J
Johannes Rieken 已提交
474 475 476
	//#endregion

	//#region Joao: SCM validation
477

J
Joao Moreno 已提交
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 519 520 521 522
	/**
	 * 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 已提交
523

J
Johannes Rieken 已提交
524 525
	//#endregion

526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
	//#region Joao: SCM selected provider

	export interface SourceControl {

		/**
		 * Whether the source control is selected.
		 */
		readonly selected: boolean;

		/**
		 * An event signaling when the selection state changes.
		 */
		readonly onDidChangeSelection: Event<boolean>;
	}

	//#endregion

543 544 545 546 547
	//#region Comments
	/**
	 * Comments provider related APIs are still in early stages, they may be changed significantly during our API experiments.
	 */

548 549 550 551 552
	interface CommentInfo {
		threads: CommentThread[];
		commentingRanges?: Range[];
	}

553 554 555 556 557 558 559 560 561 562 563
	export enum CommentThreadCollapsibleState {
		/**
		 * Determines an item is collapsed
		 */
		Collapsed = 0,
		/**
		 * Determines an item is expanded
		 */
		Expanded = 1
	}

M
Matt Bierner 已提交
564
	interface CommentThread {
565
		threadId: string;
566
		resource: Uri;
M
Matt Bierner 已提交
567 568
		range: Range;
		comments: Comment[];
569
		collapsibleState?: CommentThreadCollapsibleState;
M
Matt Bierner 已提交
570 571 572
	}

	interface Comment {
P
Peng Lyu 已提交
573
		commentId: string;
M
Matt Bierner 已提交
574 575
		body: MarkdownString;
		userName: string;
576
		gravatar: string;
577
		command?: Command;
M
Matt Bierner 已提交
578 579
	}

580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596
	export interface CommentThreadChangedEvent {
		/**
		 * Added comment threads.
		 */
		readonly added: CommentThread[];

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

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

597 598
	interface DocumentCommentProvider {
		provideDocumentComments(document: TextDocument, token: CancellationToken): Promise<CommentInfo>;
599 600
		createNewCommentThread?(document: TextDocument, range: Range, text: string, token: CancellationToken): Promise<CommentThread>;
		replyToCommentThread?(document: TextDocument, range: Range, commentThread: CommentThread, text: string, token: CancellationToken): Promise<CommentThread>;
601 602 603 604 605
		onDidChangeCommentThreads?: Event<CommentThreadChangedEvent>;
	}

	interface WorkspaceCommentProvider {
		provideWorkspaceComments(token: CancellationToken): Promise<CommentThread[]>;
606 607 608
		createNewCommentThread?(document: TextDocument, range: Range, text: string, token: CancellationToken): Promise<CommentThread>;
		replyToCommentThread?(document: TextDocument, range: Range, commentThread: CommentThread, text: string, token: CancellationToken): Promise<CommentThread>;

609
		onDidChangeCommentThreads?: Event<CommentThreadChangedEvent>;
M
Matt Bierner 已提交
610 611 612
	}

	namespace workspace {
613 614
		export function registerDocumentCommentProvider(provider: DocumentCommentProvider): Disposable;
		export function registerWorkspaceCommentProvider(provider: WorkspaceCommentProvider): Disposable;
M
Matt Bierner 已提交
615
	}
616 617
	//#endregion

618 619
	//#region Terminal

D
Daniel Imms 已提交
620
	export interface Terminal {
D
Daniel Imms 已提交
621
		/**
D
Daniel Imms 已提交
622
		 * Fires when the terminal's pty slave pseudo-device is written to. In other words, this
D
Daniel Imms 已提交
623
		 * provides access to the raw data stream from the process running within the terminal,
624
		 * including VT sequences.
D
Daniel Imms 已提交
625
		 */
626
		onDidWriteData: Event<string>;
D
Daniel Imms 已提交
627 628
	}

D
Daniel Imms 已提交
629
	/**
630
	 * Represents the dimensions of a terminal.
D
Daniel Imms 已提交
631 632 633 634 635
	 */
	export interface TerminalDimensions {
		/**
		 * The number of columns in the terminal.
		 */
636
		readonly columns: number;
D
Daniel Imms 已提交
637 638 639 640

		/**
		 * The number of rows in the terminal.
		 */
641
		readonly rows: number;
D
Daniel Imms 已提交
642 643
	}

644 645 646 647
	/**
	 * Represents a terminal without a process where all interaction and output in the terminal is
	 * controlled by an extension. This is similar to an output window but has the same VT sequence
	 * compatility as the regular terminal.
D
Daniel Imms 已提交
648 649 650 651
	 *
	 * Note that an instance of [Terminal](#Terminal) will be created when a TerminalRenderer is
	 * created with all its APIs available for use by extensions. When using the Terminal object
	 * of a TerminalRenderer it acts just like normal only the extension that created the
652
	 * TerminalRenderer essentially acts as a process. For example when an
653 654
	 * [Terminal.onDidWriteData](#Terminal.onDidWriteData) listener is registered, that will fire
	 * when [TerminalRenderer.write](#TerminalRenderer.write) is called. Similarly when
D
Daniel Imms 已提交
655
	 * [Terminal.sendText](#Terminal.sendText) is triggered that will fire the
656
	 * [TerminalRenderer.onDidAcceptInput](#TerminalRenderer.onDidAcceptInput) event.
657 658 659 660 661 662 663
	 *
	 * **Example:** Create a terminal renderer, show it and write hello world in red
	 * ```typescript
	 * const renderer = window.createTerminalRenderer('foo');
	 * renderer.terminal.then(t => t.show());
	 * renderer.write('\x1b[31mHello world\x1b[0m');
	 * ```
664
	 */
665
	export interface TerminalRenderer {
666 667 668
		/**
		 * The name of the terminal, this will appear in the terminal selector.
		 */
669 670
		name: string;

D
Daniel Imms 已提交
671 672 673 674
		/**
		 * The dimensions of the terminal, the rows and columns of the terminal can only be set to
		 * a value smaller than the maximum value, if this is undefined the terminal will auto fit
		 * to the maximum value [maximumDimensions](TerminalRenderer.maximumDimensions).
675 676 677 678 679 680 681 682
		 *
		 * **Example:** Override the dimensions of a TerminalRenderer to 20 columns and 10 rows
		 * ```typescript
		 * terminalRenderer.dimensions = {
		 *   cols: 20,
		 *   rows: 10
		 * };
		 * ```
D
Daniel Imms 已提交
683
		 */
684
		dimensions: TerminalDimensions | undefined;
D
Daniel Imms 已提交
685 686 687 688 689 690 691

		/**
		 * The maximum dimensions of the terminal, this will be undefined immediately after a
		 * terminal renderer is created and also until the terminal becomes visible in the UI.
		 * Listen to [onDidChangeMaximumDimensions](TerminalRenderer.onDidChangeMaximumDimensions)
		 * to get notified when this value changes.
		 */
692
		readonly maximumDimensions: TerminalDimensions | undefined;
693

694 695 696
		/**
		 * The corressponding [Terminal](#Terminal) for this TerminalRenderer.
		 */
697
		readonly terminal: Terminal;
698

699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714
		/**
		 * Write text to the terminal. Unlike [Terminal.sendText](#Terminal.sendText) which sends
		 * text to the underlying _process_, this will write the text to the terminal itself.
		 *
		 * **Example:** Write red text to the terminal
		 * ```typescript
		 * terminalRenderer.write('\x1b[31mHello world\x1b[0m');
		 * ```
		 *
		 * **Example:** Move the cursor to the 10th row and 20th column and write an asterisk
		 * ```typescript
		 * terminalRenderer.write('\x1b[10;20H*');
		 * ```
		 *
		 * @param text The text to write.
		 */
D
Daniel Imms 已提交
715
		write(text: string): void;
716

717 718 719 720
		/**
		 * An event which fires on keystrokes in the terminal or when an extension calls
		 * [Terminal.sendText](#Terminal.sendText). Keystrokes are converted into their
		 * corresponding VT sequence representation.
721 722 723 724 725
		 *
		 * **Example:** Simulate interaction with the terminal from an outside extension or a
		 * workbench command such as `workbench.action.terminal.runSelectedText`
		 * ```typescript
		 * const terminalRenderer = window.createTerminalRenderer('test');
726
		 * terminalRenderer.onDidAcceptInput(data => {
727 728 729 730
		 *   cosole.log(data); // 'Hello world'
		 * });
		 * terminalRenderer.terminal.then(t => t.sendText('Hello world'));
		 * ```
731
		 */
732
		readonly onDidAcceptInput: Event<string>;
733

D
Daniel Imms 已提交
734 735 736 737
		/**
		 * An event which fires when the [maximum dimensions](#TerminalRenderer.maimumDimensions) of
		 * the terminal renderer change.
		 */
738
		readonly onDidChangeMaximumDimensions: Event<TerminalDimensions>;
739 740
	}

741
	export namespace window {
742 743 744 745
		/**
		 * The currently active terminal or `undefined`. The active terminal is the one that
		 * currently has focus or most recently had focus.
		 */
746
		export const activeTerminal: Terminal | undefined;
747 748 749

		/**
		 * An [event](#Event) which fires when the [active terminal](#window.activeTerminal)
750
		 * has changed. *Note* that the event also fires when the active terminal changes
751 752 753 754
		 * to `undefined`.
		 */
		export const onDidChangeActiveTerminal: Event<Terminal | undefined>;

D
Daniel Imms 已提交
755 756 757 758 759
		/**
		 * Create a [TerminalRenderer](#TerminalRenderer).
		 *
		 * @param name The name of the terminal renderer, this shows up in the terminal selector.
		 */
760
		export function createTerminalRenderer(name: string): TerminalRenderer;
761 762 763
	}

	//#endregion
J
Joao Moreno 已提交
764

765 766 767 768 769 770 771
	//#region Joh -> exclusive document filters

	export interface DocumentFilter {
		exclusive?: boolean;
	}

	//#endregion
C
Christof Marti 已提交
772

J
Johannes Rieken 已提交
773
	//#region mjbvz,joh: https://github.com/Microsoft/vscode/issues/43768
774 775 776
	export interface FileRenameEvent {
		readonly oldUri: Uri;
		readonly newUri: Uri;
C
Christof Marti 已提交
777 778
	}

779 780 781
	export interface FileWillRenameEvent {
		readonly oldUri: Uri;
		readonly newUri: Uri;
782
		waitUntil(thenable: Thenable<WorkspaceEdit>): void;
783 784
	}

785
	export namespace workspace {
786
		export const onWillRenameFile: Event<FileWillRenameEvent>;
787
		export const onDidRenameFile: Event<FileRenameEvent>;
788 789
	}
	//#endregion
J
Johannes Rieken 已提交
790
}