vscode.proposed.d.ts 33.1 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 20
	//#region Joh - selection range provider

21 22
	export class SelectionRangeKind {

J
Johannes Rieken 已提交
23 24 25
		/**
		 * Empty Kind.
		 */
26
		static readonly Empty: SelectionRangeKind;
J
Johannes Rieken 已提交
27 28

		/**
29
		 * The statement kind, its value is `statement`, possible extensions can be
J
Johannes Rieken 已提交
30 31
		 * `statement.if` etc
		 */
32
		static readonly Statement: SelectionRangeKind;
J
Johannes Rieken 已提交
33 34 35 36 37 38

		/**
		 * The declaration kind, its value is `declaration`, possible extensions can be
		 * `declaration.function`, `declaration.class` etc.
		 */
		static readonly Declaration: SelectionRangeKind;
39 40 41 42 43 44 45 46 47 48 49

		readonly value: string;

		private constructor(value: string);

		append(value: string): SelectionRangeKind;
	}

	export class SelectionRange {
		kind: SelectionRangeKind;
		range: Range;
50
		constructor(range: Range, kind: SelectionRangeKind);
51 52
	}

53
	export interface SelectionRangeProvider {
54 55 56 57
		/**
		 * Provide selection ranges starting at a given position. The first range must [contain](#Range.contains)
		 * position and subsequent ranges must contain the previous range.
		 */
58
		provideSelectionRanges(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<SelectionRange[]>;
59 60 61 62 63 64 65 66
	}

	export namespace languages {
		export function registerSelectionRangeProvider(selector: DocumentSelector, provider: SelectionRangeProvider): Disposable;
	}

	//#endregion

67 68 69
	//#region Joh - read/write in chunks

	export interface FileSystemProvider {
J
Johannes Rieken 已提交
70
		open?(resource: Uri, options: { create: boolean }): number | Thenable<number>;
71 72 73 74 75 76 77
		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

78
	//#region Rob: search provider
79

80 81 82
	/**
	 * The parameters of a query for text search.
	 */
83
	export interface TextSearchQuery {
84 85 86
		/**
		 * The text pattern to search for.
		 */
87
		pattern: string;
88

R
Rob Lourens 已提交
89 90 91 92 93
		/**
		 * Whether or not `pattern` should match multiple lines of text.
		 */
		isMultiline?: boolean;

94 95 96
		/**
		 * Whether or not `pattern` should be interpreted as a regular expression.
		 */
R
Rob Lourens 已提交
97
		isRegExp?: boolean;
98 99 100 101

		/**
		 * Whether or not the search should be case-sensitive.
		 */
R
Rob Lourens 已提交
102
		isCaseSensitive?: boolean;
103 104 105 106

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

110 111 112 113 114 115 116 117 118 119
	/**
	 * 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 已提交
120
	export interface SearchOptions {
121 122 123
		/**
		 * The root folder to search within.
		 */
124
		folder: Uri;
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139

		/**
		 * 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 已提交
140
		useIgnoreFiles: boolean;
141 142 143 144 145

		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
146
		followSymlinks: boolean;
P
pkoushik 已提交
147 148 149 150 151 152 153

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

154
	}
155

R
Rob Lourens 已提交
156 157
	/**
	 * Options to specify the size of the result text preview.
R
Rob Lourens 已提交
158
	 * These options don't affect the size of the match itself, just the amount of preview text.
R
Rob Lourens 已提交
159
	 */
160
	export interface TextSearchPreviewOptions {
161
		/**
R
Rob Lourens 已提交
162
		 * The maximum number of lines in the preview.
R
Rob Lourens 已提交
163
		 * Only search providers that support multiline search will ever return more than one line in the match.
164
		 */
R
Rob Lourens 已提交
165
		matchLines: number;
R
Rob Lourens 已提交
166 167 168 169

		/**
		 * The maximum number of characters included per line.
		 */
R
Rob Lourens 已提交
170
		charsPerLine: number;
171 172
	}

173 174 175
	/**
	 * Options that apply to text search.
	 */
R
Rob Lourens 已提交
176
	export interface TextSearchOptions extends SearchOptions {
177
		/**
178
		 * The maximum number of results to be returned.
179
		 */
180 181
		maxResults: number;

R
Rob Lourens 已提交
182 183 184
		/**
		 * Options to specify the size of the result text preview.
		 */
185
		previewOptions?: TextSearchPreviewOptions;
186 187 188 189

		/**
		 * Exclude files larger than `maxFileSize` in bytes.
		 */
190
		maxFileSize?: number;
191 192 193 194 195

		/**
		 * Interpret files using this encoding.
		 * See the vscode setting `"files.encoding"`
		 */
196
		encoding?: string;
197 198 199 200 201 202 203 204 205 206

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

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

209 210 211 212 213 214 215 216 217 218 219 220 221 222
	/**
	 * 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;
	}

223 224 225
	/**
	 * The parameters of a query for file search.
	 */
226
	export interface FileSearchQuery {
227 228 229
		/**
		 * The search pattern to match against file paths.
		 */
230 231
		pattern: string;
	}
232 233 234 235

	/**
	 * Options that apply to file search.
	 */
236
	export interface FileSearchOptions extends SearchOptions {
237
		/**
238
		 * The maximum number of results to be returned.
239
		 */
R
Rob Lourens 已提交
240
		maxResults?: number;
241 242 243 244 245 246

		/**
		 * 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;
247 248
	}

249
	/**
250
	 * Options that apply to requesting the file index.
251
	 */
252
	export interface FileIndexOptions extends SearchOptions { }
253

R
Rob Lourens 已提交
254 255 256
	/**
	 * A preview of the text result.
	 */
257
	export interface TextSearchMatchPreview {
258
		/**
R
Rob Lourens 已提交
259
		 * The matching lines of text, or a portion of the matching line that contains the match.
260 261 262 263 264
		 */
		text: string;

		/**
		 * The Range within `text` corresponding to the text of the match.
265
		 * The number of matches must match the TextSearchMatch's range property.
266
		 */
267
		matches: Range | Range[];
268 269 270 271 272
	}

	/**
	 * A match from a text search
	 */
273
	export interface TextSearchMatch {
274 275 276
		/**
		 * The uri for the matching document.
		 */
277
		uri: Uri;
278 279

		/**
280
		 * The range of the match within the document, or multiple ranges for multiple matches.
281
		 */
282
		ranges: Range | Range[];
R
Rob Lourens 已提交
283

284
		/**
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
		 * 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.
307
		 */
308
		lineNumber: number;
309 310
	}

311 312
	export type TextSearchResult = TextSearchMatch | TextSearchContext;

313
	/**
R
Rob Lourens 已提交
314 315 316 317 318 319 320 321 322 323
	 * 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.
	 */
324
	export interface FileIndexProvider {
325
		/**
R
Rob Lourens 已提交
326
		 * Provide the set of files in the folder.
327 328 329
		 * @param options A set of options to consider while searching.
		 * @param token A cancellation token.
		 */
330
		provideFileIndex(options: FileIndexOptions, token: CancellationToken): ProviderResult<Uri[]>;
331 332
	}

333
	/**
R
Rob Lourens 已提交
334 335 336 337 338 339 340 341 342
	 * 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)
343
	 */
344
	export interface FileSearchProvider {
345 346 347 348 349 350 351
		/**
		 * 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.
		 */
352
		provideFileSearchResults(query: FileSearchQuery, options: FileSearchOptions, token: CancellationToken): ProviderResult<Uri[]>;
353
	}
354

R
Rob Lourens 已提交
355 356 357 358
	/**
	 * A TextSearchProvider provides search results for text results inside files in the workspace.
	 */
	export interface TextSearchProvider {
359 360 361 362 363 364 365
		/**
		 * 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.
		 */
366
		provideTextSearchResults(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): ProviderResult<TextSearchComplete>;
367 368
	}

369 370 371
	/**
	 * Options that can be set on a findTextInFiles search.
	 */
R
Rob Lourens 已提交
372
	export interface FindTextInFilesOptions {
373 374 375 376 377
		/**
		 * 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).
		 */
378
		include?: GlobPattern;
379 380 381 382 383 384 385 386 387 388 389

		/**
		 * 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 已提交
390
		maxResults?: number;
391 392 393 394 395

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

P
pkoushik 已提交
398 399 400 401
		/**
		 * Whether global files that exclude files, like .gitignore, should be respected.
		 * See the vscode setting `"search.useGlobalIgnoreFiles"`.
		 */
402
		useGlobalIgnoreFiles?: boolean;
P
pkoushik 已提交
403

404 405 406 407
		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
408
		followSymlinks?: boolean;
409 410 411 412 413

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

R
Rob Lourens 已提交
416 417 418
		/**
		 * Options to specify the size of the result text preview.
		 */
419
		previewOptions?: TextSearchPreviewOptions;
420 421 422 423 424 425 426 427 428 429

		/**
		 * 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 已提交
430 431
	}

432
	export namespace workspace {
433 434 435 436 437
		/**
		 * DEPRECATED
		 */
		export function registerSearchProvider(): Disposable;

438
		/**
R
Rob Lourens 已提交
439
		 * Register a file index provider.
440 441 442 443 444 445 446
		 *
		 * 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 已提交
447
		export function registerFileIndexProvider(scheme: string, provider: FileIndexProvider): Disposable;
448 449 450 451 452 453 454 455 456 457

		/**
		 * 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 已提交
458
		export function registerFileSearchProvider(scheme: string, provider: FileSearchProvider): Disposable;
459

460
		/**
R
Rob Lourens 已提交
461
		 * Register a text search provider.
462 463 464 465 466 467 468
		 *
		 * 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 已提交
469
		export function registerTextSearchProvider(scheme: string, provider: TextSearchProvider): Disposable;
470 471 472 473 474 475 476 477

		/**
		 * 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.
		 */
478
		export function findTextInFiles(query: TextSearchQuery, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
479 480 481 482 483 484 485 486 487

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

J
Johannes Rieken 已提交
491
	//#endregion
492

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

J
Joao Moreno 已提交
495 496 497
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
498 499 500 501 502 503 504
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
	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;
	}
523

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

	//#region Joh: decorations
527 528 529

	//todo@joh -> make class
	export interface DecorationData {
530
		letter?: string;
531 532 533
		title?: string;
		color?: ThemeColor;
		priority?: number;
534
		bubble?: boolean;
J
Johannes Rieken 已提交
535
		source?: string; // hacky... we should remove it and use equality under the hood
536 537
	}

538 539 540 541 542 543
	export interface SourceControlResourceDecorations {
		source?: string;
		letter?: string;
		color?: ThemeColor;
	}

544
	export interface DecorationProvider {
545
		onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
546 547 548 549
		provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<DecorationData>;
	}

	export namespace window {
550
		export function registerDecorationProvider(provider: DecorationProvider): Disposable;
551 552 553
	}

	//#endregion
554

J
Johannes Rieken 已提交
555 556
	//#region André: debug

A
Andre Weinand 已提交
557 558
	// deprecated

559
	export interface DebugConfigurationProvider {
560
		/**
A
Andre Weinand 已提交
561 562
		 * Deprecated, use DebugAdapterDescriptorFactory.provideDebugAdapter instead.
		 * @deprecated Use DebugAdapterDescriptorFactory.createDebugAdapterDescriptor instead
563 564
		 */
		debugAdapterExecutable?(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult<DebugAdapterExecutable>;
565 566
	}

J
Johannes Rieken 已提交
567 568 569 570
	//#endregion

	//#region Rob, Matt: logging

571 572 573 574 575 576 577 578 579 580 581 582 583
	/**
	 * 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 已提交
584 585 586 587 588
	export namespace env {
		/**
		 * Current logging level.
		 */
		export const logLevel: LogLevel;
589 590 591 592 593

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

J
Johannes Rieken 已提交
596 597 598
	//#endregion

	//#region Joao: SCM validation
599

J
Joao Moreno 已提交
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
	/**
	 * 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 已提交
645

J
Johannes Rieken 已提交
646 647
	//#endregion

648 649 650 651 652 653 654 655 656 657 658 659 660
	//#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>;
661 662 663 664
	}

	//#endregion

665 666 667 668 669 670 671 672
	//#region Joao: SCM Input Box

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

		/**
J
Joao Moreno 已提交
673 674
			* Controls whether the input box is visible (default is `true`).
			*/
675 676 677 678 679
		visible: boolean;
	}

	//#endregion

680 681 682 683 684
	//#region Comments
	/**
	 * Comments provider related APIs are still in early stages, they may be changed significantly during our API experiments.
	 */

685
	interface CommentInfo {
686 687 688
		/**
		 * All of the comment threads associated with the document.
		 */
689
		threads: CommentThread[];
690 691 692 693

		/**
		 * The ranges of the document which support commenting.
		 */
694
		commentingRanges?: Range[];
R
rebornix 已提交
695 696 697 698 699

		/**
		 * If it's in draft mode or not
		 */
		inDraftMode?: boolean;
700 701
	}

702 703 704 705 706 707 708 709 710 711 712
	export enum CommentThreadCollapsibleState {
		/**
		 * Determines an item is collapsed
		 */
		Collapsed = 0,
		/**
		 * Determines an item is expanded
		 */
		Expanded = 1
	}

713 714 715
	/**
	 * A collection of comments representing a conversation at a particular range in a document.
	 */
M
Matt Bierner 已提交
716
	interface CommentThread {
717 718 719
		/**
		 * A unique identifier of the comment thread.
		 */
720
		threadId: string;
721 722 723 724

		/**
		 * The uri of the document the thread has been created on.
		 */
725
		resource: Uri;
726 727 728 729 730

		/**
		 * The range the comment thread is located within the document. The thread icon will be shown
		 * at the first line of the range.
		 */
M
Matt Bierner 已提交
731
		range: Range;
732 733 734 735

		/**
		 * The ordered comments of the thread.
		 */
M
Matt Bierner 已提交
736
		comments: Comment[];
737 738 739 740

		/**
		 * Whether the thread should be collapsed or expanded when opening the document. Defaults to Collapsed.
		 */
741
		collapsibleState?: CommentThreadCollapsibleState;
M
Matt Bierner 已提交
742 743
	}

744 745 746
	/**
	 * A comment is displayed within the editor or the Comments Panel, depending on how it is provided.
	 */
M
Matt Bierner 已提交
747
	interface Comment {
748 749 750
		/**
		 * The id of the comment
		 */
P
Peng Lyu 已提交
751
		commentId: string;
752 753 754 755

		/**
		 * The text of the comment
		 */
M
Matt Bierner 已提交
756
		body: MarkdownString;
757 758 759 760

		/**
		 * The display name of the user who created the comment
		 */
M
Matt Bierner 已提交
761
		userName: string;
762 763

		/**
764 765 766 767 768 769 770
		 * The icon path for the user who created the comment
		 */
		userIconPath?: Uri;


		/**
		 * @deprecated Use userIconPath instead. The avatar src of the user who created the comment
771
		 */
772
		gravatar?: string;
773 774 775 776 777 778 779 780 781

		/**
		 * Whether the current user has permission to edit the comment.
		 *
		 * This will be treated as false if the comment is provided by a `WorkspaceCommentProvider`, or
		 * if it is provided by a `DocumentCommentProvider` and  no `editComment` method is given.
		 */
		canEdit?: boolean;

782 783 784 785 786 787 788 789
		/**
		 * Whether the current user has permission to delete the comment.
		 *
		 * This will be treated as false if the comment is provided by a `WorkspaceCommentProvider`, or
		 * if it is provided by a `DocumentCommentProvider` and  no `deleteComment` method is given.
		 */
		canDelete?: boolean;

790 791 792
		/**
		 * The command to be executed if the comment is selected in the Comments Panel
		 */
793
		command?: Command;
R
rebornix 已提交
794 795

		isDraft?: boolean;
P
Peng Lyu 已提交
796
		commentReactions?: CommentReaction[];
M
Matt Bierner 已提交
797 798
	}

799 800 801 802 803 804 805 806 807 808 809 810 811 812 813
	export interface CommentThreadChangedEvent {
		/**
		 * Added comment threads.
		 */
		readonly added: CommentThread[];

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

		/**
		 * Changed comment threads.
		 */
		readonly changed: CommentThread[];
R
rebornix 已提交
814 815 816 817 818

		/**
		 * Changed draft mode
		 */
		readonly inDraftMode: boolean;
819 820
	}

P
Peng Lyu 已提交
821 822
	interface CommentReaction {
		readonly label?: string;
P
Peng Lyu 已提交
823
		readonly hasReacted?: boolean;
P
Peng Lyu 已提交
824 825
	}

826
	interface DocumentCommentProvider {
827 828 829
		/**
		 * Provide the commenting ranges and comment threads for the given document. The comments are displayed within the editor.
		 */
830
		provideDocumentComments(document: TextDocument, token: CancellationToken): Promise<CommentInfo>;
831 832 833 834

		/**
		 * Called when a user adds a new comment thread in the document at the specified range, with body text.
		 */
835
		createNewCommentThread(document: TextDocument, range: Range, text: string, token: CancellationToken): Promise<CommentThread>;
836 837 838 839

		/**
		 * Called when a user replies to a new comment thread in the document at the specified range, with body text.
		 */
840
		replyToCommentThread(document: TextDocument, range: Range, commentThread: CommentThread, text: string, token: CancellationToken): Promise<CommentThread>;
841 842

		/**
N
Nick Schonning 已提交
843
		 * Called when a user edits the comment body to the be new text.
844
		 */
845
		editComment?(document: TextDocument, comment: Comment, text: string, token: CancellationToken): Promise<void>;
846

847 848 849 850 851
		/**
		 * Called when a user deletes the comment.
		 */
		deleteComment?(document: TextDocument, comment: Comment, token: CancellationToken): Promise<void>;

852 853 854
		startDraft?(document: TextDocument, token: CancellationToken): Promise<void>;
		deleteDraft?(document: TextDocument, token: CancellationToken): Promise<void>;
		finishDraft?(document: TextDocument, token: CancellationToken): Promise<void>;
R
rebornix 已提交
855 856 857 858 859

		startDraftLabel?: string;
		deleteDraftLabel?: string;
		finishDraftLabel?: string;

P
Peng Lyu 已提交
860 861 862
		addReaction?(document: TextDocument, comment: Comment, reaction: CommentReaction): Promise<void>;
		deleteReaction?(document: TextDocument, comment: Comment, reaction: CommentReaction): Promise<void>;
		reactionGroup?: CommentReaction[];
P
Peng Lyu 已提交
863

864 865 866
		/**
		 * Notify of updates to comment threads.
		 */
867
		onDidChangeCommentThreads: Event<CommentThreadChangedEvent>;
868 869 870
	}

	interface WorkspaceCommentProvider {
871 872 873 874
		/**
		 * Provide all comments for the workspace. Comments are shown within the comments panel. Selecting a comment
		 * from the panel runs the comment's command.
		 */
875
		provideWorkspaceComments(token: CancellationToken): Promise<CommentThread[]>;
876 877 878 879

		/**
		 * Notify of updates to comment threads.
		 */
880
		onDidChangeCommentThreads: Event<CommentThreadChangedEvent>;
M
Matt Bierner 已提交
881 882 883
	}

	namespace workspace {
884 885
		export function registerDocumentCommentProvider(provider: DocumentCommentProvider): Disposable;
		export function registerWorkspaceCommentProvider(provider: WorkspaceCommentProvider): Disposable;
M
Matt Bierner 已提交
886
	}
887 888
	//#endregion

889 890
	//#region Terminal

D
Daniel Imms 已提交
891
	export interface Terminal {
D
Daniel Imms 已提交
892
		/**
D
Daniel Imms 已提交
893
		 * Fires when the terminal's pty slave pseudo-device is written to. In other words, this
D
Daniel Imms 已提交
894
		 * provides access to the raw data stream from the process running within the terminal,
895
		 * including VT sequences.
D
Daniel Imms 已提交
896
		 */
897
		onDidWriteData: Event<string>;
D
Daniel Imms 已提交
898 899
	}

D
Daniel Imms 已提交
900
	/**
901
	 * Represents the dimensions of a terminal.
D
Daniel Imms 已提交
902 903 904 905 906
	 */
	export interface TerminalDimensions {
		/**
		 * The number of columns in the terminal.
		 */
907
		readonly columns: number;
D
Daniel Imms 已提交
908 909 910 911

		/**
		 * The number of rows in the terminal.
		 */
912
		readonly rows: number;
D
Daniel Imms 已提交
913 914
	}

915 916 917
	/**
	 * 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
918
	 * compatibility as the regular terminal.
D
Daniel Imms 已提交
919 920 921 922
	 *
	 * 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
923
	 * TerminalRenderer essentially acts as a process. For example when an
924 925
	 * [Terminal.onDidWriteData](#Terminal.onDidWriteData) listener is registered, that will fire
	 * when [TerminalRenderer.write](#TerminalRenderer.write) is called. Similarly when
D
Daniel Imms 已提交
926
	 * [Terminal.sendText](#Terminal.sendText) is triggered that will fire the
927
	 * [TerminalRenderer.onDidAcceptInput](#TerminalRenderer.onDidAcceptInput) event.
928 929 930 931 932 933 934
	 *
	 * **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');
	 * ```
935
	 */
936
	export interface TerminalRenderer {
937 938 939
		/**
		 * The name of the terminal, this will appear in the terminal selector.
		 */
940 941
		name: string;

D
Daniel Imms 已提交
942 943 944 945
		/**
		 * 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).
946 947 948 949 950 951 952 953
		 *
		 * **Example:** Override the dimensions of a TerminalRenderer to 20 columns and 10 rows
		 * ```typescript
		 * terminalRenderer.dimensions = {
		 *   cols: 20,
		 *   rows: 10
		 * };
		 * ```
D
Daniel Imms 已提交
954
		 */
955
		dimensions: TerminalDimensions | undefined;
D
Daniel Imms 已提交
956 957 958 959 960 961 962

		/**
		 * 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.
		 */
963
		readonly maximumDimensions: TerminalDimensions | undefined;
964

965
		/**
966
		 * The corresponding [Terminal](#Terminal) for this TerminalRenderer.
967
		 */
968
		readonly terminal: Terminal;
969

970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985
		/**
		 * 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 已提交
986
		write(text: string): void;
987

988 989 990 991
		/**
		 * 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.
992 993 994 995 996
		 *
		 * **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');
997
		 * terminalRenderer.onDidAcceptInput(data => {
998
		 *   console.log(data); // 'Hello world'
999 1000 1001
		 * });
		 * terminalRenderer.terminal.then(t => t.sendText('Hello world'));
		 * ```
1002
		 */
1003
		readonly onDidAcceptInput: Event<string>;
1004

D
Daniel Imms 已提交
1005 1006 1007 1008
		/**
		 * An event which fires when the [maximum dimensions](#TerminalRenderer.maimumDimensions) of
		 * the terminal renderer change.
		 */
1009
		readonly onDidChangeMaximumDimensions: Event<TerminalDimensions>;
1010 1011
	}

1012
	export namespace window {
D
Daniel Imms 已提交
1013 1014 1015 1016 1017
		/**
		 * Create a [TerminalRenderer](#TerminalRenderer).
		 *
		 * @param name The name of the terminal renderer, this shows up in the terminal selector.
		 */
1018
		export function createTerminalRenderer(name: string): TerminalRenderer;
1019 1020 1021
	}

	//#endregion
J
Joao Moreno 已提交
1022

1023 1024 1025 1026 1027 1028 1029
	//#region Joh -> exclusive document filters

	export interface DocumentFilter {
		exclusive?: boolean;
	}

	//#endregion
C
Christof Marti 已提交
1030

J
Johannes Rieken 已提交
1031
	//#region mjbvz,joh: https://github.com/Microsoft/vscode/issues/43768
1032 1033 1034
	export interface FileRenameEvent {
		readonly oldUri: Uri;
		readonly newUri: Uri;
C
Christof Marti 已提交
1035 1036
	}

1037 1038 1039
	export interface FileWillRenameEvent {
		readonly oldUri: Uri;
		readonly newUri: Uri;
1040
		waitUntil(thenable: Thenable<WorkspaceEdit>): void;
1041 1042
	}

1043
	export namespace workspace {
1044
		export const onWillRenameFile: Event<FileWillRenameEvent>;
1045
		export const onDidRenameFile: Event<FileRenameEvent>;
1046 1047
	}
	//#endregion
1048

1049 1050 1051 1052 1053 1054 1055 1056
	//#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
1057

1058 1059
	//#region Tree View

S
Sandeep Somavarapu 已提交
1060 1061 1062 1063 1064 1065 1066 1067 1068
	export interface TreeView<T> {

		/**
		 * An optional human-readable message that will be rendered in the view.
		 */
		message?: string | MarkdownString;

	}

1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079
	/**
	 * Label describing the [Tree item](#TreeItem)
	 */
	export interface TreeItemLabel {

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

		/**
S
Sandeep Somavarapu 已提交
1080
		 * Ranges in the label to highlight. A range is defined as a tuple of two number where the
S
Sandeep Somavarapu 已提交
1081
		 * first is the inclusive start index and the second the exclusive end index
1082
		 */
S
Sandeep Somavarapu 已提交
1083
		highlights?: [number, number][];
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098

	}

	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);
	}
1099 1100
	//#endregion

M
Matt Bierner 已提交
1101
	//#region SignatureHelpContext active parameters - mjbvz
1102 1103 1104 1105
	export interface SignatureHelpContext {
		/**
		 * The currently active [`SignatureHelp`](#SignatureHelp).
		 *
1106 1107
		 * The `activeSignatureHelp` has its [`SignatureHelp.activeSignature`] field updated based on
		 * the user arrowing through available signatures.
1108 1109 1110 1111
		 */
		readonly activeSignatureHelp?: SignatureHelp;
	}
	//#endregion
1112

1113
	//#region CodeAction.isPreferred - mjbvz
1114 1115
	export interface CodeAction {
		/**
M
Matt Bierner 已提交
1116
		 * Marks this as a preferred action. Preferred actions are used by the `auto fix` command.
1117
		 *
1118 1119
		 * A quick fix should be marked preferred if it properly addresses the underlying error.
		 * A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
1120
		 */
1121
		isPreferred?: boolean;
1122 1123 1124
	}
	//#endregion

1125 1126 1127 1128 1129 1130 1131 1132
	//#region Tasks
	export interface TaskPresentationOptions {
		/**
		 * Controls whether the task is executed in a specific terminal group using split panes.
		 */
		group?: string;
	}
	//#endregion
1133

1134 1135 1136
	//#region Autofix - mjbvz
	export namespace CodeActionKind {
		/**
M
Matt Bierner 已提交
1137
		 * Base kind for auto-fix source actions: `source.fixAll`.
1138
		 *
M
Matt Bierner 已提交
1139
		 * Fix all actions automatically fix errors that have a clear fix that do not require user input.
1140
		 * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
1141
		 */
1142
		export const SourceFixAll: CodeActionKind;
1143 1144
	}
	//#endregion
J
Johannes Rieken 已提交
1145
}