Options
All
  • Public
  • Public/Protected
  • All
Menu

Common namespace for dealing with window and editor, showing messages and user input.

Index

Variables

Let activeTerminal

activeTerminal: Terminal | undefined

The currently active terminal or undefined. The active terminal is the one that currently has focus or most recently had focus.

Let activeTextEditor

activeTextEditor: TextEditor | undefined

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.

Const onDidChangeActiveTerminal

onDidChangeActiveTerminal: Event<Terminal | undefined>

An event which fires when the active terminal has changed. Note that the event also fires when the active terminal changes to undefined.

Const onDidChangeActiveTextEditor

onDidChangeActiveTextEditor: Event<TextEditor | undefined>

An event which fires when the active editor has changed. Note that the event also fires when the active editor changes to undefined.

Const onDidChangeTextEditorOptions

onDidChangeTextEditorOptions: Event<TextEditorOptionsChangeEvent>

An event which fires when the options of an editor have changed.

Const onDidChangeTextEditorSelection

onDidChangeTextEditorSelection: Event<TextEditorSelectionChangeEvent>

An event which fires when the selection in an editor has changed.

Const onDidChangeTextEditorViewColumn

onDidChangeTextEditorViewColumn: Event<TextEditorViewColumnChangeEvent>

An event which fires when the view column of an editor has changed.

Const onDidChangeTextEditorVisibleRanges

onDidChangeTextEditorVisibleRanges: Event<TextEditorVisibleRangesChangeEvent>

An event which fires when the selection in an editor has changed.

Const onDidChangeVisibleTextEditors

onDidChangeVisibleTextEditors: Event<TextEditor[]>

An event which fires when the array of visible editors has changed.

Const onDidChangeWindowState

onDidChangeWindowState: Event<WindowState>

An event which fires when the focus state of the current window changes. The value of the event represents whether the window is focused.

Const onDidCloseTerminal

onDidCloseTerminal: Event<Terminal>

Event which fires when terminal did closed. Event value contains closed terminal definition.

Const onDidOpenTerminal

onDidOpenTerminal: Event<Terminal>

An event which fires when a terminal has been created, either through the createTerminal API or commands.

Let state

Represents the current window's state.

readonly

Let terminals

terminals: ReadonlyArray<Terminal>

The currently opened terminals or an empty array.

Let visibleTextEditors

visibleTextEditors: TextEditor[]

The currently visible editors or an empty array.

Functions

createInputBox

createOutputChannel

createQuickPick

createStatusBarItem

createTerminal

  • createTerminal(name?: undefined | string, shellPath?: undefined | string, shellArgs?: string[]): Terminal
  • createTerminal(options: TerminalOptions): Terminal
  • Create new terminal.

    Parameters

    • Optional name: undefined | string

      terminal name to display on the UI.

    • Optional shellPath: undefined | string

      path to the executable shell. For example "/bin/bash", "bash", "sh".

    • Optional shellArgs: string[]

      arguments to configure executable shell. For example ["-l"] - run shell without login.

    Returns Terminal

  • Create new terminal with predefined options.

    Parameters

    Returns Terminal

createTextEditorDecorationType

createTreeView

createWebviewPanel

registerTreeDataProvider

registerUriHandler

  • Registers a uri handler capable of handling system-wide 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 the product name;
    • The uri-authority must be the extension id (eg. 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: UriHandler

      The uri handler to register for this extension.

    Returns Disposable

registerWebviewPanelSerializer

setStatusBarMessage

  • setStatusBarMessage(text: string): Disposable
  • setStatusBarMessage(text: string, hideAfterTimeout: number): Disposable
  • setStatusBarMessage(text: string, hideWhenDone: PromiseLike<any>): Disposable
  • Set a message to the status bar.

    Parameters

    • text: string

      The message to show, supports icon substitution as in status bar.

    Returns Disposable

    A disposable which hides the status bar message.

  • Set a message to the status bar.

    Parameters

    • text: string

      The message to show, supports icon substitution as in status bar.

    • hideAfterTimeout: number

      Timeout in milliseconds after which the message will be disposed.

    Returns Disposable

    A disposable which hides the status bar message.

  • Set a message to the status bar.

    Parameters

    • text: string

      The message to show, supports icon substitution as in status bar.

    • hideWhenDone: PromiseLike<any>

      PromiseLike on which completion (resolve or reject) the message will be disposed.

    Returns Disposable

    A disposable which hides the status bar message.

showErrorMessage

  • showErrorMessage(message: string, ...items: string[]): PromiseLike<string | undefined>
  • showErrorMessage(message: string, options: MessageOptions, ...items: string[]): PromiseLike<string | undefined>
  • showErrorMessage<T>(message: string, ...items: T[]): PromiseLike<T | undefined>
  • showErrorMessage<T>(message: string, options: MessageOptions, ...items: T[]): PromiseLike<T | undefined>
  • Show an error message.

    Parameters

    • message: string

      a message to show.

    • Rest ...items: string[]

      A set of items that will be rendered as actions in the message.

    Returns PromiseLike<string | undefined>

    A promise that resolves to the selected item or undefined when being dismissed.

  • Show an error message.

    Parameters

    • message: string

      a message to show.

    • options: MessageOptions

      Configures the behaviour of the message.

    • Rest ...items: string[]

      A set of items that will be rendered as actions in the message.

    Returns PromiseLike<string | undefined>

    A promise that resolves to the selected item or undefined when being dismissed.

  • Show an error message.

    Type parameters

    Parameters

    • message: string

      a message to show.

    • Rest ...items: T[]

      A set of items that will be rendered as actions in the message.

    Returns PromiseLike<T | undefined>

    A promise that resolves to the selected item or undefined when being dismissed.

  • Show an error message.

    Type parameters

    Parameters

    • message: string

      a message to show.

    • options: MessageOptions

      Configures the behaviour of the message.

    • Rest ...items: T[]

      A set of items that will be rendered as actions in the message.

    Returns PromiseLike<T | undefined>

    A promise that resolves to the selected item or undefined when being dismissed.

showInformationMessage

  • showInformationMessage(message: string, ...items: string[]): PromiseLike<string | undefined>
  • showInformationMessage(message: string, options: MessageOptions, ...items: string[]): PromiseLike<string | undefined>
  • showInformationMessage<T>(message: string, ...items: T[]): PromiseLike<T | undefined>
  • showInformationMessage<T>(message: string, options: MessageOptions, ...items: T[]): PromiseLike<T | undefined>
  • Show an information message.

    Parameters

    • message: string

      a message to show.

    • Rest ...items: string[]

      A set of items that will be rendered as actions in the message.

    Returns PromiseLike<string | undefined>

    A promise that resolves to the selected item or undefined when being dismissed.

  • Show an information message.

    Parameters

    • message: string

      a message to show.

    • options: MessageOptions

      Configures the behaviour of the message.

    • Rest ...items: string[]

      A set of items that will be rendered as actions in the message.

    Returns PromiseLike<string | undefined>

    A promise that resolves to the selected item or undefined when being dismissed.

  • Show an information message.

    Type parameters

    Parameters

    • message: string

      a message to show.

    • Rest ...items: T[]

      A set of items that will be rendered as actions in the message.

    Returns PromiseLike<T | undefined>

    A promise that resolves to the selected item or undefined when being dismissed.

  • Show an information message.

    Type parameters

    Parameters

    • message: string

      a message to show.

    • options: MessageOptions

      Configures the behaviour of the message.

    • Rest ...items: T[]

      A set of items that will be rendered as actions in the message.

    Returns PromiseLike<T | undefined>

    A promise that resolves to the selected item or undefined when being dismissed.

showInputBox

  • 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

    • Optional options: InputBoxOptions

      Configures the behavior of the input box.

    • Optional token: CancellationToken

      A token that can be used to signal cancellation.

    Returns PromiseLike<string | undefined>

    A promise that resolves to a string the user provided or to undefined in case of dismissal.

showOpenDialog

  • Shows a file open dialog to the user which allows to select a file for opening-purposes.

    Parameters

    Returns PromiseLike<Uri[] | undefined>

    A promise that resolves to the selected resources or undefined.

showQuickPick

showSaveDialog

  • Shows a file save dialog to the user which allows to select a file for saving-purposes.

    Parameters

    Returns PromiseLike<Uri | undefined>

    A promise that resolves to the selected resource or undefined.

showTextDocument

showUploadDialog

  • Shows a file upload dialog to the user which allows to upload files for various purposes.

    Parameters

    Returns PromiseLike<Uri[] | undefined>

    A promise that resolves the paths of uploaded files or undefined.

showWarningMessage

  • showWarningMessage(message: string, ...items: string[]): PromiseLike<string | undefined>
  • showWarningMessage(message: string, options: MessageOptions, ...items: string[]): PromiseLike<string | undefined>
  • showWarningMessage<T>(message: string, ...items: T[]): PromiseLike<T | undefined>
  • showWarningMessage<T>(message: string, options: MessageOptions, ...items: T[]): PromiseLike<T | undefined>
  • Show a warning message.

    Parameters

    • message: string

      a message to show.

    • Rest ...items: string[]

      A set of items that will be rendered as actions in the message.

    Returns PromiseLike<string | undefined>

    A promise that resolves to the selected item or undefined when being dismissed.

  • Show a warning message.

    Parameters

    • message: string

      a message to show.

    • options: MessageOptions

      Configures the behaviour of the message.

    • Rest ...items: string[]

      A set of items that will be rendered as actions in the message.

    Returns PromiseLike<string | undefined>

    A promise that resolves to the selected item or undefined when being dismissed.

  • Show a warning message.

    Type parameters

    Parameters

    • message: string

      a message to show.

    • Rest ...items: T[]

      A set of items that will be rendered as actions in the message.

    Returns PromiseLike<T | undefined>

    A promise that resolves to the selected item or undefined when being dismissed.

  • Show a warning message.

    Type parameters

    Parameters

    • message: string

      a message to show.

    • options: MessageOptions

      Configures the behaviour of the message.

    • Rest ...items: T[]

      A set of items that will be rendered as actions in the message.

    Returns PromiseLike<T | undefined>

    A promise that resolves to the selected item or undefined when being dismissed.

showWorkspaceFolderPick

withProgress

  • withProgress<R>(options: ProgressOptions, task: function): PromiseLike<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 ProgressOptions.

    Type parameters

    • R

    Parameters

    • options: ProgressOptions
    • task: function

      A callback returning a promise. Progress state can be reported with the provided 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 CancellationToken. Note that currently only ProgressLocation.Notification is supporting to show a cancel button to cancel the long running operation.

    Returns PromiseLike<R>

    The thenable the task-callback returned.