Extension

class vscode.extension.Extension(name: str, *, metadata: ExtensionMetadata | None = None, config: List[Config] | None = None)

Bases: object

Represents a vscode extension.

command(name: str | None = None, title: str | None = None, category: str | None = None, keybind: str | None = None, when: str | None = None)

A decorator for registering commands.

Parameters:
  • name – The internal name of the command.

  • title – The title of the command. This is shown in the command palette.

  • category – The category that this command belongs to. Default categories set by Extensions will be overriden if this is not None. False should be passed in order to override a default category.

  • keybind – The keybind for this command.

  • when – A condition for when keybinds should be functional.

event(func: Callable)

A decorator for registering event handlers.

async parse_ws_data(data: dict)
register_command(func: Callable[[...], Any], name: str | None = None, title: str | None = None, category: str | None = None, keybind: str | None = None, when: str | None = None) None

Register a command. This is usually not called, instead the command() shortcut decorators should be used instead.

Parameters:
  • func – The function to register as a command.

  • name – The internal name of the command.

  • title – The title of the command. This is shown in the command palette.

  • category – The category that this command belongs to. Default categories set by Extensions will be overriden if this is not None. False should be passed in order to override a default category.

  • keybind – The keybind for this command.

  • when – A condition for when keybinds should be functional.

register_keybind(command: Command) None

A method called internally to register a keybind.

run()
set_default_category(category) None

Set a default category for new commands. :param category: The name of the default category.