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

6 7 8 9 10 11 12 13 14 15
/**
 * This is the place for API experiments and proposals.
 * These API are NOT stable and subject to change. They are only available in the Insiders
 * distribution and CANNOT be used in published extensions.
 *
 * To test these API in local environment:
 * - Use Insiders release of VS Code.
 * - Add `"enableProposedApi": true` to your package.json.
 * - Copy this file to your project.
 */
16

17 18
declare module 'vscode' {

19
	//#region Joh - ExecutionContext
20
	// THIS is a deprecated proposal
21 22 23 24
	export enum ExtensionExecutionContext {
		Local = 1,
		Remote = 2
	}
25 26 27 28 29
	export interface ExtensionContext {
		executionContext: ExtensionExecutionContext;
	}
	//#endregion

30 31 32 33 34 35 36 37 38 39 40
	//#region Joh - call hierarchy

	export enum CallHierarchyDirection {
		CallsFrom = 1,
		CallsTo = 2,
	}

	export class CallHierarchyItem {
		kind: SymbolKind;
		name: string;
		detail?: string;
41
		uri: Uri;
42 43 44
		range: Range;
		selectionRange: Range;

45
		constructor(kind: SymbolKind, name: string, detail: string, uri: Uri, range: Range, selectionRange: Range);
46 47 48 49
	}

	export interface CallHierarchyItemProvider {

J
Johannes Rieken 已提交
50 51 52 53
		/**
		 * Given a document and position compute a call hierarchy item. This is justed as
		 * anchor for call hierarchy and then `resolveCallHierarchyItem` is being called.
		 */
54 55
		provideCallHierarchyItem(
			document: TextDocument,
J
Julien Brianceau 已提交
56
			position: Position,
57 58 59
			token: CancellationToken
		): ProviderResult<CallHierarchyItem>;

J
Johannes Rieken 已提交
60 61 62 63 64 65 66 67 68 69
		/**
		 * Resolve a call hierarchy item, e.g. compute all calls from or to a function.
		 * The result is an array of item/location-tuples. The location in the returned tuples
		 * is always relative to the "caller" with the caller either being the provided item or
		 * the returned item.
		 *
		 * @param item A call hierarchy item previously returned from `provideCallHierarchyItem` or `resolveCallHierarchyItem`
		 * @param direction Resolve calls from a function or calls to a function
		 * @param token A cancellation token
		 */
70 71 72 73 74 75 76 77 78 79 80 81 82 83
		resolveCallHierarchyItem(
			item: CallHierarchyItem,
			direction: CallHierarchyDirection,
			token: CancellationToken
		): ProviderResult<[CallHierarchyItem, Location[]][]>;
	}

	export namespace languages {
		export function registerCallHierarchyProvider(selector: DocumentSelector, provider: CallHierarchyItemProvider): Disposable;
	}

	//#endregion


A
Alex Dima 已提交
84 85
	//#region Alex - resolvers

A
Tweaks  
Alex Dima 已提交
86 87 88 89
	export interface RemoteAuthorityResolverContext {
		resolveAttempt: number;
	}

A
Alex Dima 已提交
90 91 92 93 94 95 96
	export class ResolvedAuthority {
		readonly host: string;
		readonly port: number;

		constructor(host: string, port: number);
	}

97
	export interface ResolvedOptions {
98
		extensionHostEnv?: { [key: string]: string | null };
99 100
	}

101
	export type ResolverResult = ResolvedAuthority & ResolvedOptions;
102

A
Tweaks  
Alex Dima 已提交
103 104 105 106 107 108 109
	export class RemoteAuthorityResolverError extends Error {
		static NotAvailable(message?: string, handled?: boolean): RemoteAuthorityResolverError;
		static TemporarilyNotAvailable(message?: string): RemoteAuthorityResolverError;

		constructor(message?: string);
	}

A
Alex Dima 已提交
110
	export interface RemoteAuthorityResolver {
111
		resolve(authority: string, context: RemoteAuthorityResolverContext): ResolverResult | Thenable<ResolverResult>;
A
Alex Dima 已提交
112 113
	}

114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
	export interface ResourceLabelFormatter {
		scheme: string;
		authority?: string;
		formatting: ResourceLabelFormatting;
	}

	export interface ResourceLabelFormatting {
		label: string; // myLabel:/${path}
		separator: '/' | '\\' | '';
		tildify?: boolean;
		normalizeDriveLetter?: boolean;
		workspaceSuffix?: string;
		authorityPrefix?: string;
	}

A
Alex Dima 已提交
129 130
	export namespace workspace {
		export function registerRemoteAuthorityResolver(authorityPrefix: string, resolver: RemoteAuthorityResolver): Disposable;
131
		export function registerResourceLabelFormatter(formatter: ResourceLabelFormatter): Disposable;
132
	}
133

134 135 136 137 138
	//#endregion


	// #region Joh - code insets

139 140
	export interface WebviewEditorInset {
		readonly editor: TextEditor;
141 142
		readonly line: number;
		readonly height: number;
143 144 145
		readonly webview: Webview;
		readonly onDidDispose: Event<void>;
		dispose(): void;
146 147
	}

148
	export namespace window {
149
		export function createWebviewTextEditorInset(editor: TextEditor, line: number, height: number, options?: WebviewOptions): WebviewEditorInset;
A
Alex Dima 已提交
150 151 152 153
	}

	//#endregion

154 155 156
	//#region Joh - read/write in chunks

	export interface FileSystemProvider {
J
Johannes Rieken 已提交
157
		open?(resource: Uri, options: { create: boolean }): number | Thenable<number>;
158 159 160 161 162 163 164
		close?(fd: number): void | Thenable<void>;
		read?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable<number>;
		write?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable<number>;
	}

	//#endregion

165
	//#region Rob: search provider
166

167 168 169
	/**
	 * The parameters of a query for text search.
	 */
170
	export interface TextSearchQuery {
171 172 173
		/**
		 * The text pattern to search for.
		 */
174
		pattern: string;
175

R
Rob Lourens 已提交
176 177 178 179 180
		/**
		 * Whether or not `pattern` should match multiple lines of text.
		 */
		isMultiline?: boolean;

181 182 183
		/**
		 * Whether or not `pattern` should be interpreted as a regular expression.
		 */
R
Rob Lourens 已提交
184
		isRegExp?: boolean;
185 186 187 188

		/**
		 * Whether or not the search should be case-sensitive.
		 */
R
Rob Lourens 已提交
189
		isCaseSensitive?: boolean;
190 191 192 193

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

197 198 199 200 201 202 203 204 205 206
	/**
	 * 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 已提交
207
	export interface SearchOptions {
208 209 210
		/**
		 * The root folder to search within.
		 */
211
		folder: Uri;
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226

		/**
		 * 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 已提交
227
		useIgnoreFiles: boolean;
228 229 230 231 232

		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
233
		followSymlinks: boolean;
P
pkoushik 已提交
234 235 236 237 238 239

		/**
		 * Whether global files that exclude files, like .gitignore, should be respected.
		 * See the vscode setting `"search.useGlobalIgnoreFiles"`.
		 */
		useGlobalIgnoreFiles: boolean;
240
	}
241

R
Rob Lourens 已提交
242 243
	/**
	 * Options to specify the size of the result text preview.
R
Rob Lourens 已提交
244
	 * These options don't affect the size of the match itself, just the amount of preview text.
R
Rob Lourens 已提交
245
	 */
246
	export interface TextSearchPreviewOptions {
247
		/**
R
Rob Lourens 已提交
248
		 * The maximum number of lines in the preview.
R
Rob Lourens 已提交
249
		 * Only search providers that support multiline search will ever return more than one line in the match.
250
		 */
R
Rob Lourens 已提交
251
		matchLines: number;
R
Rob Lourens 已提交
252 253 254 255

		/**
		 * The maximum number of characters included per line.
		 */
R
Rob Lourens 已提交
256
		charsPerLine: number;
257 258
	}

259 260 261
	/**
	 * Options that apply to text search.
	 */
R
Rob Lourens 已提交
262
	export interface TextSearchOptions extends SearchOptions {
263
		/**
264
		 * The maximum number of results to be returned.
265
		 */
266 267
		maxResults: number;

R
Rob Lourens 已提交
268 269 270
		/**
		 * Options to specify the size of the result text preview.
		 */
271
		previewOptions?: TextSearchPreviewOptions;
272 273 274 275

		/**
		 * Exclude files larger than `maxFileSize` in bytes.
		 */
276
		maxFileSize?: number;
277 278 279 280 281

		/**
		 * Interpret files using this encoding.
		 * See the vscode setting `"files.encoding"`
		 */
282
		encoding?: string;
283 284 285 286 287 288 289 290 291 292

		/**
		 * Number of lines of context to include before each match.
		 */
		beforeContext?: number;

		/**
		 * Number of lines of context to include after each match.
		 */
		afterContext?: number;
293 294
	}

295 296 297 298 299 300 301 302 303 304 305 306 307 308
	/**
	 * Information collected when text search is complete.
	 */
	export interface TextSearchComplete {
		/**
		 * Whether the search hit the limit on the maximum number of search results.
		 * `maxResults` on [`TextSearchOptions`](#TextSearchOptions) specifies the max number of results.
		 * - If exactly that number of matches exist, this should be false.
		 * - If `maxResults` matches are returned and more exist, this should be true.
		 * - If search hits an internal limit which is less than `maxResults`, this should be true.
		 */
		limitHit?: boolean;
	}

309 310 311
	/**
	 * The parameters of a query for file search.
	 */
312
	export interface FileSearchQuery {
313 314 315
		/**
		 * The search pattern to match against file paths.
		 */
316 317
		pattern: string;
	}
318 319 320 321

	/**
	 * Options that apply to file search.
	 */
322
	export interface FileSearchOptions extends SearchOptions {
323
		/**
324
		 * The maximum number of results to be returned.
325
		 */
R
Rob Lourens 已提交
326
		maxResults?: number;
327 328 329 330 331 332

		/**
		 * A CancellationToken that represents the session for this search query. If the provider chooses to, this object can be used as the key for a cache,
		 * and searches with the same session object can search the same cache. When the token is cancelled, the session is complete and the cache can be cleared.
		 */
		session?: CancellationToken;
333 334
	}

R
Rob Lourens 已提交
335 336 337
	/**
	 * A preview of the text result.
	 */
338
	export interface TextSearchMatchPreview {
339
		/**
R
Rob Lourens 已提交
340
		 * The matching lines of text, or a portion of the matching line that contains the match.
341 342 343 344 345
		 */
		text: string;

		/**
		 * The Range within `text` corresponding to the text of the match.
346
		 * The number of matches must match the TextSearchMatch's range property.
347
		 */
348
		matches: Range | Range[];
349 350 351 352 353
	}

	/**
	 * A match from a text search
	 */
354
	export interface TextSearchMatch {
355 356 357
		/**
		 * The uri for the matching document.
		 */
358
		uri: Uri;
359 360

		/**
361
		 * The range of the match within the document, or multiple ranges for multiple matches.
362
		 */
363
		ranges: Range | Range[];
R
Rob Lourens 已提交
364

365
		/**
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
		 * A preview of the text match.
		 */
		preview: TextSearchMatchPreview;
	}

	/**
	 * A line of context surrounding a TextSearchMatch.
	 */
	export interface TextSearchContext {
		/**
		 * The uri for the matching document.
		 */
		uri: Uri;

		/**
		 * One line of text.
		 * previewOptions.charsPerLine applies to this
		 */
		text: string;

		/**
		 * The line number of this line of context.
388
		 */
389
		lineNumber: number;
390 391
	}

392 393
	export type TextSearchResult = TextSearchMatch | TextSearchContext;

394
	/**
R
Rob Lourens 已提交
395 396 397 398 399 400 401
	 * 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.
402
	 */
403
	export interface FileSearchProvider {
404 405 406 407 408 409
		/**
		 * 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 token A cancellation token.
		 */
410
		provideFileSearchResults(query: FileSearchQuery, options: FileSearchOptions, token: CancellationToken): ProviderResult<Uri[]>;
411
	}
412

R
Rob Lourens 已提交
413 414 415 416
	/**
	 * A TextSearchProvider provides search results for text results inside files in the workspace.
	 */
	export interface TextSearchProvider {
417 418 419 420 421 422 423
		/**
		 * 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.
		 */
424
		provideTextSearchResults(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): ProviderResult<TextSearchComplete>;
425 426
	}

427 428 429
	/**
	 * Options that can be set on a findTextInFiles search.
	 */
R
Rob Lourens 已提交
430
	export interface FindTextInFilesOptions {
431 432 433 434 435
		/**
		 * 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).
		 */
436
		include?: GlobPattern;
437 438 439 440 441 442 443 444 445 446 447

		/**
		 * 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 已提交
448
		maxResults?: number;
449 450 451 452 453

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

P
pkoushik 已提交
456 457 458 459
		/**
		 * Whether global files that exclude files, like .gitignore, should be respected.
		 * See the vscode setting `"search.useGlobalIgnoreFiles"`.
		 */
460
		useGlobalIgnoreFiles?: boolean;
P
pkoushik 已提交
461

462 463 464 465
		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
466
		followSymlinks?: boolean;
467 468 469 470 471

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

R
Rob Lourens 已提交
474 475 476
		/**
		 * Options to specify the size of the result text preview.
		 */
477
		previewOptions?: TextSearchPreviewOptions;
478 479 480 481 482 483 484 485 486 487

		/**
		 * Number of lines of context to include before each match.
		 */
		beforeContext?: number;

		/**
		 * Number of lines of context to include after each match.
		 */
		afterContext?: number;
R
Rob Lourens 已提交
488 489
	}

490
	export namespace workspace {
491 492 493 494 495 496 497 498 499
		/**
		 * Register a search provider.
		 *
		 * 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 已提交
500
		export function registerFileSearchProvider(scheme: string, provider: FileSearchProvider): Disposable;
501

502
		/**
R
Rob Lourens 已提交
503
		 * Register a text search provider.
504 505 506 507 508 509 510
		 *
		 * 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 已提交
511
		export function registerTextSearchProvider(scheme: string, provider: TextSearchProvider): Disposable;
512 513 514 515 516 517 518 519

		/**
		 * 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.
		 */
520
		export function findTextInFiles(query: TextSearchQuery, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
521 522 523 524 525 526 527 528 529

		/**
		 * 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.
		 */
530
		export function findTextInFiles(query: TextSearchQuery, options: FindTextInFilesOptions, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
531 532
	}

J
Johannes Rieken 已提交
533
	//#endregion
534

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

J
Joao Moreno 已提交
537 538 539
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
540 541 542 543 544 545 546
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564
	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;
	}
565

J
Johannes Rieken 已提交
566 567 568
	//#endregion

	//#region Joh: decorations
569 570 571

	//todo@joh -> make class
	export interface DecorationData {
572
		letter?: string;
573 574 575
		title?: string;
		color?: ThemeColor;
		priority?: number;
576
		bubble?: boolean;
J
Johannes Rieken 已提交
577
		source?: string; // hacky... we should remove it and use equality under the hood
578 579
	}

580 581 582 583 584 585
	export interface SourceControlResourceDecorations {
		source?: string;
		letter?: string;
		color?: ThemeColor;
	}

586
	export interface DecorationProvider {
587
		onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
588 589 590 591
		provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<DecorationData>;
	}

	export namespace window {
592
		export function registerDecorationProvider(provider: DecorationProvider): Disposable;
593 594 595
	}

	//#endregion
596

J
Johannes Rieken 已提交
597 598
	//#region André: debug

A
Andre Weinand 已提交
599 600
	// deprecated

601
	export interface DebugConfigurationProvider {
602
		/**
A
Andre Weinand 已提交
603 604
		 * Deprecated, use DebugAdapterDescriptorFactory.provideDebugAdapter instead.
		 * @deprecated Use DebugAdapterDescriptorFactory.createDebugAdapterDescriptor instead
605 606
		 */
		debugAdapterExecutable?(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult<DebugAdapterExecutable>;
607 608
	}

J
Johannes Rieken 已提交
609 610 611 612
	//#endregion

	//#region Rob, Matt: logging

613 614 615 616 617 618 619 620 621 622 623 624 625
	/**
	 * The severity level of a log message
	 */
	export enum LogLevel {
		Trace = 1,
		Debug = 2,
		Info = 3,
		Warning = 4,
		Error = 5,
		Critical = 6,
		Off = 7
	}

M
Matt Bierner 已提交
626 627 628 629 630
	export namespace env {
		/**
		 * Current logging level.
		 */
		export const logLevel: LogLevel;
631 632 633 634 635

		/**
		 * An [event](#Event) that fires when the log level has changed.
		 */
		export const onDidChangeLogLevel: Event<LogLevel>;
M
Matt Bierner 已提交
636 637
	}

J
Johannes Rieken 已提交
638 639 640
	//#endregion

	//#region Joao: SCM validation
641

J
Joao Moreno 已提交
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686
	/**
	 * 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 已提交
687

J
Johannes Rieken 已提交
688 689
	//#endregion

690 691 692 693 694 695 696 697 698 699 700 701 702
	//#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>;
703 704 705 706
	}

	//#endregion

707 708 709 710 711 712 713 714
	//#region Joao: SCM Input Box

	/**
	 * Represents the input box in the Source Control viewlet.
	 */
	export interface SourceControlInputBox {

		/**
J
Joao Moreno 已提交
715 716
			* Controls whether the input box is visible (default is `true`).
			*/
717 718 719 720 721
		visible: boolean;
	}

	//#endregion

722

723 724
	//#region Terminal

725 726 727 728 729 730 731 732 733 734 735 736 737 738
	/**
	 * An [event](#Event) which fires when a [Terminal](#Terminal)'s dimensions change.
	 */
	export interface TerminalDimensionsChangeEvent {
		/**
		 * The [terminal](#Terminal) for which the dimensions have changed.
		 */
		readonly terminal: Terminal;
		/**
		 * The new value for the [terminal's dimensions](#Terminal.dimensions).
		 */
		readonly dimensions: TerminalDimensions;
	}

739 740 741 742 743 744 745 746 747 748 749
	export interface TerminalDataWriteEvent {
		/**
		 * The [terminal](#Terminal) for which the data was written.
		 */
		readonly terminal: Terminal;
		/**
		 * The data being written.
		 */
		readonly data: string;
	}

750 751 752 753 754
	namespace window {
		/**
		 * An event which fires when the [dimensions](#Terminal.dimensions) of the terminal change.
		 */
		export const onDidChangeTerminalDimensions: Event<TerminalDimensionsChangeEvent>;
755 756 757 758 759 760 761

		/**
		 * An event which fires when the terminal's pty slave pseudo-device is written to. In other
		 * words, this provides access to the raw data stream from the process running within the
		 * terminal, including VT sequences.
		 */
		export const onDidWriteTerminalData: Event<TerminalDataWriteEvent>;
762 763
	}

D
Daniel Imms 已提交
764
	export interface Terminal {
765
		/**
766 767 768
		 * The current dimensions of the terminal. This will be `undefined` immediately after the
		 * terminal is created as the dimensions are not known until shortly after the terminal is
		 * created.
769
		 */
770
		readonly dimensions: TerminalDimensions | undefined;
771

D
Daniel Imms 已提交
772
		/**
D
Daniel Imms 已提交
773
		 * Fires when the terminal's pty slave pseudo-device is written to. In other words, this
D
Daniel Imms 已提交
774
		 * provides access to the raw data stream from the process running within the terminal,
775
		 * including VT sequences.
776 777
		 *
		 * @deprecated Use [window.onDidWriteTerminalData](#onDidWriteTerminalData).
D
Daniel Imms 已提交
778
		 */
779
		readonly onDidWriteData: Event<string>;
D
Daniel Imms 已提交
780 781
	}

D
Daniel Imms 已提交
782
	/**
783
	 * Represents the dimensions of a terminal.
D
Daniel Imms 已提交
784 785 786 787 788
	 */
	export interface TerminalDimensions {
		/**
		 * The number of columns in the terminal.
		 */
789
		readonly columns: number;
D
Daniel Imms 已提交
790 791 792 793

		/**
		 * The number of rows in the terminal.
		 */
794
		readonly rows: number;
D
Daniel Imms 已提交
795 796
	}

797
	//#endregion
J
Joao Moreno 已提交
798

799
	//#region Extension terminals
800

D
Daniel Imms 已提交
801 802
	export namespace window {
		/**
D
Daniel Imms 已提交
803
		 * Creates a [Terminal](#Terminal) where an extension controls the terminal.
D
Daniel Imms 已提交
804
		 *
805 806
		 * @param options An [ExtensionTerminalOptions](#ExtensionTerminalOptions) object describing
		 * the characteristics of the new terminal.
D
Daniel Imms 已提交
807 808
		 * @return A new Terminal.
		 */
809
		export function createTerminal(options: ExtensionTerminalOptions): Terminal;
D
Daniel Imms 已提交
810
	}
811

D
Daniel Imms 已提交
812 813 814
	/**
	 * Value-object describing what options a virtual process terminal should use.
	 */
815
	export interface ExtensionTerminalOptions {
D
Daniel Imms 已提交
816 817 818
		/**
		 * A human-readable string which will be used to represent the terminal in the UI.
		 */
819 820
		name: string;

D
Daniel Imms 已提交
821
		/**
822 823
		 * An implementation of [Pseudoterminal](#Pseudoterminal) that allows an extension to
		 * control a terminal.
D
Daniel Imms 已提交
824
		 */
825
		pty: Pseudoterminal;
826 827
	}

D
Daniel Imms 已提交
828
	/**
829
	 * Defines the interface of a terminal pty, enabling extensions to control a terminal.
D
Daniel Imms 已提交
830
	 */
831
	interface Pseudoterminal {
D
Daniel Imms 已提交
832 833
		/**
		 * An event that when fired will write data to the terminal. Unlike
834 835
		 * [Terminal.sendText](#Terminal.sendText) which sends text to the underlying _process_
		 * (the pty "slave"), this will write the text to the terminal itself (the pty "master").
D
Daniel Imms 已提交
836 837 838 839
		 *
		 * **Example:** Write red text to the terminal
		 * ```typescript
		 * const writeEmitter = new vscode.EventEmitter<string>();
840 841
		 * const pty: vscode.Pseudoterminal = {
		 *   onDidWrite: writeEmitter.event,
842 843
		 *   open: () => writeEmitter.fire('\x1b[31mHello world\x1b[0m'),
		 *   close: () => {}
D
Daniel Imms 已提交
844
		 * };
845
		 * vscode.window.createTerminal({ name: 'My terminal', pty });
D
Daniel Imms 已提交
846 847 848 849 850 851 852
		 * ```
		 *
		 * **Example:** Move the cursor to the 10th row and 20th column and write an asterisk
		 * ```typescript
		 * writeEmitter.fire('\x1b[10;20H*');
		 * ```
		 */
D
Daniel Imms 已提交
853
		onDidWrite: Event<string>;
854

D
Daniel Imms 已提交
855 856
		/**
		 * An event that when fired allows overriding the [dimensions](#Terminal.dimensions) of the
D
Daniel Imms 已提交
857
		 * terminal. Note that when set, the overridden dimensions will only take effect when they
D
Daniel Imms 已提交
858
		 * are lower than the actual dimensions of the terminal (ie. there will never be a scroll
859 860
		 * bar). Set to `undefined` for the terminal to go back to the regular dimensions (fit to
		 * the size of the panel).
D
Daniel Imms 已提交
861 862 863
		 *
		 * **Example:** Override the dimensions of a terminal to 20 columns and 10 rows
		 * ```typescript
864
		 * const dimensionsEmitter = new vscode.EventEmitter<vscode.TerminalDimensions>();
865
		 * const pty: vscode.Pseudoterminal = {
D
Daniel Imms 已提交
866
		 *   onDidWrite: writeEmitter.event,
867
		 *   onDidOverrideDimensions: dimensionsEmitter.event,
868
		 *   open: () => {
869
		 *     dimensionsEmitter.fire({
870 871 872 873
		 *       columns: 20,
		 *       rows: 10
		 *     });
		 *   },
874
		 *   close: () => {}
D
Daniel Imms 已提交
875
		 * };
876
		 * vscode.window.createTerminal({ name: 'My terminal', pty });
D
Daniel Imms 已提交
877 878
		 * ```
		 */
D
Daniel Imms 已提交
879
		onDidOverrideDimensions?: Event<TerminalDimensions | undefined>;
880

D
Daniel Imms 已提交
881
		/**
882
		 * An event that when fired will signal that the pty is closed and dispose of the terminal.
D
Daniel Imms 已提交
883
		 *
884
		 * **Example:** Exit the terminal when "y" is pressed, otherwise show a notification.
D
Daniel Imms 已提交
885 886
		 * ```typescript
		 * const writeEmitter = new vscode.EventEmitter<string>();
887
		 * const closeEmitter = new vscode.EventEmitter<vscode.TerminalDimensions>();
888
		 * const pty: vscode.Pseudoterminal = {
D
Daniel Imms 已提交
889
		 *   onDidWrite: writeEmitter.event,
890 891 892
		 *   onDidClose: closeEmitter.event,
		 *   open: () => writeEmitter.fire('Press y to exit successfully'),
		 *   close: () => {}
893
		 *   handleInput: data => {
894 895 896
		 *     if (data !== 'y') {
		 *       vscode.window.showInformationMessage('Something went wrong');
		 *     }
897
		 *     closeEmitter.fire();
898
		 *   }
D
Daniel Imms 已提交
899
		 * };
900
		 * vscode.window.createTerminal({ name: 'Exit example', pty });
D
Daniel Imms 已提交
901
		 */
902
		onDidClose?: Event<void>;
903

D
Daniel Imms 已提交
904
		/**
905
		 * Implement to handle when the pty is open and ready to start firing events.
D
Daniel Imms 已提交
906 907 908 909
		 *
		 * @param initialDimensions The dimensions of the terminal, this will be undefined if the
		 * terminal panel has not been opened before this is called.
		 */
910
		open(initialDimensions: TerminalDimensions | undefined): void;
D
Daniel Imms 已提交
911 912

		/**
913
		 * Implement to handle when the terminal is closed by an act of the user.
D
Daniel Imms 已提交
914
		 */
915
		close(): void;
D
Daniel Imms 已提交
916

D
Daniel Imms 已提交
917
		/**
918 919 920
		 * Implement to handle incoming keystrokes in the terminal or when an extension calls
		 * [Terminal.sendText](#Terminal.sendText). `data` contains the keystrokes/text serialized into
		 * their corresponding VT sequence representation.
D
Daniel Imms 已提交
921
		 *
922
		 * @param data The incoming data.
D
Daniel Imms 已提交
923 924 925 926 927
		 *
		 * **Example:** Echo input in the terminal. The sequence for enter (`\r`) is translated to
		 * CRLF to go to a new line and move the cursor to the start of the line.
		 * ```typescript
		 * const writeEmitter = new vscode.EventEmitter<string>();
928
		 * const pty: vscode.Pseudoterminal = {
D
Daniel Imms 已提交
929
		 *   onDidWrite: writeEmitter.event,
930 931
		 *   open: () => {},
		 *   close: () => {},
D
Daniel Imms 已提交
932
		 *   handleInput: data => writeEmitter.fire(data === '\r' ? '\r\n' : data)
D
Daniel Imms 已提交
933
		 * };
934
		 * vscode.window.createTerminal({ name: 'Local echo', pty });
D
Daniel Imms 已提交
935 936
		 * ```
		 */
D
Daniel Imms 已提交
937
		handleInput?(data: string): void;
938

D
Daniel Imms 已提交
939 940
		/**
		 * Implement to handle when the number of rows and columns that fit into the terminal panel
D
Daniel Imms 已提交
941 942 943
		 * changes, for example when font size changes or when the panel is resized. The initial
		 * state of a terminal's dimensions should be treated as `undefined` until this is triggered
		 * as the size of a terminal isn't know until it shows up in the user interface.
D
Daniel Imms 已提交
944
		 *
D
Daniel Imms 已提交
945 946 947 948 949
		 * When dimensions are overridden by
		 * [onDidOverrideDimensions](#Pseudoterminal.onDidOverrideDimensions), `setDimensions` will
		 * continue to be called with the regular panel dimensions, allowing the extension continue
		 * to react dimension changes.
		 *
D
Daniel Imms 已提交
950 951
		 * @param dimensions The new dimensions.
		 */
D
Daniel Imms 已提交
952
		setDimensions?(dimensions: TerminalDimensions): void;
953 954 955 956
	}

	//#endregion

957 958 959 960 961 962 963
	//#region Joh -> exclusive document filters

	export interface DocumentFilter {
		exclusive?: boolean;
	}

	//#endregion
C
Christof Marti 已提交
964

J
Johannes Rieken 已提交
965
	//#region mjbvz,joh: https://github.com/Microsoft/vscode/issues/43768
966 967 968
	export interface FileRenameEvent {
		readonly oldUri: Uri;
		readonly newUri: Uri;
C
Christof Marti 已提交
969 970
	}

971 972 973
	export interface FileWillRenameEvent {
		readonly oldUri: Uri;
		readonly newUri: Uri;
974
		waitUntil(thenable: Thenable<WorkspaceEdit>): void;
975 976
	}

977
	export namespace workspace {
978
		export const onWillRenameFile: Event<FileWillRenameEvent>;
979
		export const onDidRenameFile: Event<FileRenameEvent>;
980 981
	}
	//#endregion
982

983 984 985 986 987 988 989 990
	//#region Alex - OnEnter enhancement
	export interface OnEnterRule {
		/**
		 * This rule will only execute if the text above the this line matches this regular expression.
		 */
		oneLineAboveText?: RegExp;
	}
	//#endregion
991

992 993
	//#region Tree View

S
Sandeep Somavarapu 已提交
994 995 996 997 998
	export interface TreeView<T> {

		/**
		 * An optional human-readable message that will be rendered in the view.
		 */
999
		message?: string;
S
Sandeep Somavarapu 已提交
1000 1001 1002

	}

1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013
	/**
	 * Label describing the [Tree item](#TreeItem)
	 */
	export interface TreeItemLabel {

		/**
		 * A human-readable string describing the [Tree item](#TreeItem).
		 */
		label: string;

		/**
S
Sandeep Somavarapu 已提交
1014
		 * Ranges in the label to highlight. A range is defined as a tuple of two number where the
S
Sandeep Somavarapu 已提交
1015
		 * first is the inclusive start index and the second the exclusive end index
1016
		 */
S
Sandeep Somavarapu 已提交
1017
		highlights?: [number, number][];
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032

	}

	export class TreeItem2 extends TreeItem {
		/**
		 * Label describing this item. When `falsy`, it is derived from [resourceUri](#TreeItem.resourceUri).
		 */
		label?: string | TreeItemLabel | /* for compilation */ any;

		/**
		 * @param label Label describing this item
		 * @param collapsibleState [TreeItemCollapsibleState](#TreeItemCollapsibleState) of the tree item. Default is [TreeItemCollapsibleState.None](#TreeItemCollapsibleState.None)
		 */
		constructor(label: TreeItemLabel, collapsibleState?: TreeItemCollapsibleState);
	}
1033
	//#endregion
1034

1035
	//#region CustomExecution
1036 1037 1038 1039 1040
	/**
	 * Class used to execute an extension callback as a task.
	 */
	export class CustomExecution2 {
		/**
D
Daniel Imms 已提交
1041
		 * @param process The [Pseudoterminal](#Pseudoterminal) to be used by the task to display output.
1042 1043
		 * @param callback The callback that will be called when the task is started by a user.
		 */
1044
		constructor(callback: (thisArg?: any) => Thenable<Pseudoterminal>);
1045 1046

		/**
1047
		 * The callback used to execute the task. Cancellation should be handled using
1048 1049
		 * [Pseudoterminal.close](#Pseudoterminal.close). When the task is complete fire
		 * [Pseudoterminal.onDidClose](#Pseudoterminal.onDidClose).
1050
		 */
1051
		callback: (thisArg?: any) => Thenable<Pseudoterminal>;
1052 1053
	}

1054 1055 1056
	/**
	 * A task to execute
	 */
G
Gabriel DeBacker 已提交
1057
	export class Task2 extends Task {
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069
		/**
		 * Creates a new task.
		 *
		 * @param definition The task definition as defined in the taskDefinitions extension point.
		 * @param scope Specifies the task's scope. It is either a global or a workspace task or a task for a specific workspace folder.
		 * @param name The task's name. Is presented in the user interface.
		 * @param source The task's source (e.g. 'gulp', 'npm', ...). Is presented in the user interface.
		 * @param execution The process or shell execution.
		 * @param problemMatchers the names of problem matchers to use, like '$tsc'
		 *  or '$eslint'. Problem matchers can be contributed by an extension using
		 *  the `problemMatchers` extension point.
		 */
A
Alex Ross 已提交
1070
		constructor(taskDefinition: TaskDefinition, scope: WorkspaceFolder | TaskScope.Global | TaskScope.Workspace, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]);
1071 1072 1073 1074

		/**
		 * The task's execution engine
		 */
A
Alex Ross 已提交
1075
		execution2?: ProcessExecution | ShellExecution | CustomExecution2;
1076
	}
1077
	//#endregion
G
Gabriel DeBacker 已提交
1078

1079 1080 1081 1082 1083 1084 1085 1086
	//#region Tasks
	export interface TaskPresentationOptions {
		/**
		 * Controls whether the task is executed in a specific terminal group using split panes.
		 */
		group?: string;
	}
	//#endregion
1087

1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134
	// #region Ben - status bar item with ID and Name

	export namespace window {

		/**
		 * Options to configure the status bar item.
		 */
		export interface StatusBarItemOptions {

			/**
			 * A unique identifier of the status bar item. The identifier
			 * is for example used to allow a user to show or hide the
			 * status bar item in the UI.
			 */
			id: string;

			/**
			 * A human readable name of the status bar item. The name is
			 * for example used as a label in the UI to show or hide the
			 * status bar item.
			 */
			name: string;

			/**
			 * The alignment of the status bar item.
			 */
			alignment?: StatusBarAlignment;

			/**
			 * The priority of the status bar item. Higher value means the item should
			 * be shown more to the left.
			 */
			priority?: number;
		}

		/**
		 * Creates a status bar [item](#StatusBarItem).
		 *
		 * @param options The options of the item. If not provided, some default values
		 * will be assumed. For example, the `StatusBarItemOptions.id` will be the id
		 * of the extension and the `StatusBarItemOptions.name` will be the extension name.
		 * @return A new status bar item.
		 */
		export function createStatusBarItem(options?: StatusBarItemOptions): StatusBarItem;
	}

	//#endregion
1135

1136 1137 1138 1139 1140
	//#region Joh - CompletionItemKindModifier, https://github.com/microsoft/vscode/issues/23927

	export enum CompletionItemKindModifier {
		Deprecated = 1
	}
1141 1142

	export interface CompletionItem {
1143

1144
		/**
1145
		 *
1146
		 */
1147
		kind2?: CompletionItemKind | { base: CompletionItemKind, modifier: ReadonlyArray<CompletionItemKindModifier> };
1148 1149 1150
	}

	//#endregion
1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196

	// #region Ben - extension auth flow (desktop+web)

	export namespace env {

		export interface AppUriOptions {
			payload?: {
				path?: string;
				query?: string;
				fragment?: string;
			};
		}

		/**
		 * Creates a Uri that - if opened in a browser - will result in a
		 * registered [UriHandler](#UriHandler) to fire. The handler's
		 * Uri will be configured with the path, query and fragment of
		 * [AppUriOptions](#AppUriOptions) if provided, otherwise it will be empty.
		 *
		 * Extensions should not make any assumptions about the resulting
		 * Uri and should not alter it in anyway. Rather, extensions can e.g.
		 * use this Uri in an authentication flow, by adding the Uri as
		 * callback query argument to the server to authenticate to.
		 *
		 * Note: If the server decides to add additional query parameters to the Uri
		 * (e.g. a token or secret), it will appear in the Uri that is passed
		 * to the [UriHandler](#UriHandler).
		 *
		 * **Example** of an authentication flow:
		 * ```typescript
		 * vscode.window.registerUriHandler({
		 *   handleUri(uri: vscode.Uri): vscode.ProviderResult<void> {
		 *     if (uri.path === '/did-authenticate') {
		 *       console.log(uri.toString());
		 *     }
		 *   }
		 * });
		 *
		 * const callableUri = await vscode.env.createAppUri({ payload: { path: '/did-authenticate' } });
		 * await vscode.env.openExternal(callableUri);
		 * ```
		 */
		export function createAppUri(options?: AppUriOptions): Thenable<Uri>;
	}

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