vscode.proposed.d.ts 33.7 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 21
	//#region Joh - call hierarchy

	export class CallHierarchyItem {
J
jrieken 已提交
22 23 24
		/**
		 * The name of this item.
		 */
25
		name: string;
J
jrieken 已提交
26 27 28 29 30 31 32 33 34 35 36 37 38 39

		/**
		 * The kind of this item.
		 */
		kind: SymbolKind;

		/**
		 * Tags for this item.
		 */
		tags?: ReadonlyArray<SymbolTag>;

		/**
		 * More detail for this item, e.g. the signature of a function.
		 */
40
		detail?: string;
J
jrieken 已提交
41 42 43 44

		/**
		 * The resource identifier of this item.
		 */
45
		uri: Uri;
J
jrieken 已提交
46 47 48 49

		/**
		 * The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
		 */
50
		range: Range;
J
jrieken 已提交
51 52 53 54 55

		/**
		 * The range that should be selected and reveal when this symbol is being picked, e.g. the name of a function.
		 * Must be contained by the [`range`](#CallHierarchyItem.range).
		 */
56 57
		selectionRange: Range;

58
		constructor(kind: SymbolKind, name: string, detail: string, uri: Uri, range: Range, selectionRange: Range);
59 60
	}

J
jrieken 已提交
61
	export class CallHierarchyIncomingCall {
J
jrieken 已提交
62 63 64 65 66
		source: CallHierarchyItem;
		sourceRanges: Range[];
		constructor(item: CallHierarchyItem, sourceRanges: Range[]);
	}

J
jrieken 已提交
67
	export class CallHierarchyOutgoingCall {
J
jrieken 已提交
68 69 70 71 72
		sourceRanges: Range[];
		target: CallHierarchyItem;
		constructor(item: CallHierarchyItem, sourceRanges: Range[]);
	}

73 74
	export interface CallHierarchyItemProvider {

J
Johannes Rieken 已提交
75
		/**
J
jrieken 已提交
76
		 * Provide a list of callers for the provided item, e.g. all function calling a function.
J
Johannes Rieken 已提交
77
		 */
78
		provideCallHierarchyIncomingCalls(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<CallHierarchyIncomingCall[]>;
79

J
Johannes Rieken 已提交
80
		/**
J
jrieken 已提交
81
		 * Provide a list of calls for the provided item, e.g. all functions call from a function.
J
Johannes Rieken 已提交
82
		 */
83 84 85 86 87 88 89 90 91 92
		provideCallHierarchyOutgoingCalls(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<CallHierarchyOutgoingCall[]>;

		//  todo@joh this could return as 'prepareCallHierarchy' (similar to the RenameProvider#prepareRename)
		//
		// /**
		//  *
		//  * Given a document and position compute a call hierarchy item. This is justed as
		//  * anchor for call hierarchy and then `resolveCallHierarchyItem` is being called.
		//  */
		// resolveCallHierarchyItem(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<CallHierarchyItem>;
93 94 95 96 97 98 99 100 101
	}

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

	//#endregion


A
Alex Dima 已提交
102 103
	//#region Alex - resolvers

A
Tweaks  
Alex Dima 已提交
104 105 106 107
	export interface RemoteAuthorityResolverContext {
		resolveAttempt: number;
	}

A
Alex Dima 已提交
108 109 110 111 112 113 114
	export class ResolvedAuthority {
		readonly host: string;
		readonly port: number;

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

115
	export interface ResolvedOptions {
116
		extensionHostEnv?: { [key: string]: string | null };
117 118
	}

119
	export type ResolverResult = ResolvedAuthority & ResolvedOptions;
120

A
Tweaks  
Alex Dima 已提交
121 122 123 124 125 126 127
	export class RemoteAuthorityResolverError extends Error {
		static NotAvailable(message?: string, handled?: boolean): RemoteAuthorityResolverError;
		static TemporarilyNotAvailable(message?: string): RemoteAuthorityResolverError;

		constructor(message?: string);
	}

A
Alex Dima 已提交
128
	export interface RemoteAuthorityResolver {
129
		resolve(authority: string, context: RemoteAuthorityResolverContext): ResolverResult | Thenable<ResolverResult>;
A
Alex Dima 已提交
130 131
	}

132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
	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 已提交
147 148
	export namespace workspace {
		export function registerRemoteAuthorityResolver(authorityPrefix: string, resolver: RemoteAuthorityResolver): Disposable;
149
		export function registerResourceLabelFormatter(formatter: ResourceLabelFormatter): Disposable;
150
	}
151

152 153 154 155 156
	//#endregion


	// #region Joh - code insets

157 158
	export interface WebviewEditorInset {
		readonly editor: TextEditor;
159 160
		readonly line: number;
		readonly height: number;
161 162 163
		readonly webview: Webview;
		readonly onDidDispose: Event<void>;
		dispose(): void;
164 165
	}

166
	export namespace window {
167
		export function createWebviewTextEditorInset(editor: TextEditor, line: number, height: number, options?: WebviewOptions): WebviewEditorInset;
A
Alex Dima 已提交
168 169 170 171
	}

	//#endregion

172 173 174
	//#region Joh - read/write in chunks

	export interface FileSystemProvider {
J
Johannes Rieken 已提交
175
		open?(resource: Uri, options: { create: boolean }): number | Thenable<number>;
176 177 178 179 180 181 182
		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

183
	//#region Rob: search provider
184

185 186 187
	/**
	 * The parameters of a query for text search.
	 */
188
	export interface TextSearchQuery {
189 190 191
		/**
		 * The text pattern to search for.
		 */
192
		pattern: string;
193

R
Rob Lourens 已提交
194 195 196 197 198
		/**
		 * Whether or not `pattern` should match multiple lines of text.
		 */
		isMultiline?: boolean;

199 200 201
		/**
		 * Whether or not `pattern` should be interpreted as a regular expression.
		 */
R
Rob Lourens 已提交
202
		isRegExp?: boolean;
203 204 205 206

		/**
		 * Whether or not the search should be case-sensitive.
		 */
R
Rob Lourens 已提交
207
		isCaseSensitive?: boolean;
208 209 210 211

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

215 216 217 218 219 220 221 222 223 224
	/**
	 * 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 已提交
225
	export interface SearchOptions {
226 227 228
		/**
		 * The root folder to search within.
		 */
229
		folder: Uri;
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244

		/**
		 * 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 已提交
245
		useIgnoreFiles: boolean;
246 247 248 249 250

		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
251
		followSymlinks: boolean;
P
pkoushik 已提交
252 253 254 255 256 257

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

R
Rob Lourens 已提交
260 261
	/**
	 * Options to specify the size of the result text preview.
R
Rob Lourens 已提交
262
	 * These options don't affect the size of the match itself, just the amount of preview text.
R
Rob Lourens 已提交
263
	 */
264
	export interface TextSearchPreviewOptions {
265
		/**
R
Rob Lourens 已提交
266
		 * The maximum number of lines in the preview.
R
Rob Lourens 已提交
267
		 * Only search providers that support multiline search will ever return more than one line in the match.
268
		 */
R
Rob Lourens 已提交
269
		matchLines: number;
R
Rob Lourens 已提交
270 271 272 273

		/**
		 * The maximum number of characters included per line.
		 */
R
Rob Lourens 已提交
274
		charsPerLine: number;
275 276
	}

277 278 279
	/**
	 * Options that apply to text search.
	 */
R
Rob Lourens 已提交
280
	export interface TextSearchOptions extends SearchOptions {
281
		/**
282
		 * The maximum number of results to be returned.
283
		 */
284 285
		maxResults: number;

R
Rob Lourens 已提交
286 287 288
		/**
		 * Options to specify the size of the result text preview.
		 */
289
		previewOptions?: TextSearchPreviewOptions;
290 291 292 293

		/**
		 * Exclude files larger than `maxFileSize` in bytes.
		 */
294
		maxFileSize?: number;
295 296 297 298 299

		/**
		 * Interpret files using this encoding.
		 * See the vscode setting `"files.encoding"`
		 */
300
		encoding?: string;
301 302 303 304 305 306 307 308 309 310

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

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

313 314 315 316 317 318 319 320 321 322 323 324 325 326
	/**
	 * 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;
	}

327 328 329
	/**
	 * The parameters of a query for file search.
	 */
330
	export interface FileSearchQuery {
331 332 333
		/**
		 * The search pattern to match against file paths.
		 */
334 335
		pattern: string;
	}
336 337 338 339

	/**
	 * Options that apply to file search.
	 */
340
	export interface FileSearchOptions extends SearchOptions {
341
		/**
342
		 * The maximum number of results to be returned.
343
		 */
R
Rob Lourens 已提交
344
		maxResults?: number;
345 346 347 348 349 350

		/**
		 * 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;
351 352
	}

R
Rob Lourens 已提交
353 354 355
	/**
	 * A preview of the text result.
	 */
356
	export interface TextSearchMatchPreview {
357
		/**
R
Rob Lourens 已提交
358
		 * The matching lines of text, or a portion of the matching line that contains the match.
359 360 361 362 363
		 */
		text: string;

		/**
		 * The Range within `text` corresponding to the text of the match.
364
		 * The number of matches must match the TextSearchMatch's range property.
365
		 */
366
		matches: Range | Range[];
367 368 369 370 371
	}

	/**
	 * A match from a text search
	 */
372
	export interface TextSearchMatch {
373 374 375
		/**
		 * The uri for the matching document.
		 */
376
		uri: Uri;
377 378

		/**
379
		 * The range of the match within the document, or multiple ranges for multiple matches.
380
		 */
381
		ranges: Range | Range[];
R
Rob Lourens 已提交
382

383
		/**
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
		 * 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.
406
		 */
407
		lineNumber: number;
408 409
	}

410 411
	export type TextSearchResult = TextSearchMatch | TextSearchContext;

412
	/**
R
Rob Lourens 已提交
413 414 415 416 417 418 419
	 * 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.
420
	 */
421
	export interface FileSearchProvider {
422 423 424 425 426 427
		/**
		 * 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.
		 */
428
		provideFileSearchResults(query: FileSearchQuery, options: FileSearchOptions, token: CancellationToken): ProviderResult<Uri[]>;
429
	}
430

R
Rob Lourens 已提交
431 432 433 434
	/**
	 * A TextSearchProvider provides search results for text results inside files in the workspace.
	 */
	export interface TextSearchProvider {
435 436 437 438 439 440 441
		/**
		 * 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.
		 */
442
		provideTextSearchResults(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): ProviderResult<TextSearchComplete>;
443 444
	}

445 446 447
	/**
	 * Options that can be set on a findTextInFiles search.
	 */
R
Rob Lourens 已提交
448
	export interface FindTextInFilesOptions {
449 450 451 452 453
		/**
		 * 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).
		 */
454
		include?: GlobPattern;
455 456 457 458 459 460 461 462 463 464 465

		/**
		 * 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 已提交
466
		maxResults?: number;
467 468 469 470 471

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

P
pkoushik 已提交
474 475 476 477
		/**
		 * Whether global files that exclude files, like .gitignore, should be respected.
		 * See the vscode setting `"search.useGlobalIgnoreFiles"`.
		 */
478
		useGlobalIgnoreFiles?: boolean;
P
pkoushik 已提交
479

480 481 482 483
		/**
		 * Whether symlinks should be followed while searching.
		 * See the vscode setting `"search.followSymlinks"`.
		 */
R
Rob Lourens 已提交
484
		followSymlinks?: boolean;
485 486 487 488 489

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

R
Rob Lourens 已提交
492 493 494
		/**
		 * Options to specify the size of the result text preview.
		 */
495
		previewOptions?: TextSearchPreviewOptions;
496 497 498 499 500 501 502 503 504 505

		/**
		 * 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 已提交
506 507
	}

508
	export namespace workspace {
509 510 511 512 513 514 515 516 517
		/**
		 * 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 已提交
518
		export function registerFileSearchProvider(scheme: string, provider: FileSearchProvider): Disposable;
519

520
		/**
R
Rob Lourens 已提交
521
		 * Register a text search provider.
522 523 524 525 526 527 528
		 *
		 * 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 已提交
529
		export function registerTextSearchProvider(scheme: string, provider: TextSearchProvider): Disposable;
530 531 532 533 534 535 536 537

		/**
		 * 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.
		 */
538
		export function findTextInFiles(query: TextSearchQuery, callback: (result: TextSearchResult) => void, token?: CancellationToken): Thenable<TextSearchComplete>;
539 540 541 542 543 544 545 546 547

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

J
Johannes Rieken 已提交
551
	//#endregion
552

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

J
Joao Moreno 已提交
555 556 557
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
558 559 560 561 562 563 564
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582
	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;
	}
583

J
Johannes Rieken 已提交
584 585 586
	//#endregion

	//#region Joh: decorations
587

588
	export class Decoration {
589
		letter?: string;
590 591 592
		title?: string;
		color?: ThemeColor;
		priority?: number;
593
		bubble?: boolean;
594 595
	}

596
	export interface DecorationProvider {
597
		onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
598
		provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<Decoration>;
599 600 601
	}

	export namespace window {
602
		export function registerDecorationProvider(provider: DecorationProvider): Disposable;
603 604 605
	}

	//#endregion
606

J
Johannes Rieken 已提交
607 608
	//#region André: debug

A
Andre Weinand 已提交
609 610
	// deprecated

611
	export interface DebugConfigurationProvider {
612
		/**
A
Andre Weinand 已提交
613 614
		 * Deprecated, use DebugAdapterDescriptorFactory.provideDebugAdapter instead.
		 * @deprecated Use DebugAdapterDescriptorFactory.createDebugAdapterDescriptor instead
615 616
		 */
		debugAdapterExecutable?(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult<DebugAdapterExecutable>;
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 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668
	/**
	 * Debug console mode used by debug session, see [options](#DebugSessionOptions).
	 */
	export enum DebugConsoleMode {
		/**
		 * Debug session should have a separate debug console.
		 */
		Separate = 0,

		/**
		 * Debug session should share debug console with its parent session.
		 * This value has no effect for sessions which do not have a parent session.
		 */
		MergeWithParent = 1
	}

	/**
	 * Options for [starting a debug session](#debug.startDebugging).
	 */
	export interface DebugSessionOptions {

		/**
		 * When specified the newly created debug session is registered as a "child" session of this
		 * "parent" debug session.
		 */
		parentSession?: DebugSession;

		/**
		 * Controls whether this session should have a separate debug console or share it
		 * with the parent session. Has no effect for sessions which do not have a parent session.
		 * Defaults to Separate.
		 */
		consoleMode?: DebugConsoleMode;
	}

	export namespace debug {
		/**
		 * Start debugging by using either a named launch or named compound configuration,
		 * or by directly passing a [DebugConfiguration](#DebugConfiguration).
		 * The named configurations are looked up in '.vscode/launch.json' found in the given folder.
		 * Before debugging starts, all unsaved files are saved and the launch configurations are brought up-to-date.
		 * Folder specific variables used in the configuration (e.g. '${workspaceFolder}') are resolved against the given folder.
		 * @param folder The [workspace folder](#WorkspaceFolder) for looking up named configurations and resolving variables or `undefined` for a non-folder setup.
		 * @param nameOrConfiguration Either the name of a debug or compound configuration or a [DebugConfiguration](#DebugConfiguration) object.
		 * @param parentSessionOrOptions Debug sesison options. When passed a parent [debug session](#DebugSession), assumes options with just this parent session.
		 * @return A thenable that resolves when debugging could be successfully started.
		 */
		export function startDebugging(folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration, parentSessionOrOptions?: DebugSession | DebugSessionOptions): Thenable<boolean>;
	}

J
Johannes Rieken 已提交
669 670 671 672
	//#endregion

	//#region Rob, Matt: logging

673 674 675 676 677 678 679 680 681 682 683 684 685
	/**
	 * 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 已提交
686 687 688 689 690
	export namespace env {
		/**
		 * Current logging level.
		 */
		export const logLevel: LogLevel;
691 692 693 694 695

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

J
Johannes Rieken 已提交
698 699 700
	//#endregion

	//#region Joao: SCM validation
701

J
Joao Moreno 已提交
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746
	/**
	 * 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 已提交
747

J
Johannes Rieken 已提交
748 749
	//#endregion

750 751 752 753 754 755 756 757 758 759 760 761 762
	//#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>;
763 764 765 766
	}

	//#endregion

767 768 769 770 771 772 773 774
	//#region Joao: SCM Input Box

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

		/**
J
Joao Moreno 已提交
775 776
			* Controls whether the input box is visible (default is `true`).
			*/
777 778 779 780 781
		visible: boolean;
	}

	//#endregion

782

783 784
	//#region Terminal

785 786 787 788 789 790 791 792 793 794 795 796 797 798
	/**
	 * 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;
	}

799 800 801 802 803 804 805 806 807 808 809
	export interface TerminalDataWriteEvent {
		/**
		 * The [terminal](#Terminal) for which the data was written.
		 */
		readonly terminal: Terminal;
		/**
		 * The data being written.
		 */
		readonly data: string;
	}

810 811 812 813 814
	namespace window {
		/**
		 * An event which fires when the [dimensions](#Terminal.dimensions) of the terminal change.
		 */
		export const onDidChangeTerminalDimensions: Event<TerminalDimensionsChangeEvent>;
815 816 817 818 819 820 821

		/**
		 * 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>;
822 823
	}

D
Daniel Imms 已提交
824
	export interface Terminal {
825
		/**
826 827 828
		 * 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.
829
		 */
830
		readonly dimensions: TerminalDimensions | undefined;
D
Daniel Imms 已提交
831 832
	}

833 834
	//#endregion

835 836 837 838 839 840 841
	//#region Joh -> exclusive document filters

	export interface DocumentFilter {
		exclusive?: boolean;
	}

	//#endregion
C
Christof Marti 已提交
842

J
Johannes Rieken 已提交
843
	//#region mjbvz,joh: https://github.com/Microsoft/vscode/issues/43768
844 845 846
	export interface FileRenameEvent {
		readonly oldUri: Uri;
		readonly newUri: Uri;
C
Christof Marti 已提交
847 848
	}

849 850 851
	export interface FileWillRenameEvent {
		readonly oldUri: Uri;
		readonly newUri: Uri;
852
		waitUntil(thenable: Thenable<WorkspaceEdit>): void;
853 854
	}

855
	export namespace workspace {
856
		export const onWillRenameFile: Event<FileWillRenameEvent>;
857
		export const onDidRenameFile: Event<FileRenameEvent>;
858 859
	}
	//#endregion
860

861 862 863 864 865 866 867 868
	//#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
869

870 871
	//#region Tree View

S
Sandeep Somavarapu 已提交
872
	export interface TreeView<T> {
873 874 875 876
		/**
		 * The name of the tree view. It is set from the extension package.json and can be changed later.
		 */
		title?: string;
S
Sandeep Somavarapu 已提交
877 878
	}

879 880 881 882 883 884 885 886 887 888 889
	/**
	 * Label describing the [Tree item](#TreeItem)
	 */
	export interface TreeItemLabel {

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

		/**
S
Sandeep Somavarapu 已提交
890
		 * Ranges in the label to highlight. A range is defined as a tuple of two number where the
S
Sandeep Somavarapu 已提交
891
		 * first is the inclusive start index and the second the exclusive end index
892
		 */
S
Sandeep Somavarapu 已提交
893
		highlights?: [number, number][];
894 895 896 897 898 899 900 901 902 903 904 905 906 907 908

	}

	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);
	}
909
	//#endregion
910

911
	//#region CustomExecution
912 913 914 915 916
	/**
	 * Class used to execute an extension callback as a task.
	 */
	export class CustomExecution2 {
		/**
917 918 919 920 921
		 * Constructs a CustomExecution task object. The callback will be executed the task is run, at which point the
		 * extension should return the Pseudoterminal it will "run in". The task should wait to do further execution until
		 * [Pseudoterminal.open](#Pseudoterminal.open) is called. Task cancellation should be handled using
		 * [Pseudoterminal.close](#Pseudoterminal.close). When the task is complete fire
		 * [Pseudoterminal.onDidClose](#Pseudoterminal.onDidClose).
D
Daniel Imms 已提交
922
		 * @param process The [Pseudoterminal](#Pseudoterminal) to be used by the task to display output.
923 924
		 * @param callback The callback that will be called when the task is started by a user.
		 */
925
		constructor(callback: () => Thenable<Pseudoterminal>);
926 927
	}

928 929 930
	/**
	 * A task to execute
	 */
G
Gabriel DeBacker 已提交
931
	export class Task2 extends Task {
932 933 934 935 936 937 938 939 940 941 942 943
		/**
		 * 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 已提交
944
		constructor(taskDefinition: TaskDefinition, scope: WorkspaceFolder | TaskScope.Global | TaskScope.Workspace, name: string, source: string, execution?: ProcessExecution | ShellExecution | CustomExecution2, problemMatchers?: string | string[]);
945 946 947 948

		/**
		 * The task's execution engine
		 */
A
Alex Ross 已提交
949
		execution2?: ProcessExecution | ShellExecution | CustomExecution2;
950
	}
951
	//#endregion
G
Gabriel DeBacker 已提交
952

953 954 955 956 957 958 959 960
	//#region Tasks
	export interface TaskPresentationOptions {
		/**
		 * Controls whether the task is executed in a specific terminal group using split panes.
		 */
		group?: string;
	}
	//#endregion
961

962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008
	// #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
1009

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

1012 1013 1014 1015 1016 1017 1018
	export interface AppUriOptions {
		payload?: {
			path?: string;
			query?: string;
			fragment?: string;
		};
	}
1019

1020
	export namespace env {
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054

		/**
		 * 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
1055

1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085
	// #region Ben - UIKind

	/**
	 * Possible kinds of UI that can use extensions.
	 */
	export enum UIKind {

		/**
		 * Extensions are accessed from a desktop application.
		 */
		Desktop = 1,

		/**
		 * Extensions are accessed from a web browser.
		 */
		Web = 2
	}

	export namespace env {

		/**
		 * The UI kind property indicates from which UI extensions
		 * are accessed from. For example, extensions could be accessed
		 * from a desktop application or a web browser.
		 */
		export const uiKind: UIKind;
	}

	//#endregion

1086 1087
	//#region Custom editors, mjbvz

1088
	export enum WebviewEditorState {
M
Matt Bierner 已提交
1089 1090 1091 1092 1093
		/**
		 * The webview editor's content cannot be modified.
		 *
		 * This disables save
		 */
1094
		Readonly = 1,
M
Matt Bierner 已提交
1095 1096 1097 1098

		/**
		 * The webview editor's content has not been changed but they can be modified and saved.
		 */
1099
		Unchanged = 2,
M
Matt Bierner 已提交
1100 1101 1102 1103

		/**
		 * The webview editor's content has been changed and can be saved.
		 */
1104 1105 1106 1107 1108
		Dirty = 3,
	}

	export interface WebviewEditor extends WebviewPanel {
		state: WebviewEditorState;
1109 1110 1111 1112 1113 1114 1115 1116 1117

		/**
		 * Fired when the webview editor is saved.
		 *
		 * Both `Unchanged` and `Dirty` editors can be saved.
		 *
		 * Extensions should call `waitUntil` to signal when the save operation complete
		 */
		readonly onWillSave: Event<{ waitUntil: (thenable: Thenable<boolean>) => void }>;
1118
	}
1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139

	export interface WebviewEditorProvider {
		/**
		* Fills out a `WebviewEditor` for a given resource.
		*
		* The provider should take ownership of passed in `editor`.
		*/
		resolveWebviewEditor(
			resource: Uri,
			editor: WebviewEditor
		): Thenable<void>;
	}

	namespace window {
		export function registerWebviewEditorProvider(
			viewType: string,
			provider: WebviewEditorProvider,
		): Disposable;
	}

	//#endregion
1140 1141 1142 1143 1144 1145 1146 1147

	// #region resolveExternalUri — mjbvz

	namespace env {
		/**
		 * Resolves an *external* uri, such as a `http:` or `https:` link, from where the extension is running to a
		 * uri to the same resource on the client machine.
		 *
1148
		 * This is a no-op if the extension is running locally. Currently only supports `https:` and `http:`.
1149 1150 1151 1152
		 *
		 * If the extension is running remotely, this function automatically establishes port forwarding from
		 * the local machine to `target` on the remote and returns a local uri that can be used to for this connection.
		 *
1153 1154 1155 1156 1157 1158
		 * Extensions should not store the result of `resolveExternalUri` as the resolved uri may become invalid due to
		 * a system or user action — for example, in remote cases, a user may close a port that was forwarded by
		 * `resolveExternalUri`.
		 *
		 * Note: uris passed through `openExternal` are automatically resolved and you should not call `resolveExternalUri`
		 * on them.
1159
		 *
1160
		 * @return A uri that can be used on the client machine.
1161
		 */
1162
		export function resolveExternalUri(target: Uri): Thenable<Uri>;
1163 1164 1165
	}

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