Skip to main content

Create VSCode Extensions with python

Project description

vscode-ext

This package allows you to create vscode extensions with python.

Installation

Stable version:

pip install vscode-ext

Working version:

pip install git+https://github.com/CodeWithSwastik/vscode-ext

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

image

Step 3:

Run the python file. It will build the 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

image

  • Type >Hello World

image

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

image

Example Extension

import vscode

ext = vscode.Extension(name = "testpy", display_name = "Test Py", version = "0.0.1")

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

@ext.command()
def hello_world():
    vscode.window.show_info_message(f'Hello World from {ext.name}')

@ext.command()
def ask_question():
    res = vscode.window.show_info_message('How are you?', 'Great', 'Meh')
    if res == "Great":
        vscode.window.show_info_message('Woah nice!!')
    elif res == "Meh":
        vscode.window.show_info_message('Sorry to hear that :(')
vscode.build(ext)

Documentation

Coming soon!

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-ext-1.1.8.tar.gz (6.2 kB view details)

Uploaded Source

File details

Details for the file vscode-ext-1.1.8.tar.gz.

File metadata

  • Download URL: vscode-ext-1.1.8.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.10.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.8.5

File hashes

Hashes for vscode-ext-1.1.8.tar.gz
Algorithm Hash digest
SHA256 c87233b6abaa3b2d09a4c24d90d9773b607abeab0a8ef4195fde66799f0d4283
MD5 026e05528624f19de49e20f57c79e1b1
BLAKE2b-256 3e3f45f8ee50ae7c776b442318016a41ca49e08735cb4018b4999d173a8df14a

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