Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace window

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

Index

Variables

Let activeColorTheme

activeColorTheme: ColorTheme

The currently active color theme as configured in the settings. The active theme can be changed via the workbench.colorTheme setting.

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.

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

createTextEditorDecorationType

createTreeView

createWebviewPanel

Const onDidChangeActiveColorTheme

Const onDidChangeActiveTerminal

Const onDidChangeActiveTextEditor

Const onDidChangeTextEditorOptions

Const onDidChangeTextEditorSelection

Const onDidChangeTextEditorViewColumn

Const onDidChangeTextEditorVisibleRanges

Const onDidChangeVisibleTextEditors

Const onDidChangeWindowState

Const onDidCloseTerminal

Const onDidOpenTerminal

registerCustomEditorProvider

  • Register a provider for custom editors for the viewType contributed by the customEditors extension point.

    When a custom editor is opened, Theia fires an onCustomEditor:viewType activation event. Your extension must register a CustomTextEditorProvider, CustomReadonlyEditorProvider, CustomEditorProviderfor viewType as part of activation.

    Parameters

    • viewType: string

      Unique identifier for the custom editor provider. This should match the viewType from the customEditors contribution point.

    • provider: CustomTextEditorProvider | CustomReadonlyEditorProvider | CustomEditorProvider

      Provider that resolves custom editors.

    • Optional options: { supportsMultipleEditorsPerDocument?: boolean; webviewOptions?: WebviewPanelOptions }

      Options for the provider.

      • Optional Readonly supportsMultipleEditorsPerDocument?: boolean

        Only applies to CustomReadonlyEditorProvider | CustomEditorProvider.

        Indicates that the provider allows multiple editor instances to be open at the same time for the same resource.

        By default, Theia only allows one editor instance to be open at a time for each resource. If the user tries to open a second editor instance for the resource, the first one is instead moved to where the second one was to be opened.

        When supportsMultipleEditorsPerDocument is enabled, users can split and create copies of the custom editor. In this case, the custom editor must make sure it can properly synchronize the states of all editor instances for a resource so that they are consistent.

      • Optional Readonly webviewOptions?: WebviewPanelOptions

        Content settings for the webview panels created for this custom editor.

    Returns Disposable

    Disposable that unregisters the provider.

registerFileDecorationProvider

registerTerminalLinkProvider

  • Register provider that enables the detection and handling of links within the terminal.

    Parameters

    Returns void

    Disposable that unregisters the provider.

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

  • 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: (progress: Progress<{ increment?: number; message?: string }>, token: CancellationToken) => PromiseLike<R>

      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.