https://github.com/codewithswastik/vscode.py
Create VSCode Extensions with python
https://github.com/codewithswastik/vscode.py
python python-library vscode
Last synced: 11 months ago
JSON representation
Create VSCode Extensions with python
- Host: GitHub
- URL: https://github.com/codewithswastik/vscode.py
- Owner: CodeWithSwastik
- License: mit
- Created: 2021-07-25T06:54:14.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-26T12:19:08.000Z (almost 2 years ago)
- Last Synced: 2024-04-10T10:24:01.155Z (almost 2 years ago)
- Topics: python, python-library, vscode
- Language: Python
- Homepage: https://vscodepy.readthedocs.io/
- Size: 1000 KB
- Stars: 171
- Watchers: 4
- Forks: 27
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
## About
Create vscode extensions with python.
> [!NOTE]
> This repository is being archived due to a lack of time for regular maintenance. If you are interested in taking over the maintenance of this project, please feel free to contact me at cwswastik2005@gmail.com. Thank you for your support!
## Installation
Stable version:
```sh-session
pip install vscode.py
```
## 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
```python
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.

### Step 2
Write the code for your extension. For this tutorial we have used the [Example Extension](#example-extension)
### Step 3
Run the python file. It will build the required extension files.


### 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.

- Type `>Hello World`

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

## 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.
- [Youtube](https://github.com/CodeWithSwastik/youtube-ext)
- [Wikipedia](https://github.com/SkullCrusher0003/wikipedia-ext)
- [Internet Search](https://github.com/Dorukyum/internet-search)
- [Virtual Assistant](https://github.com/SohamGhugare/vscode-virtual-assistant)
- [YoExtension](https://github.com/yo56789/YoExtension)
## Documentation
The docs are coming soon! In the meantime you can look at the [examples](https://github.com/CodeWithSwastik/vscode.py/tree/main/examples) in order to learn how vscode.py works and what it offers!