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

// This is the place for API experiments and proposal.

8 9
import { QuickPickItem } from 'vscode';

10 11
declare module 'vscode' {

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

16 17 18 19
	//#region Joh: remote, search provider

	export interface TextSearchQuery {
		pattern: string;
20 21 22
		isRegExp: boolean;
		isCaseSensitive: boolean;
		isWordMatch: boolean;
23 24
	}

R
Rob Lourens 已提交
25
	export interface SearchOptions {
26
		folder: Uri;
R
Rob Lourens 已提交
27 28 29 30
		includes: string[]; // paths relative to folder
		excludes: string[];
		useIgnoreFiles?: boolean;
		followSymlinks?: boolean;
31 32
	}

R
Rob Lourens 已提交
33
	export interface TextSearchOptions extends SearchOptions {
R
Rob Lourens 已提交
34
		previewOptions?: any; // total length? # of context lines? leading and trailing # of chars?
35 36
		maxFileSize?: number;
		encoding?: string;
37 38
	}

39 40
	export interface FileSearchOptions extends SearchOptions { }

41
	export interface TextSearchResult {
42
		path: string;
43
		range: Range;
R
Rob Lourens 已提交
44 45 46

		// For now, preview must be a single line of text
		preview: { text: string, match: Range };
47 48 49
	}

	export interface SearchProvider {
50
		provideFileSearchResults?(options: FileSearchOptions, progress: Progress<string>, token: CancellationToken): Thenable<void>;
51
		provideTextSearchResults?(query: TextSearchQuery, options: TextSearchOptions, progress: Progress<TextSearchResult>, token: CancellationToken): Thenable<void>;
52 53
	}

54
	export namespace workspace {
55
		export function registerSearchProvider(scheme: string, provider: SearchProvider): Disposable;
56 57
	}

J
Johannes Rieken 已提交
58
	//#endregion
59

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

J
Joao Moreno 已提交
62 63 64
	/**
	 * The contiguous set of modified lines in a diff.
	 */
J
Joao Moreno 已提交
65 66 67 68 69 70 71
	export interface LineChange {
		readonly originalStartLineNumber: number;
		readonly originalEndLineNumber: number;
		readonly modifiedStartLineNumber: number;
		readonly modifiedEndLineNumber: number;
	}

72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
	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;
	}
90

J
Johannes Rieken 已提交
91 92 93
	//#endregion

	//#region Joh: decorations
94 95 96 97 98

	//todo@joh -> make class
	export interface DecorationData {
		priority?: number;
		title?: string;
99
		bubble?: boolean;
100 101
		abbreviation?: string;
		color?: ThemeColor;
102
		source?: string;
103 104
	}

105 106 107 108 109 110
	export interface SourceControlResourceDecorations {
		source?: string;
		letter?: string;
		color?: ThemeColor;
	}

111
	export interface DecorationProvider {
112
		onDidChangeDecorations: Event<undefined | Uri | Uri[]>;
113 114 115 116
		provideDecoration(uri: Uri, token: CancellationToken): ProviderResult<DecorationData>;
	}

	export namespace window {
117
		export function registerDecorationProvider(provider: DecorationProvider): Disposable;
118 119 120
	}

	//#endregion
121

J
Johannes Rieken 已提交
122 123
	//#region André: debug

124 125 126 127 128 129
	/**
	 * Represents a debug adapter executable and optional arguments passed to it.
	 */
	export class DebugAdapterExecutable {
		/**
		 * The command path of the debug adapter executable.
A
Andre Weinand 已提交
130
		 * A command must be either an absolute path or the name of an executable looked up via the PATH environment variable.
131 132 133 134 135
		 * The special value 'node' will be mapped to VS Code's built-in node runtime.
		 */
		readonly command: string;

		/**
A
Andre Weinand 已提交
136
		 * Optional arguments passed to the debug adapter executable.
137 138 139 140 141 142 143 144 145 146 147
		 */
		readonly args: string[];

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

	export interface DebugConfigurationProvider {
		/**
148
		 * This optional method is called just before a debug adapter is started to determine its executable path and arguments.
149 150 151 152 153 154 155 156
		 * Registering more than one debugAdapterExecutable for a type results in an error.
		 * @param folder The workspace folder from which the configuration originates from or undefined for a folderless setup.
		 * @param token A cancellation token.
		 * @return a [debug adapter's executable and optional arguments](#DebugAdapterExecutable) or undefined.
		 */
		debugAdapterExecutable?(folder: WorkspaceFolder | undefined, token?: CancellationToken): ProviderResult<DebugAdapterExecutable>;
	}

J
Johannes Rieken 已提交
157 158 159 160
	//#endregion

	//#region Rob, Matt: logging

161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
	/**
	 * The severity level of a log message
	 */
	export enum LogLevel {
		Trace = 1,
		Debug = 2,
		Info = 3,
		Warning = 4,
		Error = 5,
		Critical = 6,
		Off = 7
	}

	/**
	 * A logger for writing to an extension's log file, and accessing its dedicated log directory.
	 */
	export interface Logger {
		trace(message: string, ...args: any[]): void;
		debug(message: string, ...args: any[]): void;
		info(message: string, ...args: any[]): void;
		warn(message: string, ...args: any[]): void;
		error(message: string | Error, ...args: any[]): void;
		critical(message: string | Error, ...args: any[]): void;
	}

	export interface ExtensionContext {
		/**
R
Rob Lourens 已提交
188
		 * This extension's logger
189 190
		 */
		logger: Logger;
191 192 193 194 195 196 197

		/**
		 * Path where an extension can write log files.
		 *
		 * Extensions must create this directory before writing to it. The parent directory will always exist.
		 */
		readonly logDirectory: string;
198
	}
199

M
Matt Bierner 已提交
200 201 202 203 204 205 206 207 208
	export namespace env {
		/**
		 * Current logging level.
		 *
		 * @readonly
		 */
		export const logLevel: LogLevel;
	}

J
Johannes Rieken 已提交
209 210 211
	//#endregion

	//#region Joao: SCM validation
212

J
Joao Moreno 已提交
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
	/**
	 * 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 已提交
258

J
Johannes Rieken 已提交
259 260
	//#endregion

261 262 263 264 265
	//#region Comments
	/**
	 * Comments provider related APIs are still in early stages, they may be changed significantly during our API experiments.
	 */

266 267 268 269 270
	interface CommentInfo {
		threads: CommentThread[];
		commentingRanges?: Range[];
	}

271 272 273 274 275 276 277 278 279 280 281
	export enum CommentThreadCollapsibleState {
		/**
		 * Determines an item is collapsed
		 */
		Collapsed = 0,
		/**
		 * Determines an item is expanded
		 */
		Expanded = 1
	}

M
Matt Bierner 已提交
282
	interface CommentThread {
283
		threadId: string;
284
		resource: Uri;
M
Matt Bierner 已提交
285 286
		range: Range;
		comments: Comment[];
287
		collapsibleState?: CommentThreadCollapsibleState;
M
Matt Bierner 已提交
288 289 290
	}

	interface Comment {
P
Peng Lyu 已提交
291
		commentId: string;
M
Matt Bierner 已提交
292 293
		body: MarkdownString;
		userName: string;
294
		gravatar: string;
295
		command?: Command;
M
Matt Bierner 已提交
296 297
	}

298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
	export interface CommentThreadChangedEvent {
		/**
		 * Added comment threads.
		 */
		readonly added: CommentThread[];

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

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

315 316
	interface DocumentCommentProvider {
		provideDocumentComments(document: TextDocument, token: CancellationToken): Promise<CommentInfo>;
317 318
		createNewCommentThread?(document: TextDocument, range: Range, text: string, token: CancellationToken): Promise<CommentThread>;
		replyToCommentThread?(document: TextDocument, range: Range, commentThread: CommentThread, text: string, token: CancellationToken): Promise<CommentThread>;
319 320 321 322 323
		onDidChangeCommentThreads?: Event<CommentThreadChangedEvent>;
	}

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

327
		onDidChangeCommentThreads?: Event<CommentThreadChangedEvent>;
M
Matt Bierner 已提交
328 329 330
	}

	namespace workspace {
331 332
		export function registerDocumentCommentProvider(provider: DocumentCommentProvider): Disposable;
		export function registerWorkspaceCommentProvider(provider: WorkspaceCommentProvider): Disposable;
M
Matt Bierner 已提交
333
	}
334 335
	//#endregion

336 337
	//#region Terminal

D
Daniel Imms 已提交
338
	export interface Terminal {
D
Daniel Imms 已提交
339
		/**
D
Daniel Imms 已提交
340
		 * Fires when the terminal's pty slave pseudo-device is written to. In other words, this
D
Daniel Imms 已提交
341
		 * provides access to the raw data stream from the process running within the terminal,
342
		 * including VT sequences.
D
Daniel Imms 已提交
343
		 */
344
		onDidWriteData: Event<string>;
D
Daniel Imms 已提交
345 346
	}

D
Daniel Imms 已提交
347
	/**
348
	 * Represents the dimensions of a terminal.
D
Daniel Imms 已提交
349 350 351 352 353
	 */
	export interface TerminalDimensions {
		/**
		 * The number of columns in the terminal.
		 */
354
		readonly columns: number;
D
Daniel Imms 已提交
355 356 357 358

		/**
		 * The number of rows in the terminal.
		 */
359
		readonly rows: number;
D
Daniel Imms 已提交
360 361
	}

362 363 364 365
	/**
	 * Represents a terminal without a process where all interaction and output in the terminal is
	 * controlled by an extension. This is similar to an output window but has the same VT sequence
	 * compatility as the regular terminal.
D
Daniel Imms 已提交
366 367 368 369
	 *
	 * 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
370
	 * TerminalRenderer essentially acts as a process. For example when an
371 372
	 * [Terminal.onDidWriteData](#Terminal.onDidWriteData) listener is registered, that will fire
	 * when [TerminalRenderer.write](#TerminalRenderer.write) is called. Similarly when
D
Daniel Imms 已提交
373
	 * [Terminal.sendText](#Terminal.sendText) is triggered that will fire the
374
	 * [TerminalRenderer.onDidAcceptInput](#TerminalRenderer.onDidAcceptInput) event.
375 376 377 378 379 380 381
	 *
	 * **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');
	 * ```
382
	 */
383
	export interface TerminalRenderer {
384 385 386
		/**
		 * The name of the terminal, this will appear in the terminal selector.
		 */
387 388
		name: string;

D
Daniel Imms 已提交
389 390 391 392
		/**
		 * 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).
393 394 395 396 397 398 399 400
		 *
		 * **Example:** Override the dimensions of a TerminalRenderer to 20 columns and 10 rows
		 * ```typescript
		 * terminalRenderer.dimensions = {
		 *   cols: 20,
		 *   rows: 10
		 * };
		 * ```
D
Daniel Imms 已提交
401 402 403 404 405 406 407 408 409 410
		 */
		dimensions: TerminalDimensions;

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

412 413 414 415 416
		/**
		 * The corressponding [Terminal](#Terminal) for this TerminalRenderer.
		 */
		readonly terminal: Thenable<Terminal>;

417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432
		/**
		 * 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 已提交
433
		write(text: string): void;
434

435 436 437 438
		/**
		 * 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.
439 440 441 442 443
		 *
		 * **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');
444
		 * terminalRenderer.onDidAcceptInput(data => {
445 446 447 448
		 *   cosole.log(data); // 'Hello world'
		 * });
		 * terminalRenderer.terminal.then(t => t.sendText('Hello world'));
		 * ```
449
		 */
450
		readonly onDidAcceptInput: Event<string>;
451

D
Daniel Imms 已提交
452 453 454 455
		/**
		 * An event which fires when the [maximum dimensions](#TerminalRenderer.maimumDimensions) of
		 * the terminal renderer change.
		 */
456
		readonly onDidChangeMaximumDimensions: Event<TerminalDimensions>;
457 458
	}

459
	export namespace window {
D
Daniel Imms 已提交
460
		/**
461
		 * The currently opened terminals or an empty array.
D
Daniel Imms 已提交
462
		 */
463
		export const terminals: ReadonlyArray<Terminal>;
D
Daniel Imms 已提交
464

465 466 467 468
		/**
		 * The currently active terminal or `undefined`. The active terminal is the one that
		 * currently has focus or most recently had focus.
		 */
469
		export const activeTerminal: Terminal | undefined;
470 471 472 473 474 475 476 477

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

D
jsdoc  
Daniel Imms 已提交
478 479 480 481
		/**
		 * An [event](#Event) which fires when a terminal has been created, either through the
		 * [createTerminal](#window.createTerminal) API or commands.
		 */
482
		export const onDidOpenTerminal: Event<Terminal>;
483

D
Daniel Imms 已提交
484 485 486 487 488
		/**
		 * Create a [TerminalRenderer](#TerminalRenderer).
		 *
		 * @param name The name of the terminal renderer, this shows up in the terminal selector.
		 */
489
		export function createTerminalRenderer(name: string): TerminalRenderer;
490 491 492
	}

	//#endregion
J
Joao Moreno 已提交
493 494 495

	//#region URLs

J
Joao Moreno 已提交
496 497
	export interface ProtocolHandler {
		handleUri(uri: Uri): void;
J
Joao Moreno 已提交
498 499 500 501 502
	}

	export namespace window {

		/**
J
Joao Moreno 已提交
503
		 * Registers a protocol handler capable of handling system-wide URIs.
J
Joao Moreno 已提交
504
		 */
J
Joao Moreno 已提交
505
		export function registerProtocolHandler(handler: ProtocolHandler): Disposable;
J
Joao Moreno 已提交
506 507 508
	}

	//#endregion
509

510 511 512 513 514 515 516
	//#region Joh -> exclusive document filters

	export interface DocumentFilter {
		exclusive?: boolean;
	}

	//#endregion
C
Christof Marti 已提交
517

518 519 520 521
	//#region QuickInput API

	export namespace window {

C
Christof Marti 已提交
522 523 524 525 526 527
		/**
		 * A back button for [QuickPick](#QuickPick) and [InputBox](#InputBox).
		 *
		 * When a navigation 'back' button is needed this one should be used for consistency.
		 * It comes with a predefined icon, tooltip and location.
		 */
C
Christof Marti 已提交
528 529
		export const quickInputBackButton: QuickInputButton;

C
Christof Marti 已提交
530 531 532 533 534 535 536 537 538
		/**
		 * Creates a [QuickPick](#QuickPick) to let the user pick an item from a list
		 * of items of type T.
		 *
		 * Note that in many cases the more convenient [window.showQuickPick](#window.showQuickPick)
		 * is easier to use.
		 *
		 * @return A new [QuickPick](#QuickPick).
		 */
539
		export function createQuickPick<T extends QuickPickItem>(): QuickPick<T>;
540

C
Christof Marti 已提交
541 542 543 544 545 546 547 548
		/**
		 * Creates a [InputBox](#InputBox) to let the user enter some text input.
		 *
		 * Note that in many cases the more convenient [window.showInputBox](#window.showInputBox)
		 * is easier to use.
		 *
		 * @return A new [InputBox](#InputBox).
		 */
549 550 551
		export function createInputBox(): InputBox;
	}

C
Christof Marti 已提交
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572
	/**
	 * A light-weight user input UI that is intially not visible. After
	 * configuring it through its properties the extension can make it
	 * visible by calling [QuickInput.show](#QuickInput.show).
	 *
	 * There are several reasons why this UI might have to be hidden and
	 * the extension will be notified through [QuickInput.onDidHide](#QuickInput.onDidHide).
	 * (Examples include: an explict call to [QuickInput.hide](#QuickInput.hide),
	 * the user pressing Esc, some other input UI opening, etc.)
	 *
	 * A user pressing Enter or some other gesture implying acceptance
	 * of the current state does not automatically hide this UI component.
	 * It is up to the extension to decide whether to accept the user's input
	 * and if the UI should indeed be hidden through a call to [QuickInput.hide](#QuickInput.hide).
	 *
	 * When the extension no longer needs this input UI, it should
	 * [QuickInput.dispose](#QuickInput.dispose) it to allow for freeing up
	 * any resources associated with it.
	 *
	 * See [QuickPick](#QuickPick) and [InputBox](#InputBox) for concrete UIs.
	 */
573 574
	export interface QuickInput {

C
Christof Marti 已提交
575 576 577
		/**
		 * An optional title.
		 */
C
Christof Marti 已提交
578 579
		title: string | undefined;

C
Christof Marti 已提交
580 581 582
		/**
		 * An optional current step count.
		 */
C
Christof Marti 已提交
583 584
		step: number | undefined;

C
Christof Marti 已提交
585 586 587
		/**
		 * An optional total step count.
		 */
C
Christof Marti 已提交
588 589
		totalSteps: number | undefined;

C
Christof Marti 已提交
590 591 592 593 594 595
		/**
		 * If the UI should allow for user input. Defaults to true.
		 *
		 * Change this to false, e.g., while validating user input or
		 * loading data for the next step in user input.
		 */
596 597
		enabled: boolean;

C
Christof Marti 已提交
598 599 600 601 602 603
		/**
		 * If the UI should show a progress indicator. Defaults to false.
		 *
		 * Change this to true, e.g., while loading more data or validating
		 * user input.
		 */
604 605
		busy: boolean;

C
Christof Marti 已提交
606 607 608
		/**
		 * If the UI should stay open even when loosing UI focus. Defaults to false.
		 */
609 610
		ignoreFocusOut: boolean;

C
Christof Marti 已提交
611 612 613 614
		/**
		 * Makes the input UI visible in its current configuration. Any other input
		 * UI will first fire an [QuickInput.onDidHide](#QuickInput.onDidHide) event.
		 */
615 616
		show(): void;

C
Christof Marti 已提交
617 618 619 620
		/**
		 * Hides this input UI. This will also fire an [QuickInput.onDidHide](#QuickInput.onDidHide)
		 * event.
		 */
621 622
		hide(): void;

C
Christof Marti 已提交
623 624 625 626 627 628 629 630
		/**
		 * An event signaling when this input UI is hidden.
		 *
		 * There are several reasons why this UI might have to be hidden and
		 * the extension will be notified through [QuickInput.onDidHide](#QuickInput.onDidHide).
		 * (Examples include: an explict call to [QuickInput.hide](#QuickInput.hide),
		 * the user pressing Esc, some other input UI opening, etc.)
		 */
631 632
		onDidHide: Event<void>;

C
Christof Marti 已提交
633 634 635 636 637 638
		/**
		 * Dispose of this input UI and any associated resources. If it is still
		 * visible, it is first hidden. After this call the input UI is no longer
		 * functional and no additional methods or properties on it should be
		 * accessed. Instead a new input UI should be created.
		 */
639 640 641
		dispose(): void;
	}

C
Christof Marti 已提交
642 643 644 645 646 647 648 649 650
	/**
	 * A concrete [QuickInput](#QuickInput) to let the user pick an item from a
	 * list of items of type T. The items can be filtered through a filter text field and
	 * there is an option [canSelectMany](#QuickPick.canSelectMany) to allow for
	 * selecting multiple items.
	 *
	 * Note that in many cases the more convenient [window.showQuickPick](#window.showQuickPick)
	 * is easier to use.
	 */
651
	export interface QuickPick<T extends QuickPickItem> extends QuickInput {
652

C
Christof Marti 已提交
653 654 655
		/**
		 * Current value of the filter text.
		 */
656 657
		value: string;

C
Christof Marti 已提交
658 659 660
		/**
		 * Optional placeholder in the filter text.
		 */
661
		placeholder: string | undefined;
662

C
Christof Marti 已提交
663 664 665
		/**
		 * An event signaling when the value of the filter text has changed.
		 */
666 667
		readonly onDidChangeValue: Event<string>;

C
Christof Marti 已提交
668 669 670
		/**
		 * An event signaling when the user indicated acceptance of the selected item(s).
		 */
671 672
		readonly onDidAccept: Event<void>;

C
Christof Marti 已提交
673 674 675
		/**
		 * Buttons for actions in the UI.
		 */
676 677
		buttons: ReadonlyArray<QuickInputButton>;

C
Christof Marti 已提交
678 679 680
		/**
		 * An event signaling when a button was triggered.
		 */
681 682
		readonly onDidTriggerButton: Event<QuickInputButton>;

C
Christof Marti 已提交
683 684 685
		/**
		 * Items to pick from.
		 */
686
		items: ReadonlyArray<T>;
687

C
Christof Marti 已提交
688 689 690
		/**
		 * If multiple items can be selected at the same time. Defaults to false.
		 */
691 692
		canSelectMany: boolean;

C
Christof Marti 已提交
693 694 695
		/**
		 * If the filter text should also be matched against the description of the items. Defaults to false.
		 */
696 697
		matchOnDescription: boolean;

C
Christof Marti 已提交
698 699 700
		/**
		 * If the filter text should also be matched against the detail of the items. Defaults to false.
		 */
701 702
		matchOnDetail: boolean;

C
Christof Marti 已提交
703 704 705
		/**
		 * Active items. This can be read and updated by the extension.
		 */
706
		activeItems: ReadonlyArray<T>;
707

C
Christof Marti 已提交
708 709 710
		/**
		 * An event signaling when the active items have changed.
		 */
711
		readonly onDidChangeActive: Event<T[]>;
712

C
Christof Marti 已提交
713 714 715
		/**
		 * Selected items. This can be read and updated by the extension.
		 */
716
		selectedItems: ReadonlyArray<T>;
717

C
Christof Marti 已提交
718 719 720
		/**
		 * An event signaling when the selected items have changed.
		 */
721
		readonly onDidChangeSelection: Event<T[]>;
722 723
	}

C
Christof Marti 已提交
724 725 726 727 728 729
	/**
	 * A concrete [QuickInput](#QuickInput) to let the user input a text value.
	 *
	 * Note that in many cases the more convenient [window.showInputBox](#window.showInputBox)
	 * is easier to use.
	 */
730 731
	export interface InputBox extends QuickInput {

C
Christof Marti 已提交
732 733 734
		/**
		 * Current input value.
		 */
735 736
		value: string;

C
Christof Marti 已提交
737 738 739
		/**
		 * Optional placeholder in the filter text.
		 */
740
		placeholder: string | undefined;
741

C
Christof Marti 已提交
742 743 744
		/**
		 * If the input value should be hidden. Defaults to false.
		 */
745 746
		password: boolean;

C
Christof Marti 已提交
747 748 749
		/**
		 * An event signaling when the value has changed.
		 */
750 751
		readonly onDidChangeValue: Event<string>;

C
Christof Marti 已提交
752 753 754
		/**
		 * An event signaling when the user indicated acceptance of the input value.
		 */
755
		readonly onDidAccept: Event<void>;
756

C
Christof Marti 已提交
757 758 759
		/**
		 * Buttons for actions in the UI.
		 */
760 761
		buttons: ReadonlyArray<QuickInputButton>;

C
Christof Marti 已提交
762 763 764
		/**
		 * An event signaling when a button was triggered.
		 */
765 766
		readonly onDidTriggerButton: Event<QuickInputButton>;

C
Christof Marti 已提交
767 768 769
		/**
		 * An optional prompt text providing some ask or explanation to the user.
		 */
770
		prompt: string | undefined;
771

C
Christof Marti 已提交
772 773 774
		/**
		 * An optional validation message indicating a problem with the current input value.
		 */
775
		validationMessage: string | undefined;
776 777
	}

C
Christof Marti 已提交
778 779 780
	/**
	 * Button for an action in a [QuickPick](#QuickPick) or [InputBox](#InputBox).
	 */
781
	export interface QuickInputButton {
C
Christof Marti 已提交
782 783 784 785

		/**
		 * Icon for the button.
		 */
C
Christof Marti 已提交
786
		readonly iconPath: string | Uri | { light: string | Uri; dark: string | Uri } | ThemeIcon;
C
Christof Marti 已提交
787 788 789 790

		/**
		 * An optional tooltip.
		 */
C
Christof Marti 已提交
791
		readonly tooltip?: string | undefined;
792 793 794 795
	}

	//#endregion

J
Johannes Rieken 已提交
796 797
	//#region joh: https://github.com/Microsoft/vscode/issues/10659

J
Johannes Rieken 已提交
798 799 800 801 802 803 804
	/**
	 * A workspace edit is a collection of textual and files changes for
	 * multiple resources and documents. Use the [applyEdit](#workspace.applyEdit)-function
	 * to apply a workspace edit. Note that all changes are applied in the same order in which
	 * they have been added and that invalid sequences like 'delete file a' -> 'insert text in
	 * file a' causes failure of the operation.
	 */
J
Johannes Rieken 已提交
805
	export interface WorkspaceEdit {
J
Johannes Rieken 已提交
806 807 808 809 810 811 812

		/**
		 * Create a regular file.
		 *
		 * @param uri Uri of the new file..
		 * @param options Defines if an existing file should be overwritten or be ignored.
		 */
813
		createFile(uri: Uri, options?: { overwrite?: boolean, ignoreIfExists?: boolean }): void;
J
Johannes Rieken 已提交
814 815 816 817 818 819

		/**
		 * Delete a file or folder.
		 *
		 * @param uri The uri of the file that is to be deleted.
		 */
820
		deleteFile(uri: Uri, options?: { recursive?: boolean }): void;
J
Johannes Rieken 已提交
821 822 823 824 825 826 827 828

		/**
		 * Rename a file or folder.
		 *
		 * @param oldUri The existing file.
		 * @param newUri The new location.
		 * @param options Defines if existing files should be overwritten.
		 */
J
Johannes Rieken 已提交
829
		renameFile(oldUri: Uri, newUri: Uri, options?: { overwrite?: boolean }): void;
830 831 832 833

		// replaceText(uri: Uri, range: Range, newText: string): void;
		// insertText(uri: Uri, position: Position, newText: string): void;
		// deleteText(uri: Uri, range: Range): void;
J
Johannes Rieken 已提交
834 835
	}

J
Johannes Rieken 已提交
836 837 838 839 840 841 842 843 844 845 846 847 848 849 850
	export namespace workspace {
		/**
		 * Make changes to one or many resources as defined by the given
		 * [workspace edit](#WorkspaceEdit).
		 *
		 * The editor implements an 'all-or-nothing'-strategy and that means failure to modify,
		 * delete, rename, or create one file will abort the operation. In that case, the thenable returned
		 * by this function resolves to `false`.
		 *
		 * @param edit A workspace edit.
		 * @return A thenable that resolves when the edit could be applied.
		 */
		export function applyEdit(edit: WorkspaceEdit): Thenable<boolean>;
	}

J
Johannes Rieken 已提交
851 852
	//#endregion

J
Johannes Rieken 已提交
853
	//#region mjbvz,joh: https://github.com/Microsoft/vscode/issues/43768
854 855 856
	export interface FileRenameEvent {
		readonly oldUri: Uri;
		readonly newUri: Uri;
C
Christof Marti 已提交
857 858
	}

859 860 861
	export interface FileWillRenameEvent {
		readonly oldUri: Uri;
		readonly newUri: Uri;
862
		waitUntil(thenable: Thenable<WorkspaceEdit>): void;
863 864
	}

865
	export namespace workspace {
866
		export const onWillRenameFile: Event<FileWillRenameEvent>;
867
		export const onDidRenameFile: Event<FileRenameEvent>;
868 869
	}
	//#endregion
870

M
Matt Bierner 已提交
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912
	//#region Matt: Deinition range

	/**
	 * Information about where a symbol is defined.
	 *
	 * Provides additional metadata over normal [location](#Location) definitions, including the range of
	 * the defining symbol
	 */
	export interface DefinitionLink {
		/**
		 * Span of the symbol being defined in the source file.
		 *
		 * Used as the underlined span for mouse definition hover. Defaults to the word range at
		 * the definition position.
		 */
		origin?: Range;

		/**
		 * The resource identifier of the definition.
		 */
		uri: Uri;

		/**
		 * The full range of the definition.
		 *
		 * For a class definition for example, this would be the entire body of the class definition.
		 */
		range: Range;

		/**
		 * The span of the symbol definition.
		 *
		 * For a class definition, this would be the class name itself in the class definition.
		 */
		selectionRange?: Range;
	}

	export interface DefinitionProvider {
		provideDefinition2?(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Definition | DefinitionLink[]>;
	}

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