Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace window

Namespace for dealing with the current window of the editor. That is visible and active editors, as well as, UI elements to show messages, selections, and asking for user input.

Index

Variables(9)

Const tabGroups

tabGroups: TabGroups

Represents the grid widget within the main editor area

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 visibleTextEditors

visibleTextEditors: readonly TextEditor[]

The currently visible editors or an empty array.

Const visibleNotebookEditors

visibleNotebookEditors: readonly NotebookEditor[]

The currently visible notebook editors or an empty array.

Const activeNotebookEditor

activeNotebookEditor: NotebookEditor | undefined

The currently active notebook 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 terminals

terminals: readonly Terminal[]

The currently opened terminals or an empty array.

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

Const state

Represents the current window's state.

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.

Functions(45)

Const onDidChangeActiveTextEditor

Const onDidChangeVisibleTextEditors

Const onDidChangeTextEditorSelection

Const onDidChangeTextEditorVisibleRanges

Const onDidChangeTextEditorOptions

Const onDidChangeTextEditorViewColumn

Const onDidChangeVisibleNotebookEditors

Const onDidChangeActiveNotebookEditor

Const onDidChangeNotebookEditorSelection

Const onDidChangeNotebookEditorVisibleRanges

Const onDidChangeActiveTerminal

Const onDidOpenTerminal

Const onDidCloseTerminal

Const onDidChangeTerminalState

Const onDidChangeWindowState

showTextDocument

showNotebookDocument

createTextEditorDecorationType

showInformationMessage

  • 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 to users. Optionally provide an array of items which will be presented as clickable buttons.

    Type parameters

    • T: string

    Parameters

    • message: string

      The message to show.

    • Rest ...items: T[]

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

    Returns Thenable<T | undefined>

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

  • Show an information message to users. Optionally provide an array of items which will be presented as clickable buttons.

    Type parameters

    • T: string

    Parameters

    • message: string

      The 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 thenable that resolves to the selected item or undefined when being dismissed.

  • Show an information message.

    see

    showInformationMessage

    Type parameters

    Parameters

    • message: string

      The message to show.

    • Rest ...items: T[]

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

    Returns Thenable<T | undefined>

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

  • Show an information message.

    see

    showInformationMessage

    Type parameters

    Parameters

    • message: string

      The 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 thenable that resolves to the selected item or undefined when being dismissed.

showWarningMessage

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

    see

    showInformationMessage

    Type parameters

    • T: string

    Parameters

    • message: string

      The message to show.

    • Rest ...items: T[]

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

    Returns Thenable<T | undefined>

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

  • Show a warning message.

    see

    showInformationMessage

    Type parameters

    • T: string

    Parameters

    • message: string

      The 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 thenable that resolves to the selected item or undefined when being dismissed.

  • Show a warning message.

    see

    showInformationMessage

    Type parameters

    Parameters

    • message: string

      The message to show.

    • Rest ...items: T[]

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

    Returns Thenable<T | undefined>

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

  • Show a warning message.

    see

    showInformationMessage

    Type parameters

    Parameters

    • message: string

      The 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 thenable that resolves to the selected item or undefined when being dismissed.

showErrorMessage

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

    see

    showInformationMessage

    Type parameters

    • T: string

    Parameters

    • message: string

      The message to show.

    • Rest ...items: T[]

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

    Returns Thenable<T | undefined>

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

  • Show an error message.

    see

    showInformationMessage

    Type parameters

    • T: string

    Parameters

    • message: string

      The 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 thenable that resolves to the selected item or undefined when being dismissed.

  • Show an error message.

    see

    showInformationMessage

    Type parameters

    Parameters

    • message: string

      The message to show.

    • Rest ...items: T[]

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

    Returns Thenable<T | undefined>

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

  • Show an error message.

    see

    showInformationMessage

    Type parameters

    Parameters

    • message: string

      The 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 thenable that resolves to the selected item or undefined when being dismissed.

showQuickPick

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

    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.

    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.

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

showWorkspaceFolderPick

showOpenDialog

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

    Parameters

    Returns Thenable<Uri[] | undefined>

    A promise that resolves to the selected resources or undefined.

showSaveDialog

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

    Parameters

    Returns Thenable<Uri | undefined>

    A promise that resolves to the selected resource or undefined.

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 Thenable<string | undefined>

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

createQuickPick

createInputBox

createOutputChannel

  • createOutputChannel(name: string, languageId?: string): OutputChannel
  • createOutputChannel(name: string, options: { log: true }): LogOutputChannel
  • Creates a new output channel with the given name and language id If language id is not provided, then Log is used as default language id.

    You can access the visible or active output channel as a text document from visible editors or active editor and use the language id to contribute language features like syntax coloring, code lens etc.,

    Parameters

    • name: string

      Human-readable string which will be used to represent the channel in the UI.

    • Optional languageId: string

      The identifier of the language associated with the channel.

    Returns OutputChannel

  • Creates a new log output channel with the given name.

    Parameters

    • name: string

      Human-readable string which will be used to represent the channel in the UI.

    • options: { log: true }

      Options for the log output channel.

      • log: true

    Returns LogOutputChannel

createWebviewPanel

  • Create and show a new webview panel.

    Parameters

    • viewType: string

      Identifies the type of the webview panel.

    • title: string

      Title of the panel.

    • showOptions: ViewColumn | { viewColumn: ViewColumn; preserveFocus?: boolean }

      Where to show the webview in the editor. If preserveFocus is set, the new webview will not take focus.

    • Optional options: WebviewPanelOptions & WebviewOptions

      Settings for the new panel.

    Returns WebviewPanel

    New webview panel.

setStatusBarMessage

  • setStatusBarMessage(text: string, hideAfterTimeout: number): Disposable
  • setStatusBarMessage(text: string, hideWhenDone: Thenable<any>): Disposable
  • setStatusBarMessage(text: string): Disposable
  • Set a message to the status bar. This is a short hand for the more powerful status bar items.

    Parameters

    • text: string

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

    • 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. This is a short hand for the more powerful status bar items.

    Parameters

    • text: string

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

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

  • Set a message to the status bar. This is a short hand for the more powerful status bar items.

    Note that status bar messages stack and that they must be disposed when no longer used.

    Parameters

    • text: string

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

    Returns Disposable

    A disposable which hides the status bar message.

withScmProgress

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

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<{ message?: string; increment?: number }>, 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.

createStatusBarItem

  • Creates a status bar item.

    Parameters

    • Optional alignment: StatusBarAlignment

      The alignment of the item.

    • Optional priority: number

      The priority of the item. Higher values mean the item should be shown more to the left.

    Returns StatusBarItem

    A new status bar item.

  • Creates a status bar item.

    Parameters

    • id: string

      The unique identifier of the item.

    • Optional alignment: StatusBarAlignment

      The alignment of the item.

    • Optional priority: number

      The priority of the item. Higher values mean the item should be shown more to the left.

    Returns StatusBarItem

    A new status bar item.

createTerminal

  • Creates a Terminal with a backing shell process. The cwd of the terminal will be the workspace directory if it exists.

    throws

    When running in an environment where a new process cannot be started.

    Parameters

    • Optional name: string

      Optional human-readable string which will be used to represent the terminal in the UI.

    • Optional shellPath: string

      Optional path to a custom shell executable to be used in the terminal.

    • Optional shellArgs: readonly string[] | string

      Optional args for the custom shell executable. A string can be used on Windows only which allows specifying shell args in command-line format.

    Returns Terminal

    A new Terminal.

  • Creates a Terminal with a backing shell process.

    throws

    When running in an environment where a new process cannot be started.

    Parameters

    • options: TerminalOptions

      A TerminalOptions object describing the characteristics of the new terminal.

    Returns Terminal

    A new Terminal.

  • Creates a Terminal where an extension controls its input and output.

    Parameters

    Returns Terminal

    A new Terminal.

registerTreeDataProvider

createTreeView

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 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: UriHandler

      The uri handler to register for this extension.

    Returns Disposable

registerWebviewPanelSerializer

  • 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

    • viewType: string

      Type of the webview panel that can be serialized.

    • serializer: WebviewPanelSerializer

      Webview serializer.

    Returns Disposable

registerWebviewViewProvider

  • registerWebviewViewProvider(viewId: string, provider: WebviewViewProvider, options?: { webviewOptions?: { retainContextWhenHidden?: boolean } }): Disposable
  • Register a new provider for webview views.

    Parameters

    • viewId: string

      Unique id of the view. This should match the id from the views contribution in the package.json.

    • provider: WebviewViewProvider

      Provider for the webview views.

    • 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

    Disposable that unregisters the provider.

registerCustomEditorProvider

  • 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 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: { webviewOptions?: WebviewPanelOptions; supportsMultipleEditorsPerDocument?: boolean }

      Options for the provider.

      • Optional Readonly webviewOptions?: WebviewPanelOptions

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

      • 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, the editor 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.

    Returns Disposable

    Disposable that unregisters the provider.

registerTerminalLinkProvider

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

    Parameters

    Returns Disposable

    Disposable that unregisters the provider.

registerTerminalProfileProvider

registerFileDecorationProvider

Const onDidChangeActiveColorTheme

Generated by TypeDoc. Maintained by 洛竹