Skip to main content

Create VSCode Extensions with python

Project description

vscode logo

Maintenance Downloads PyPI version Code style: black

About

Create vscode extensions with python.

Installation

Stable version:

pip install vscode-ext

Why use this?

Why should you use this for building VScode extensions when you can use typescript? Here are some reasons:

  • vscode-ext builds the package.json for you! No need to switch between your extension.py and package.json in order to add commands. It also handles adding Activity Bars, Keybinds and Views.
  • vscode-ext provides a more pythonic way of creating the extension. Python also has some powerful modules that Javascript doesn't and you can include these with vscode-ext
  • vscode-ext extensions work perfectly with vsce and you can publish your extensions just like you would publish any other extension.

Example Extension

import vscode
from vscode import InfoMessage

ext = vscode.Extension(name="Test Extension")

@ext.event
async def on_activate():
    vscode.log(f"The Extension '{ext.name}' has started")


@ext.command()
async def hello_world(ctx):
    return await ctx.show(InfoMessage(f"Hello World from {ext.name}"))

ext.run()

Tutorial

Step 1

Create a python file inside a folder.

image

Step 2

Write the code for your extension. For this tutorial we have used the Example Extension

Step 3

Run the python file. It will build the required extension files.

image image

Step 4

Press F5. This will run the extension and open a new vscode window in development mode.

Step 5

Finally, test your command.

  • Open the command palette with Ctrl+P in the development window.

image

  • Type >Hello World

image

  • It should show a popup like this in the bottom right corner

image

Extensions built using vscode-ext

Here's a list of some extensions built using vscode-ext. If you'd like to include your extension here feel free to create a PR.

Documentation

The docs are coming soon! In the meantime you can look at the examples in order to learn how vscode-ext works and what it offers!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vscode.py-2.0.0a5.tar.gz (18.5 kB view details)

Uploaded Source

File details

Details for the file vscode.py-2.0.0a5.tar.gz.

File metadata

  • Download URL: vscode.py-2.0.0a5.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for vscode.py-2.0.0a5.tar.gz
Algorithm Hash digest
SHA256 48d2c740b918ded3afe4a95705b2c533fa5c6f6484eb1e666b8bf77f191b63e9
MD5 e9461d0d4af9dd5a28ee3bba9f5d7c2e
BLAKE2b-256 837806f8f88f8b7ac89d9656fcdcad5ccb15f61e46ad800c7e36c3ea62f1f150

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page