Skip to main content

Create VSCode Extensions with python

Project description

Original project: https://github.com/CodeWithSwastik/vscode.py

I'm reviving this project.

About

Create vscode extensions with python.

Installation

Stable version:

pip install vscode.py2

Why use vscode.py?

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

  • vscode.py 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.py provides a pythonic way of creating the extension. Python has some powerful modules that Javascript doesn't and you can include these with vscode.py
  • vscode.py 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.py

Here's a list of some extensions built using vscode.py. 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.py 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_py2-2.0.5.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vscode.py2-2.0.5-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file vscode_py2-2.0.5.tar.gz.

File metadata

  • Download URL: vscode_py2-2.0.5.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for vscode_py2-2.0.5.tar.gz
Algorithm Hash digest
SHA256 2e4fc202ed66aa245376918c775730d7f09db650278f1112c6f8653ce65353df
MD5 0f8966f3a50b295ca3c49e67fb8e6464
BLAKE2b-256 92010981e8042899979203e13fe8c26dcae7dd73246c51a51df807f23238b741

See more details on using hashes here.

File details

Details for the file vscode.py2-2.0.5-py3-none-any.whl.

File metadata

  • Download URL: vscode.py2-2.0.5-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for vscode.py2-2.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1ae84ed413b7bf1153b375d6f8f1e3ec3540a9e962a0ed7015efcf6afb8ccb15
MD5 22ae43f98b7237d52b8c4e25d3a41146
BLAKE2b-256 cc4d9d722ddb4473c4542c2a50d29dd02fc63b3e9513c1995615f1bf97a75176

See more details on using hashes here.

Supported by

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