Skip to content

Type Definitions

TypedDict definitions for API structures, providing type-safe options for various operations.

Window Types

These types are used for window operations like dialogs and quick picks.

QuickPickOptions

Bases: TypedDict

Options to configure the behavior of the quick pick UI.

title instance-attribute

title: str

An optional title for the quick pick

matchOnDescription instance-attribute

matchOnDescription: bool

Controls if the description of items should be matched

matchOnDetail instance-attribute

matchOnDetail: bool

Controls if the detail of items should be matched

placeHolder instance-attribute

placeHolder: str

Placeholder text to show in the input box

ignoreFocusOut instance-attribute

ignoreFocusOut: bool

Set to true to keep the picker open when focus moves to another part of the editor or to another window

canPickMany instance-attribute

canPickMany: bool

Allow multiple selections

InputBoxOptions

Bases: TypedDict

Options to configure the behavior of the input box UI.

title instance-attribute

title: str

An optional title for the input box

value instance-attribute

value: str

The value to prefill in the input box

valueSelection instance-attribute

valueSelection: tuple[int, int]

Selection range of the prefilled value (start, end)

prompt instance-attribute

prompt: str

The text to display underneath the input box

placeHolder instance-attribute

placeHolder: str

Placeholder text in the input box

password instance-attribute

password: bool

Set to true to show a password input that hides the typed text

ignoreFocusOut instance-attribute

ignoreFocusOut: bool

Set to true to keep the input box open when focus moves to another part of the editor or to another window

OpenDialogOptions

Bases: TypedDict

Options to configure the behavior of a file open dialog.

Note: On Windows and Linux, a file dialog cannot be both a file selector and a folder selector, so if you set both canSelectFiles and canSelectFolders to True on these platforms, a folder selector will be shown.

defaultUri instance-attribute

defaultUri: str

The default URI to show when the dialog opens

openLabel instance-attribute

openLabel: str

A human-readable string for the open button

canSelectFiles instance-attribute

canSelectFiles: bool

Allow selecting files (default: True)

canSelectFolders instance-attribute

canSelectFolders: bool

Allow selecting folders (default: False)

canSelectMany instance-attribute

canSelectMany: bool

Allow multiple selections (default: False)

filters instance-attribute

filters: dict[str, list[str]]

File filters used by the dialog. Each entry is a human-readable label and an array of extensions. Example: {'Images': ['png', 'jpg'], 'TypeScript': ['ts', 'tsx']}

title instance-attribute

title: str

Dialog title

SaveDialogOptions

Bases: TypedDict

Options to configure the behavior of a file save dialog.

defaultUri instance-attribute

defaultUri: str

The resource the dialog shows when opened

saveLabel instance-attribute

saveLabel: str

A human-readable string for the save button

filters instance-attribute

filters: dict[str, list[str]]

File filters used by the dialog. Each entry is a human-readable label and an array of extensions. Example: {'Images': ['png', 'jpg'], 'TypeScript': ['ts', 'tsx']}

title instance-attribute

title: str

Dialog title. Note: This parameter might be ignored, as not all operating systems display a title on save dialogs (for example, macOS).

TextDocumentShowOptions

Bases: TypedDict

Options to configure the behavior of showing a TextDocument in an editor.

viewColumn instance-attribute

viewColumn: int

An optional view column in which the editor should be shown. The default is the active column. Columns that do not exist will be created as needed.

preserveFocus instance-attribute

preserveFocus: bool

An optional flag that when true will stop the editor from taking focus

preview instance-attribute

preview: bool

An optional flag that controls if an editor-tab will be replaced with the next editor or if it will be kept

selection instance-attribute

selection: dict

An optional selection to apply to the document. Should be a range dict with start and end positions.

WorkspaceFolderPickOptions

Bases: TypedDict

Options for showing the workspace folder picker.

This mirrors the small options bag accepted by VS Code for window.showWorkspaceFolderPick, currently supporting placeHolder and ignoreFocusOut.

placeHolder instance-attribute

placeHolder: str

Placeholder text shown in the picker

ignoreFocusOut instance-attribute

ignoreFocusOut: bool

Keep the picker open when focus moves out

WindowState

Bases: TypedDict

Represents the current window state returned by window.state.

Fields are optional because different VS Code versions/platforms may expose slightly different properties. Known fields: - focused: bool — whether the window is focused - active: bool — whether the window is active (platform-dependent)

Position and Range

Dictionary versions of Position and Range for type hints.

PositionDict

Bases: TypedDict

Dictionary representation of a position in a text document.

line instance-attribute

line: int

Line number (0-based)

character instance-attribute

character: int

Character offset on the line (0-based)

RangeDict

Bases: TypedDict

Dictionary representation of a range in a text document.

start instance-attribute

start: PositionDict

The start position of the range

end instance-attribute

end: PositionDict

The end position of the range

Decoration Types

Types for editor decorations and styling.

DecorationRenderOptions

Bases: ThemableDecorationRenderOptions

Options for rendering text editor decorations.

This mirrors VS Code's DecorationRenderOptions interface. All properties are optional.

Example

decoration_options: DecorationRenderOptions = { "backgroundColor": "rgba(255, 0, 0, 0.3)", "border": "1px solid red", "borderRadius": "3px", "isWholeLine": True, "overviewRulerLane": 2, # Center lane "light": { "backgroundColor": "rgba(255, 0, 0, 0.1)" }, "dark": { "backgroundColor": "rgba(255, 0, 0, 0.3)" } }

ThemableDecorationRenderOptions

Bases: TypedDict

Theme-specific rendering options for decorations.

ThemableDecorationAttachmentRenderOptions

Bases: TypedDict

Options for rendering decoration attachments (before/after content).

Workspace Edit Types

Types for batch file modifications.

TextEdit

Bases: TypedDict

Represents a single text edit operation.

range instance-attribute

range: RangeDict

The range to replace

newText instance-attribute

newText: str

The new text for the range

TextDocumentEdit

Bases: TypedDict

Represents edits to a single text document.

uri instance-attribute

uri: str

The URI of the document to edit

edits instance-attribute

edits: list[TextEdit]

The text edits to apply

WorkspaceEdit

Bases: TypedDict

Represents a workspace edit with changes to multiple files.

A workspace edit can contain text edits for documents and file operations (create, delete, rename). All changes are applied atomically.

documentChanges instance-attribute

documentChanges: list[TextDocumentEdit]

Text edits grouped by document

createFiles instance-attribute

createFiles: list[CreateFileOperation]

Files to create

deleteFiles instance-attribute

deleteFiles: list[DeleteFileOperation]

Files to delete

renameFiles instance-attribute

renameFiles: list[RenameFileOperation]

Files to rename

CreateFileOperation

Bases: TypedDict

Represents a file creation operation.

uri instance-attribute

uri: str

The URI of the file to create

options instance-attribute

options: dict

Additional options (overwrite, ignoreIfExists)

DeleteFileOperation

Bases: TypedDict

Represents a file deletion operation.

uri instance-attribute

uri: str

The URI of the file to delete

options instance-attribute

options: dict

Additional options (recursive, ignoreIfNotExists)

RenameFileOperation

Bases: TypedDict

Represents a file rename operation.

oldUri instance-attribute

oldUri: str

The old URI of the file

newUri instance-attribute

newUri: str

The new URI of the file

options instance-attribute

options: dict

Additional options (overwrite, ignoreIfExists)