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.
matchOnDescription
instance-attribute
¶
Controls if the description of items should be matched
matchOnDetail
instance-attribute
¶
Controls if the detail of items should be matched
ignoreFocusOut
instance-attribute
¶
Set to true to keep the picker open when focus moves to another part of the editor or to another window
InputBoxOptions
¶
Bases: TypedDict
Options to configure the behavior of the input box UI.
valueSelection
instance-attribute
¶
Selection range of the prefilled value (start, end)
password
instance-attribute
¶
Set to true to show a password input that hides the typed text
ignoreFocusOut
instance-attribute
¶
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.
SaveDialogOptions
¶
Bases: TypedDict
Options to configure the behavior of a file save dialog.
filters
instance-attribute
¶
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
¶
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
¶
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
¶
An optional flag that when true will stop the editor from taking focus
preview
instance-attribute
¶
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
¶
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.
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
¶
RangeDict
¶
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
¶
TextDocumentEdit
¶
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
¶
Text edits grouped by document