Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #50 from TrueMyst/main
Browse files Browse the repository at this point in the history
Change Documentation from mkdocs to sphinx
  • Loading branch information
CodeWithSwastik authored Jan 13, 2024
2 parents 53cde84 + 524df23 commit 2c22678
Show file tree
Hide file tree
Showing 35 changed files with 401 additions and 217 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/venv
/dist
/build
/docs/_build
/media
/.vscode
/node_modules
Expand Down
29 changes: 22 additions & 7 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
version: 2
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2.0.0

# Formats to be built
formats:
- epbub
- pdf

# Install requirements.txt using pip
python:
install:
- method: pip
- requirements: docs/requirements.txt

# Set the OS, Python version
build:
os: ubuntu-22.04
tools:
python: "3.10"

mkdocs:
configuration: mkdocs.yml
fail_on_warning: false

python:
install:
- requirements: docs/requirements.txt
# Build documentation in the "docs/" directory with Sphinx
sphinx:
builder: html
configuration: docs/conf.py
fail_on_warning: true
File renamed without changes.
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
41 changes: 41 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

import os
import sys

sys.path.insert(0, os.path.abspath(".."))

project = 'vscode.py'
copyright = '2024, CodeWithSwastik'
author = 'CodeWithSwastik'
release = '2.0.0'

source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown'
}

source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'}
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'myst_parser']

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

html_logo = "../images/vscode-ext.png"
html_title = f"{project} {release}"
html_theme = 'furo'
html_favicon = "../images/vscode-ext.png"
html_static_path = ['_static']

56 changes: 0 additions & 56 deletions docs/creating-your-extension.md

This file was deleted.

7 changes: 0 additions & 7 deletions docs/documentation/commands.md

This file was deleted.

26 changes: 0 additions & 26 deletions docs/documentation/config.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/documentation/enums.md

This file was deleted.

3 changes: 0 additions & 3 deletions docs/documentation/extension.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/documentation/objects.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/documentation/window.md

This file was deleted.

24 changes: 0 additions & 24 deletions docs/getting-started.md

This file was deleted.

58 changes: 58 additions & 0 deletions docs/handbook/creating_extension.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Creating your first extension
=============================

Getting Started
----------------

Create a folder and place a Python file inside it.

.. image:: https://user-images.githubusercontent.com/61446939/126891766-8e408f35-ce63-48b1-8739-1361e979d351.png


Write Extension Code
---------------------

.. code-block:: 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()
Run the Python File
--------------------

Execute the Python file. This action will build the necessary 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

Run the Extension
------------------

Press F5. This will initiate the extension and open a new VSCode window in development mode.

Test Your Command
------------------

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

.. image:: https://user-images.githubusercontent.com/61446939/126892044-f3b5f4d3-37de-4db5-acef-c6ddd841f1a5.png

- Type ``>Hello World`` in the command palette.

.. image:: https://user-images.githubusercontent.com/61446939/126892096-9fc1cb2f-9b76-4d53-8099-e74d9f22e6e7.png

- The popup message should appear in the bottom right corner.

.. image:: https://user-images.githubusercontent.com/61446939/126892110-f8d4bcf2-9ec0-43c2-a7d6-40288d91f000.png
9 changes: 9 additions & 0 deletions docs/handbook/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Getting Started
===============

.. toctree::
:maxdepth: 2

installation
creating_extension
publishing_extension
38 changes: 38 additions & 0 deletions docs/handbook/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Installation
=============
You may use pip or a similar tool to install latest version of **vscode.py** from the PyPi.

Install with pip
-----------------
.. warning::

This module requires Python 3.6 or above to work properly.

The latest stable release of **vscode.py** can be installed with pip

.. code-block::
# Linux/macOS
python3 -m pip install vscode.py
# Windows
py -3 -m pip install vscode.py
However if you want the latest working version from github you can do that as well

.. code-block::
# Linux/macOS
python3 -m pip git+https://github.com/codewithswastik/vscode.py.git
# Windows
py -3 -m pip install git+https://github.com/codewithswastik/vscode.py.git
Install with git
-----------------
**vscode.py** can be directly used from GitHub by cloning the repository which might be useful if you want to use the working version

.. code-block::
git clone https://github.com/codewithswastik/vscode.py.git
15 changes: 15 additions & 0 deletions docs/handbook/publishing_extension.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Publishing Extensions
=====================

To publish your extension created with ``vscode.py``, execute your extension file with the ``--publish`` flag:

.. code-block:: bash
python extension.py --publish
This command will generate the ``README.md`` and ``CHANGELOG.md`` for your extension. Keeping these files updated is important. Additionally, it will create the `.vscodeignore` file. The contents specified in this file will be excluded from packaging in your extension.

Afterward, follow the steps outlined in the `official documentation for publishing extensions`_.


.. _official documentation for publishing extensions: https://code.visualstudio.com/api/working-with-extensions/publishing-extension
22 changes: 0 additions & 22 deletions docs/index.md

This file was deleted.

Loading

0 comments on commit 2c22678

Please sign in to comment.