|
| 1 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | +'use strict'; |
| 4 | + |
| 5 | +import * as vscode from 'vscode'; |
| 6 | + |
| 7 | +export const IApplicationShell = Symbol('IApplicationShell'); |
| 8 | +export interface IApplicationShell { |
| 9 | + showInformationMessage(message: string, ...items: string[]): Thenable<string | undefined>; |
| 10 | + |
| 11 | + /** |
| 12 | + * Show an information message to users. Optionally provide an array of items which will be presented as |
| 13 | + * clickable buttons. |
| 14 | + * |
| 15 | + * @param message The message to show. |
| 16 | + * @param options Configures the behaviour of the message. |
| 17 | + * @param items A set of items that will be rendered as actions in the message. |
| 18 | + * @return A thenable that resolves to the selected item or `undefined` when being dismissed. |
| 19 | + */ |
| 20 | + showInformationMessage(message: string, options: vscode.MessageOptions, ...items: string[]): Thenable<string | undefined>; |
| 21 | + |
| 22 | + /** |
| 23 | + * Show an information message. |
| 24 | + * |
| 25 | + * @see [showInformationMessage](#window.showInformationMessage) |
| 26 | + * |
| 27 | + * @param message The message to show. |
| 28 | + * @param items A set of items that will be rendered as actions in the message. |
| 29 | + * @return A thenable that resolves to the selected item or `undefined` when being dismissed. |
| 30 | + */ |
| 31 | + showInformationMessage<T extends vscode.MessageItem>(message: string, ...items: T[]): Thenable<T | undefined>; |
| 32 | + |
| 33 | + /** |
| 34 | + * Show an information message. |
| 35 | + * |
| 36 | + * @see [showInformationMessage](#window.showInformationMessage) |
| 37 | + * |
| 38 | + * @param message The message to show. |
| 39 | + * @param options Configures the behaviour of the message. |
| 40 | + * @param items A set of items that will be rendered as actions in the message. |
| 41 | + * @return A thenable that resolves to the selected item or `undefined` when being dismissed. |
| 42 | + */ |
| 43 | + showInformationMessage<T extends vscode.MessageItem>(message: string, options: vscode.MessageOptions, ...items: T[]): Thenable<T | undefined>; |
| 44 | + |
| 45 | + /** |
| 46 | + * Show a warning message. |
| 47 | + * |
| 48 | + * @see [showInformationMessage](#window.showInformationMessage) |
| 49 | + * |
| 50 | + * @param message The message to show. |
| 51 | + * @param items A set of items that will be rendered as actions in the message. |
| 52 | + * @return A thenable that resolves to the selected item or `undefined` when being dismissed. |
| 53 | + */ |
| 54 | + showWarningMessage(message: string, ...items: string[]): Thenable<string | undefined>; |
| 55 | + |
| 56 | + /** |
| 57 | + * Show a warning message. |
| 58 | + * |
| 59 | + * @see [showInformationMessage](#window.showInformationMessage) |
| 60 | + * |
| 61 | + * @param message The message to show. |
| 62 | + * @param options Configures the behaviour of the message. |
| 63 | + * @param items A set of items that will be rendered as actions in the message. |
| 64 | + * @return A thenable that resolves to the selected item or `undefined` when being dismissed. |
| 65 | + */ |
| 66 | + showWarningMessage(message: string, options: vscode.MessageOptions, ...items: string[]): Thenable<string | undefined>; |
| 67 | + |
| 68 | + /** |
| 69 | + * Show a warning message. |
| 70 | + * |
| 71 | + * @see [showInformationMessage](#window.showInformationMessage) |
| 72 | + * |
| 73 | + * @param message The message to show. |
| 74 | + * @param items A set of items that will be rendered as actions in the message. |
| 75 | + * @return A thenable that resolves to the selected item or `undefined` when being dismissed. |
| 76 | + */ |
| 77 | + showWarningMessage<T extends vscode.MessageItem>(message: string, ...items: T[]): Thenable<T | undefined>; |
| 78 | + |
| 79 | + /** |
| 80 | + * Show a warning message. |
| 81 | + * |
| 82 | + * @see [showInformationMessage](#window.showInformationMessage) |
| 83 | + * |
| 84 | + * @param message The message to show. |
| 85 | + * @param options Configures the behaviour of the message. |
| 86 | + * @param items A set of items that will be rendered as actions in the message. |
| 87 | + * @return A thenable that resolves to the selected item or `undefined` when being dismissed. |
| 88 | + */ |
| 89 | + showWarningMessage<T extends vscode.MessageItem>(message: string, options: vscode.MessageOptions, ...items: T[]): Thenable<T | undefined>; |
| 90 | + |
| 91 | + /** |
| 92 | + * Show an error message. |
| 93 | + * |
| 94 | + * @see [showInformationMessage](#window.showInformationMessage) |
| 95 | + * |
| 96 | + * @param message The message to show. |
| 97 | + * @param items A set of items that will be rendered as actions in the message. |
| 98 | + * @return A thenable that resolves to the selected item or `undefined` when being dismissed. |
| 99 | + */ |
| 100 | + showErrorMessage(message: string, ...items: string[]): Thenable<string | undefined>; |
| 101 | + |
| 102 | + /** |
| 103 | + * Show an error message. |
| 104 | + * |
| 105 | + * @see [showInformationMessage](#window.showInformationMessage) |
| 106 | + * |
| 107 | + * @param message The message to show. |
| 108 | + * @param options Configures the behaviour of the message. |
| 109 | + * @param items A set of items that will be rendered as actions in the message. |
| 110 | + * @return A thenable that resolves to the selected item or `undefined` when being dismissed. |
| 111 | + */ |
| 112 | + showErrorMessage(message: string, options: vscode.MessageOptions, ...items: string[]): Thenable<string | undefined>; |
| 113 | + |
| 114 | + /** |
| 115 | + * Show an error message. |
| 116 | + * |
| 117 | + * @see [showInformationMessage](#window.showInformationMessage) |
| 118 | + * |
| 119 | + * @param message The message to show. |
| 120 | + * @param items A set of items that will be rendered as actions in the message. |
| 121 | + * @return A thenable that resolves to the selected item or `undefined` when being dismissed. |
| 122 | + */ |
| 123 | + showErrorMessage<T extends vscode.MessageItem>(message: string, ...items: T[]): Thenable<T | undefined>; |
| 124 | + |
| 125 | + /** |
| 126 | + * Show an error message. |
| 127 | + * |
| 128 | + * @see [showInformationMessage](#window.showInformationMessage) |
| 129 | + * |
| 130 | + * @param message The message to show. |
| 131 | + * @param options Configures the behaviour of the message. |
| 132 | + * @param items A set of items that will be rendered as actions in the message. |
| 133 | + * @return A thenable that resolves to the selected item or `undefined` when being dismissed. |
| 134 | + */ |
| 135 | + showErrorMessage<T extends vscode.MessageItem>(message: string, options: vscode.MessageOptions, ...items: T[]): Thenable<T | undefined>; |
| 136 | + |
| 137 | + /** |
| 138 | + * Shows a selection list. |
| 139 | + * |
| 140 | + * @param items An array of strings, or a promise that resolves to an array of strings. |
| 141 | + * @param options Configures the behavior of the selection list. |
| 142 | + * @param token A token that can be used to signal cancellation. |
| 143 | + * @return A promise that resolves to the selection or `undefined`. |
| 144 | + */ |
| 145 | + showQuickPick(items: string[] | Thenable<string[]>, options?: vscode.QuickPickOptions, token?: vscode.CancellationToken): Thenable<string | undefined>; |
| 146 | + |
| 147 | + /** |
| 148 | + * Shows a selection list. |
| 149 | + * |
| 150 | + * @param items An array of items, or a promise that resolves to an array of items. |
| 151 | + * @param options Configures the behavior of the selection list. |
| 152 | + * @param token A token that can be used to signal cancellation. |
| 153 | + * @return A promise that resolves to the selected item or `undefined`. |
| 154 | + */ |
| 155 | + showQuickPick<T extends vscode.QuickPickItem>(items: T[] | Thenable<T[]>, options?: vscode.QuickPickOptions, token?: vscode.CancellationToken): Thenable<T | undefined>; |
| 156 | + |
| 157 | + /** |
| 158 | + * Shows a file open dialog to the user which allows to select a file |
| 159 | + * for opening-purposes. |
| 160 | + * |
| 161 | + * @param options Options that control the dialog. |
| 162 | + * @returns A promise that resolves to the selected resources or `undefined`. |
| 163 | + */ |
| 164 | + showOpenDialog(options: vscode.OpenDialogOptions): Thenable<vscode.Uri[] | undefined>; |
| 165 | + |
| 166 | + /** |
| 167 | + * Shows a file save dialog to the user which allows to select a file |
| 168 | + * for saving-purposes. |
| 169 | + * |
| 170 | + * @param options Options that control the dialog. |
| 171 | + * @returns A promise that resolves to the selected resource or `undefined`. |
| 172 | + */ |
| 173 | + showSaveDialog(options: vscode.SaveDialogOptions): Thenable<vscode.Uri | undefined>; |
| 174 | + |
| 175 | + /** |
| 176 | + * Opens an input box to ask the user for input. |
| 177 | + * |
| 178 | + * The returned value will be `undefined` if the input box was canceled (e.g. pressing ESC). Otherwise the |
| 179 | + * returned value will be the string typed by the user or an empty string if the user did not type |
| 180 | + * anything but dismissed the input box with OK. |
| 181 | + * |
| 182 | + * @param options Configures the behavior of the input box. |
| 183 | + * @param token A token that can be used to signal cancellation. |
| 184 | + * @return A promise that resolves to a string the user provided or to `undefined` in case of dismissal. |
| 185 | + */ |
| 186 | + showInputBox(options?: vscode.InputBoxOptions, token?: vscode.CancellationToken): Thenable<string | undefined>; |
| 187 | + |
| 188 | + /** |
| 189 | + * Opens URL in a default browser. |
| 190 | + * |
| 191 | + * @param url Url to open. |
| 192 | + */ |
| 193 | + openUrl(url: string): void; |
| 194 | +} |
0 commit comments