Variables
activeColorTheme:ColorTheme
The currently active color theme as configured in the settings. The active
theme can be changed via the workbench.colorTheme
setting.
read onlyactiveTerminal:Null<Terminal>
The currently active terminal or undefined
. The active terminal is the one that
currently has focus or most recently had focus.
activeTextEditor:Null<TextEditor>
The currently active editor or undefined
. The active editor is the one
that currently has focus or, when none has focus, the one that has changed
input most recently.
read onlyonDidChangeActiveColorTheme:Event<ColorTheme>
An {@link Event} which fires when the active color theme is changed or has changes.
read onlyonDidChangeActiveTerminal:Null<Event<Terminal>>
An {@link Event} which fires when the {@link window.activeTerminal active terminal}
has changed. Note that the event also fires when the active terminal changes
to undefined
.
read onlyonDidChangeActiveTextEditor:Event<Null<TextEditor>>
An {@link Event} which fires when the {@link window.activeTextEditor active editor}
has changed. Note that the event also fires when the active editor changes
to undefined
.
read onlyonDidChangeTextEditorOptions:Event<TextEditorOptionsChangeEvent>
An {@link Event} which fires when the options of an editor have changed.
read onlyonDidChangeTextEditorSelection:Event<TextEditorSelectionChangeEvent>
An {@link Event} which fires when the selection in an editor has changed.
read onlyonDidChangeTextEditorViewColumn:Event<TextEditorViewColumnChangeEvent>
An {@link Event} which fires when the view column of an editor has changed.
read onlyonDidChangeTextEditorVisibleRanges:Event<TextEditorVisibleRangesChangeEvent>
An {@link Event} which fires when the visible ranges of an editor has changed.
read onlyonDidChangeVisibleTextEditors:Event<Array<TextEditor>>
An {@link Event} which fires when the array of {@link window.visibleTextEditors visible editors} has changed.
read onlyonDidChangeWindowState:Event<WindowState>
An {@link Event} which fires when the focus state of the current window changes. The value of the event represents whether the window is focused.
read onlyonDidCloseTerminal:Event<Terminal>
An {@link Event} which fires when a terminal is disposed.
read onlyonDidOpenTerminal:Event<Terminal>
An {@link Event} which fires when a terminal has been created, either through the {@link window.createTerminal createTerminal} API or commands.
Methods
createInputBox():InputBox
Creates a {@link InputBox} to let the user enter some text input.
Note that in many cases the more convenient {@link window.showInputBox} is easier to use. {@link window.createInputBox} should be used when {@link window.showInputBox} does not offer the required flexibility.
@link InputBox}.
Returns:
A new {
createOutputChannel(name:String):OutputChannel
Creates a new {@link OutputChannel output channel} with the given name.
Parameters:
name | Human-readable string which will be used to represent the channel in the UI. |
---|
createQuickPick<T>():QuickPick<T>
Creates a {@link QuickPick} to let the user pick an item from a list of items of type T.
Note that in many cases the more convenient {@link window.showQuickPick} is easier to use. {@link window.createQuickPick} should be used when {@link window.showQuickPick} does not offer the required flexibility.
@link QuickPick}.
Returns:
A new {
createStatusBarItem(?alignment:StatusBarAlignment, ?priority:Float):StatusBarItem
createStatusBarItem(id:String, ?alignment:StatusBarAlignment, ?priority:Float):StatusBarItem
Creates a status bar {@link StatusBarItem item}.
Parameters:
id | The unique identifier of the item. |
---|---|
alignment | The alignment of the item. |
priority | The priority of the item. Higher values mean the item should be shown more to the left. |
Returns:
A new status bar item.
createTerminal(?name:String, ?shellPath:String, ?shellArgs:EitherType<Array<String>, String>):Terminal
createTerminal(options:TerminalOptions):Terminal
createTerminal(options:ExtensionTerminalOptions):Terminal
Creates a {@link Terminal} with a backing shell process. The cwd of the terminal will be the workspace directory if it exists.
@link ExtensionTerminalOptions} object describing the characteristics of the new terminal.
Parameters:
name | Optional human-readable string which will be used to represent the terminal in the UI. |
---|---|
shellPath | Optional path to a custom shell executable to be used in the terminal. |
shellArgs | Optional args for the custom shell executable. A string can be used on Windows only which allows specifying shell args in command-line format. |
options | A TerminalOptions object describing the characteristics of the new terminal. |
options | An { |
Returns:
A new Terminal.
Throws:
When | running in an environment where a new process cannot be started. |
---|
createTextEditorDecorationType(options:DecorationRenderOptions):TextEditorDecorationType
Create a TextEditorDecorationType that can be used to add decorations to text editors.
Parameters:
options | Rendering options for the decoration type. |
---|
Returns:
A new decoration type instance.
createTreeView<T>(viewId:String, options:TreeViewOptions<T>):TreeView<T>
Create a {@link TreeView} for the view contributed using the extension point views
.
@link TreeView}
@link TreeView}.
Parameters:
viewId | Id of the view contributed using the extension point |
---|---|
options | Options for creating the { |
Returns:
a {
createWebviewPanel(viewType:String, title:String, showOptions:EitherType<ViewColumn, {viewColumn:ViewColumn, preserveFocus:Null<Bool>}>, ?options:Null<{retainContextWhenHidden:Null<Bool>, portMapping:Null<ReadOnlyArray<WebviewPortMapping>>, localResourceRoots:Null<ReadOnlyArray<Uri>>, enableScripts:Null<Bool>, enableFindWidget:Null<Bool>, enableCommandUris:Null<Bool>}>):WebviewPanel
Create and show a new webview panel.
Parameters:
viewType | Identifies the type of the webview panel. |
---|---|
title | Title of the panel. |
showOptions | Where to show the webview in the editor. If preserveFocus is set, the new webview will not take focus. |
options | Settings for the new panel. |
Returns:
New webview panel.
registerCustomEditorProvider<T>(viewType:String, provider:EitherType<CustomTextEditorProvider, EitherType<CustomReadonlyEditorProvider<T>, CustomEditorProvider<T>>>, ?options:{webviewOptions:Null<WebviewPanelOptions>, supportsMultipleEditorsPerDocument:Null<Bool>}):Disposable
Register a provider for custom editors for the viewType
contributed by the customEditors
extension point.
When a custom editor is opened, an onCustomEditor:viewType
activation event is fired. Your extension
must register a {@linkcode CustomTextEditorProvider}, {@linkcode CustomReadonlyEditorProvider},
{@linkcode CustomEditorProvider}for viewType
as part of activation.
Parameters:
viewType | Unique identifier for the custom editor provider. This should match the |
---|---|
provider | Provider that resolves custom editors. |
options | Options for the provider. |
Returns:
Disposable that unregisters the provider.
registerFileDecorationProvider(provider:FileDecorationProvider):Disposable
Register a file decoration provider.
@link FileDecorationProvider}. @link Disposable} that unregisters the provider.
Parameters:
provider | A { |
---|
Returns:
A {
registerTerminalLinkProvider<T>(provider:TerminalLinkProvider<T>):Disposable
Register provider that enables the detection and handling of links within the terminal.
Parameters:
provider | The provider that provides the terminal links. |
---|
Returns:
Disposable that unregisters the provider.
registerTerminalProfileProvider(id:String, provider:TerminalProfileProvider):Disposable
Registers a provider for a contributed terminal profile.
Parameters:
id | The ID of the contributed terminal profile. |
---|---|
provider | The terminal profile provider. |
registerTreeDataProvider<T>(viewId:String, treeDataProvider:TreeDataProvider<T>):Disposable
Register a {@link TreeDataProvider} for the view contributed using the extension point views
.
This will allow you to contribute data to the {@link TreeView} and update if the data changes.
Note: To get access to the {@link TreeView} and perform operations on it, use {@link window.createTreeView createTreeView}.
@link TreeDataProvider} that provides tree data for the view
Parameters:
viewId | Id of the view contributed using the extension point |
---|---|
treeDataProvider | A { |
registerUriHandler(handler:UriHandler):Disposable
Registers a {@link UriHandler uri handler} capable of handling system-wide {@link Uri uris}. In case there are multiple windows open, the topmost window will handle the uri. A uri handler is scoped to the extension it is contributed from; it will only be able to handle uris which are directed to the extension itself. A uri must respect the following rules:
- The uri-scheme must be
vscode.env.uriScheme
; - The uri-authority must be the extension id (e.g.
my.extension
); - The uri-path, -query and -fragment parts are arbitrary.
For example, if the my.extension
extension registers a uri handler, it will only
be allowed to handle uris with the prefix product-name://my.extension
.
An extension can only register a single uri handler in its entire activation lifetime.
- Note: There is an activation event
onUri
that fires when a uri directed for the current extension is about to be handled.
Parameters:
handler | The uri handler to register for this extension. |
---|
registerWebviewPanelSerializer<T>(viewType:String, serializer:WebviewPanelSerializer<T>):Disposable
Registers a webview panel serializer.
Extensions that support reviving should have an "onWebviewPanel:viewType"
activation event and
make sure that {@link registerWebviewPanelSerializer} is called during activation.
Only a single serializer may be registered at a time for a given viewType
.
Parameters:
viewType | Type of the webview panel that can be serialized. |
---|---|
serializer | Webview serializer. |
registerWebviewViewProvider(viewId:String, provider:WebviewViewProvider, ?options:{webviewOptions:Null<{retainContextWhenHidden:Null<Bool>}>}):Disposable
Register a new provider for webview views.
Parameters:
viewId | Unique id of the view. This should match the |
---|---|
provider | Provider for the webview views. |
Returns:
Disposable that unregisters the provider.
setStatusBarMessage(text:String):Disposable
setStatusBarMessage(text:String, hideAfterTimeout:Float):Disposable
setStatusBarMessage(text:String, hideWhenDone:Thenable<Dynamic>):Disposable
Set a message to the status bar. This is a short hand for the more powerful status bar {@link window.createStatusBarItem items}.
Note that status bar messages without hide arguments stack and that they must be disposed when no longer used.
@link StatusBarItem.text items}.
Parameters:
text | The message to show, supports icon substitution as in status bar { |
---|---|
hideAfterTimeout | Timeout in milliseconds after which the message will be disposed. |
hideWhenDone | Thenable on which completion (resolve or reject) the message will be disposed. |
Returns:
A disposable which hides the status bar message.
showErrorMessage(message:String, options:MessageOptions, items:Rest<String>):Thenable<Null<String>>
showErrorMessage<T>(message:String, items:Rest<T>):Thenable<Null<T>>
showErrorMessage<T>(message:String, options:MessageOptions, items:Rest<T>):Thenable<Null<T>>
showErrorMessage(message:String, items:Rest<String>):Thenable<Null<String>>
Show an error message.
@link window.showInformationMessage showInformationMessage}
Parameters:
message | The message to show. |
---|---|
options | Configures the behaviour of the message. |
items | A set of items that will be rendered as actions in the message. |
Returns:
A thenable that resolves to the selected item or undefined
when being dismissed.
See also:
{
showInformationMessage(message:String, options:MessageOptions, items:Rest<String>):Thenable<Null<String>>
showInformationMessage<T>(message:String, items:Rest<T>):Thenable<Null<T>>
showInformationMessage<T>(message:String, options:MessageOptions, items:Rest<T>):Thenable<Null<T>>
showInformationMessage(message:String, items:Rest<String>):Thenable<Null<String>>
Show an information message.
@link window.showInformationMessage showInformationMessage}
Parameters:
message | The message to show. |
---|---|
items | A set of items that will be rendered as actions in the message. |
options | Configures the behaviour of the message. |
Returns:
A thenable that resolves to the selected item or undefined
when being dismissed.
See also:
{
showInputBox(?options:InputBoxOptions, ?token:CancellationToken):Thenable<Null<String>>
Opens an input box to ask the user for input.
The returned value will be undefined if the input box was canceled (e.g. pressing ESC). Otherwise the returned value will be the string typed by the user or an empty string if the user did not type anything but dismissed the input box with OK.
Parameters:
options | Configures the behavior of the input box. |
---|---|
token | A token that can be used to signal cancellation. |
Returns:
A promise that resolves to a string the user provided or to undefined
in case of dismissal.
showOpenDialog(?options:OpenDialogOptions):Thenable<Null<Array<Uri>>>
Shows a file open dialog to the user which allows to select a file for opening-purposes.
Parameters:
options | Options that control the dialog. |
---|
Returns:
A promise that resolves to the selected resources or undefined
.
showQuickPick<T>(items:EitherType<ReadOnlyArray<T>, Thenable<ReadOnlyArray<T>>>, ?options:QuickPickOptions, ?token:CancellationToken):Thenable<Null<T>>
showQuickPick(items:EitherType<ReadOnlyArray<String>, Thenable<ReadOnlyArray<String>>>, ?options:QuickPickOptions, ?token:CancellationToken):Thenable<Null<String>>
Shows a selection list.
Parameters:
items | An array of strings, or a promise that resolves to an array of strings. |
---|---|
options | Configures the behavior of the selection list. |
token | A token that can be used to signal cancellation. |
Returns:
A promise that resolves to the selection or undefined
.
inlineshowQuickPickMany<T>(items:EitherType<ReadOnlyArray<T>, Thenable<ReadOnlyArray<T>>>, ?options:QuickPickOptions, ?token:CancellationToken):Thenable<Null<Array<T>>>
Shows a selection list allowing multiple selections.
Parameters:
items | An array of items, or a promise that resolves to an array of items. |
---|---|
options | Configures the behavior of the selection list. |
token | A token that can be used to signal cancellation. |
Returns:
A promise that resolves to the selected items or undefined
.
showSaveDialog(?options:SaveDialogOptions):Thenable<Null<Uri>>
Shows a file save dialog to the user which allows to select a file for saving-purposes.
Parameters:
options | Options that control the dialog. |
---|
Returns:
A promise that resolves to the selected resource or undefined
.
showTextDocument(document:TextDocument, ?column:ViewColumn, ?preserveFocus:Bool):Thenable<TextEditor>
showTextDocument(uri:Uri, ?options:TextDocumentShowOptions):Thenable<TextEditor>
showTextDocument(document:TextDocument, ?options:TextDocumentShowOptions):Thenable<TextEditor>
Show the given document in a text editor. A {@link ViewColumn column} can be provided to control where the editor is being shown. Might change the {@link window.activeTextEditor active editor}.
@link TextEditor editor} should be shown. The default is the {@link ViewColumn.Active active}, other values
are adjusted to be Min(column, columnCount + 1)
, the {@link ViewColumn.Active active}-column is not adjusted. Use {@linkcode ViewColumn.Beside}
to open the editor to the side of the currently active one.
@link TextEditor editor}.
Parameters:
document | A text document to be shown. |
---|---|
column | A view column in which the { |
preserveFocus | When |
Returns:
A promise that resolves to an {
showWarningMessage(message:String, options:MessageOptions, items:Rest<String>):Thenable<Null<String>>
showWarningMessage<T>(message:String, items:Rest<T>):Thenable<Null<T>>
showWarningMessage<T>(message:String, options:MessageOptions, items:Rest<T>):Thenable<Null<T>>
showWarningMessage(message:String, items:Rest<String>):Thenable<Null<String>>
Show a warning message.
@link window.showInformationMessage showInformationMessage}
Parameters:
message | The message to show. |
---|---|
options | Configures the behaviour of the message. |
items | A set of items that will be rendered as actions in the message. |
Returns:
A thenable that resolves to the selected item or undefined
when being dismissed.
See also:
{
showWorkspaceFolderPick(?options:WorkspaceFolderPickOptions):Thenable<Null<WorkspaceFolder>>
Shows a selection list of {@link workspace.workspaceFolders workspace folders} to pick from.
Returns undefined
if no folder is open.
Parameters:
options | Configures the behavior of the workspace folder list. |
---|
Returns:
A promise that resolves to the workspace folder or undefined
.
withProgress<R>(options:ProgressOptions, task:(Progress<{message:Null<String>, increment:Null<Float>}>, CancellationToken) ‑> Thenable<R>):Thenable<R>
Show progress in the editor. Progress is shown while running the given callback and while the promise it returned isn't resolved nor rejected. The location at which progress should show (and other details) is defined via the passed {@linkcode ProgressOptions}.
@link Progress}-object.
To report discrete progress, use increment
to indicate how much work has been completed. Each call with
a increment
value will be summed up and reflected as overall progress until 100% is reached (a value of
e.g. 10
accounts for 10%
of work done).
Note that currently only ProgressLocation.Notification
is capable of showing discrete progress.
To monitor if the operation has been cancelled by the user, use the provided {@linkcode CancellationToken}.
Note that currently only ProgressLocation.Notification
is supporting to show a cancel button to cancel the
long running operation.
Parameters:
task | A callback returning a promise. Progress state can be reported with the provided { |
---|
Returns:
The thenable the task-callback returned.
withScmProgress<R>(task:Progress<Float> ‑> Thenable<R>):Thenable<R>
Use withProgress
instead.
Show progress in the Source Control viewlet while running the given callback and while its returned promise isn't resolve or rejected.
@link Progress}-object.
Parameters:
task | A callback returning a promise. Progress increments can be reported with the provided { |
---|
Returns:
The thenable the task did return.