Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace window

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

Index

Variables

activeColorTheme: ColorTheme

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

activeTerminal: Terminal | undefined

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

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.

Represents the current window's state.

readonly
terminals: readonly Terminal[]

The currently opened terminals or an empty array.

visibleTextEditors: readonly TextEditor[]

The currently visible editors or an empty array.

Functions

  • 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<CustomDocument> | CustomEditorProvider<CustomDocument>

      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.

  • 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

  • registerWebviewViewProvider(viewId: string, provider: WebviewViewProvider, options?: { webviewOptions?: { retainContextWhenHidden?: boolean } }): Disposable
  • Registers a webview panel serializer.

    Extensions that support reviving should have an "onWebviewPanel:viewType" activation event and make sure that registerWebviewPanelSerializer is called during activation.

    Only a single serializer may be registered at a time for a given viewType.

    Parameters

    • viewId: string
    • provider: WebviewViewProvider
    • Optional options: { webviewOptions?: { retainContextWhenHidden?: boolean } }
      • Optional Readonly webviewOptions?: { retainContextWhenHidden?: boolean }

        Content settings for the webview created for this view.

        • Optional Readonly retainContextWhenHidden?: boolean

          Controls if the webview element itself (iframe) is kept around even when the view is no longer visible.

          Normally the webview's html context is created when the view becomes visible and destroyed when it is hidden. Extensions that have complex state or UI can set the retainContextWhenHidden to make the editor keep the webview context around, even when the webview moves to a background tab. When a webview using retainContextWhenHidden becomes hidden, its scripts and other dynamic content are suspended. When the view becomes visible again, the context is automatically restored in the exact same state it was in originally. You cannot send messages to a hidden webview, even with retainContextWhenHidden enabled.

          retainContextWhenHidden has a high memory overhead and should only be used if your view's context cannot be quickly saved and restored.

    Returns Disposable

  • setStatusBarMessage(text: string): Disposable
  • setStatusBarMessage(text: string, hideAfterTimeout: number): Disposable
  • setStatusBarMessage(text: string, hideWhenDone: Thenable<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: Thenable<any>

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

    Returns Disposable

    A disposable which hides the status bar message.

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

    Type Parameters

    • T extends string

    Parameters

    • message: string

      a message to show.

    • Rest ...items: T[]

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

    Returns Thenable<T | undefined>

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

  • Show an error message.

    Type Parameters

    • T extends string

    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 Thenable<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.

    • Rest ...items: T[]

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

    Returns Thenable<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 Thenable<T | undefined>

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

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

    Type Parameters

    • T extends string

    Parameters

    • message: string

      a message to show.

    • Rest ...items: T[]

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

    Returns Thenable<T | undefined>

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

  • Show an information message.

    Type Parameters

    • T extends string

    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 Thenable<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.

    • Rest ...items: T[]

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

    Returns Thenable<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 Thenable<T | undefined>

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

  • 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

    Returns Thenable<string | undefined>

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

  • Shows a selection list.

    Parameters

    • items: readonly string[] | Thenable<readonly string[]>

      An array of strings, or a promise that resolves to an array of strings.

    • Optional options: QuickPickOptions

      Configures the behavior of the selection list.

    • Optional token: CancellationToken

      A token that can be used to signal cancellation.

    Returns Thenable<string | undefined>

    A promise that resolves to the selection or undefined.

  • Shows a selection list allowing multiple selections.

    Parameters

    • items: readonly string[] | Thenable<readonly string[]>

      An array of strings, or a promise that resolves to an array of strings.

    • options: QuickPickOptions & { canPickMany: true }

      Configures the behavior of the selection list.

    • Optional token: CancellationToken

      A token that can be used to signal cancellation.

    Returns Thenable<string[] | undefined>

    A promise that resolves to the selected items or undefined.

  • Shows a selection list.

    Type Parameters

    Parameters

    • items: readonly T[] | Thenable<readonly T[]>

      An array of items, or a promise that resolves to an array of items.

    • Optional options: QuickPickOptions

      Configures the behavior of the selection list.

    • Optional token: CancellationToken

      A token that can be used to signal cancellation.

    Returns Thenable<T | undefined>

    A promise that resolves to the selected item or undefined.

  • Shows a selection list allowing multiple selections.

    Type Parameters

    Parameters

    • items: readonly T[] | Thenable<readonly T[]>

      An array of items, or a promise that resolves to an array of items.

    • options: QuickPickOptions & { canPickMany: true }

      Configures the behavior of the selection list.

    • Optional token: CancellationToken

      A token that can be used to signal cancellation.

    Returns Thenable<T[] | undefined>

    A promise that resolves to the selected items or undefined.

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

    Type Parameters

    • T extends string

    Parameters

    • message: string

      a message to show.

    • Rest ...items: T[]

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

    Returns Thenable<T | undefined>

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

  • Show a warning message.

    Type Parameters

    • T extends string

    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 Thenable<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.

    • Rest ...items: T[]

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

    Returns Thenable<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 Thenable<T | undefined>

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

  • 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) => Thenable<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 Thenable<R>

    The thenable the task-callback returned.

  • Show progress in the Source Control viewlet while running the given callback and while its returned promise isn't resolve or rejected.

    deprecated

    Use withProgress instead.

    Type Parameters

    • R

    Parameters

    Returns Thenable<R>

    The thenable the task did return.