<p align="center">
<img alt="vscode logo" src="https://github.com/CodeWithSwastik/vscode-ext/blob/main/images/vscode-ext-2.png?raw=true" width='500px'/>
</p>
<p align="center"><a href="https://GitHub.com/CodeWithSwastik/vscode-ext/graphs/commit-activity"><img src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" alt="Maintenance"></a>
<a href="https://pepy.tech/project/vscode-ext"><img src="https://static.pepy.tech/personalized-badge/vscode-ext?period=total&units=international_system&left_color=orange&right_color=brightgreen&left_text=Downloads" alt="Downloads"></a>
<a href="https://pypi.python.org/pypi/vscode-ext/"><img src="https://badge.fury.io/py/vscode-ext.svg" alt="PyPI version"></a>
<a href="https://GitHub.com/CodeWithSwastik/vscode-ext/stargazers/"><img src="https://img.shields.io/github/stars/CodeWithSwastik/vscode-ext.svg?style=social&label=Star&maxAge=2592000" alt="GitHub stars"></a>
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
## About
Create vscode extensions and color themes with python.
## Installation
Stable version:
```sh-session
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
```python
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(keybind="ALT+5")
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)
```
## Tutorial
### Step 1
Create a python file inside a folder.
![image](https://user-images.githubusercontent.com/61446939/126891766-8e408f35-ce63-48b1-8739-1361e979d351.png)
### Step 2
Write the code for your extension. For this tutorial we have used the [Example Extension](#example-extension)
![image](https://user-images.githubusercontent.com/61446939/126891803-8da2e8e8-174f-451b-9103-4fbf001c4e7b.png)
### Step 3
Run the python file. It will build the files.
![image](https://user-images.githubusercontent.com/61446939/126891865-fe235598-9267-47c6-971f-43e4da456ebb.png)
![image](https://user-images.githubusercontent.com/61446939/126891875-62c2057e-e504-4e01-bfd6-9a20c7f660d9.png)
### 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](https://user-images.githubusercontent.com/61446939/126892044-f3b5f4d3-37de-4db5-acef-c6ddd841f1a5.png)
- Type `>Hello World`
![image](https://user-images.githubusercontent.com/61446939/126892096-9fc1cb2f-9b76-4d53-8099-e74d9f22e6e7.png)
- It should show a popup like this in the bottom right corner
![image](https://user-images.githubusercontent.com/61446939/126892110-f8d4bcf2-9ec0-43c2-a7d6-40288d91f000.png)
## Color Theme Example
```python
import vscode
theme = vscode.ColorTheme(name='my-theme', display_name='My Theme', version='0.0.1')
theme.set_colors(
background='#12171F',
foreground='#EFEFEF',
accent_colors=['#399EF4', '#DA6771', '#4EB071', '#FFF099']
)
vscode.build_theme(theme)
```
## 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.
- [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)
## Documentation
The docs are coming soon! In the meantime you can look at the [examples](https://github.com/CodeWithSwastik/vscode-ext/tree/main/examples) in order to learn how vscode-ext works and what it offers!
Raw data
{
"_id": null,
"home_page": "https://github.com/CodeWithSwastik/vscode-ext",
"name": "vscode-ext",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Swas.py",
"author_email": "cwswas.py@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ea/e4/a10252c0d9678229b32844d3bf93c6052efc59341241dd63018672e52bbc/vscode-ext-1.5.4.tar.gz",
"platform": "",
"description": "<p align=\"center\">\n <img alt=\"vscode logo\" src=\"https://github.com/CodeWithSwastik/vscode-ext/blob/main/images/vscode-ext-2.png?raw=true\" width='500px'/>\n</p>\n\n<p align=\"center\"><a href=\"https://GitHub.com/CodeWithSwastik/vscode-ext/graphs/commit-activity\"><img src=\"https://img.shields.io/badge/Maintained%3F-yes-green.svg\" alt=\"Maintenance\"></a>\n<a href=\"https://pepy.tech/project/vscode-ext\"><img src=\"https://static.pepy.tech/personalized-badge/vscode-ext?period=total&units=international_system&left_color=orange&right_color=brightgreen&left_text=Downloads\" alt=\"Downloads\"></a>\n<a href=\"https://pypi.python.org/pypi/vscode-ext/\"><img src=\"https://badge.fury.io/py/vscode-ext.svg\" alt=\"PyPI version\"></a>\n<a href=\"https://GitHub.com/CodeWithSwastik/vscode-ext/stargazers/\"><img src=\"https://img.shields.io/github/stars/CodeWithSwastik/vscode-ext.svg?style=social&label=Star&maxAge=2592000\" alt=\"GitHub stars\"></a>\n<a href=\"https://github.com/psf/black\"><img alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"></a>\n\n## About\n\nCreate vscode extensions and color themes with python.\n\n## Installation\n\nStable version:\n\n```sh-session\npip install vscode-ext\n```\n\n## Why use this?\n\nWhy should you use this for building VScode extensions when you can use typescript? Here are some reasons:\n\n- 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.\n- 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\n- vscode-ext extensions work perfectly with vsce and you can publish your extensions just like you would publish any other extension.\n\n## Example Extension\n\n```python\nimport vscode\n\next = vscode.Extension(name = \"testpy\", display_name = \"Test Py\", version = \"0.0.1\")\n\n@ext.event\ndef on_activate():\n return f\"The Extension '{ext.name}' has started\"\n\n@ext.command()\ndef hello_world():\n vscode.window.show_info_message(f'Hello World from {ext.name}')\n\n@ext.command(keybind=\"ALT+5\")\ndef ask_question():\n res = vscode.window.show_info_message('How are you?', 'Great', 'Meh')\n if res == \"Great\":\n vscode.window.show_info_message('Woah nice!!')\n elif res == \"Meh\":\n vscode.window.show_info_message('Sorry to hear that :(')\n\nvscode.build(ext)\n```\n\n## Tutorial\n\n### Step 1\n\nCreate a python file inside a folder.\n\n![image](https://user-images.githubusercontent.com/61446939/126891766-8e408f35-ce63-48b1-8739-1361e979d351.png)\n\n### Step 2\n\nWrite the code for your extension. For this tutorial we have used the [Example Extension](#example-extension)\n\n![image](https://user-images.githubusercontent.com/61446939/126891803-8da2e8e8-174f-451b-9103-4fbf001c4e7b.png)\n\n### Step 3\n\nRun the python file. It will build the files.\n\n![image](https://user-images.githubusercontent.com/61446939/126891865-fe235598-9267-47c6-971f-43e4da456ebb.png)\n![image](https://user-images.githubusercontent.com/61446939/126891875-62c2057e-e504-4e01-bfd6-9a20c7f660d9.png)\n\n### Step 4\n\nPress F5. This will run the extension and open a new vscode window in development mode.\n\n### Step 5\n\nFinally, test your command.\n\n- Open the command palette with Ctrl+P in the development window.\n\n![image](https://user-images.githubusercontent.com/61446939/126892044-f3b5f4d3-37de-4db5-acef-c6ddd841f1a5.png)\n\n- Type `>Hello World`\n\n![image](https://user-images.githubusercontent.com/61446939/126892096-9fc1cb2f-9b76-4d53-8099-e74d9f22e6e7.png)\n\n- It should show a popup like this in the bottom right corner\n\n![image](https://user-images.githubusercontent.com/61446939/126892110-f8d4bcf2-9ec0-43c2-a7d6-40288d91f000.png)\n \n## Color Theme Example\n\n```python\nimport vscode\n\ntheme = vscode.ColorTheme(name='my-theme', display_name='My Theme', version='0.0.1')\ntheme.set_colors(\n background='#12171F',\n foreground='#EFEFEF',\n accent_colors=['#399EF4', '#DA6771', '#4EB071', '#FFF099']\n)\nvscode.build_theme(theme)\n```\n \n## Extensions built using vscode-ext\n\nHere'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.\n\n- [Youtube](https://github.com/CodeWithSwastik/youtube-ext)\n- [Wikipedia](https://github.com/SkullCrusher0003/wikipedia-ext)\n- [Internet Search](https://github.com/Dorukyum/internet-search)\n- [Virtual Assistant](https://github.com/SohamGhugare/vscode-virtual-assistant)\n\n## Documentation\n\nThe docs are coming soon! In the meantime you can look at the [examples](https://github.com/CodeWithSwastik/vscode-ext/tree/main/examples) in order to learn how vscode-ext works and what it offers!",
"bugtrack_url": null,
"license": "",
"summary": "Create VSCode Extensions with python",
"version": "1.5.4",
"project_urls": {
"Homepage": "https://github.com/CodeWithSwastik/vscode-ext",
"Issue tracker": "https://github.com/CodeWithSwastik/vscode-ext/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eae4a10252c0d9678229b32844d3bf93c6052efc59341241dd63018672e52bbc",
"md5": "30a29212ddd11ffcee34bf2b2aa03177",
"sha256": "7381c24b441ee176f62a5110cd1d469f81e16d4df4b83dd70291897ad77bb04a"
},
"downloads": -1,
"filename": "vscode-ext-1.5.4.tar.gz",
"has_sig": false,
"md5_digest": "30a29212ddd11ffcee34bf2b2aa03177",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 29298,
"upload_time": "2021-08-03T06:45:48",
"upload_time_iso_8601": "2021-08-03T06:45:48.385637Z",
"url": "https://files.pythonhosted.org/packages/ea/e4/a10252c0d9678229b32844d3bf93c6052efc59341241dd63018672e52bbc/vscode-ext-1.5.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-08-03 06:45:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "CodeWithSwastik",
"github_project": "vscode-ext",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "websockets",
"specs": []
}
],
"lcname": "vscode-ext"
}