From 161e21fe0f6344ec3b9b9b541e9b2c472087ba77 Mon Sep 17 00:00:00 2001 From: Ben Sycha Date: Tue, 20 Jul 2021 17:39:01 +0100 Subject: [PATCH] Apply suggestions from code review to fix RST formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gina Häußge --- docs/development/environment.rst | 117 ++++++++++++++++--------------- 1 file changed, 60 insertions(+), 57 deletions(-) diff --git a/docs/development/environment.rst b/docs/development/environment.rst index b6e56e1d7..47379244c 100644 --- a/docs/development/environment.rst +++ b/docs/development/environment.rst @@ -390,96 +390,99 @@ Otherwise go through Settings. Visual Studio Code (vscode) --------------------------- - - Install Visual Studio Code from https://code.visualstudio.com/Download + + - Install Visual Studio Code from `code.visualstudio.com `_ - Open folder select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``) - - Create a directory '.vscode' if not already present in the root of the project + - Create a directory ``.vscode`` if not already present in the root of the project - - Create the following files inside the .vscode directory + - Create the following files inside the ``.vscode`` directory settings.json .. code-block:: json - { - "python.defaultInterpreterPath": "venv3/bin/python", - "python.formatting.provider": "black", - "python.formatting.blackArgs": [ - "--config", - "black.toml" - ], - "editor.formatOnSave": true, - "python.sortImports.args": [ - "--profile=black", - ], - "[python]": { - "editor.codeActionsOnSave": { - "source.organizeImports": true - } - }, - "python.linting.pylintEnabled": false, - "python.linting.flake8Enabled": true, - "python.linting.enabled": true - } + { + "python.defaultInterpreterPath": "venv3/bin/python", + "python.formatting.provider": "black", + "python.formatting.blackArgs": [ + "--config", + "black.toml" + ], + "editor.formatOnSave": true, + "python.sortImports.args": [ + "--profile=black", + ], + "[python]": { + "editor.codeActionsOnSave": { + "source.organizeImports": true + } + }, + "python.linting.pylintEnabled": false, + "python.linting.flake8Enabled": true, + "python.linting.enabled": true + } tasks.json .. code-block:: json - { - "version": "2.0.0", - "tasks": [ - { - "label": "clean build artifacts", - "type": "shell", - "command": "python ./setup.py clean" - }, - { - "label": "build docs", - "type": "shell", - "command": "sphinx-build -b html ./docs ./docs/_build" - } - ] - } + { + "version": "2.0.0", + "tasks": [ + { + "label": "clean build artifacts", + "type": "shell", + "command": "python ./setup.py clean" + }, + { + "label": "build docs", + "type": "shell", + "command": "sphinx-build -b html ./docs ./docs/_build" + } + ] + } launch.json .. code-block:: json - { - "version": "0.2.0", - "configurations": [ - { - "name": "OctoPrint", - "type": "python", - "request": "launch", - "module": "octoprint", - "args": [ - "serve", - "--debug" - ], - "cwd": "${workspaceFolder}/src", - "preLaunchTask": "clean build artifacts" - } - ] - } + { + "version": "0.2.0", + "configurations": [ + { + "name": "OctoPrint", + "type": "python", + "request": "launch", + "module": "octoprint", + "args": [ + "serve", + "--debug" + ], + "cwd": "${workspaceFolder}/src", + "preLaunchTask": "clean build artifacts" + } + ] + } In the terminal install the python extension by running this command: + .. code-block:: bash code --install-extension ms-python.python In vscode terminal, or with venv active install code formatter black and linter flake8 by running: + .. code-block:: bash python -m pip install -U black flake8 flake8-bugbear Summary of vscode config: - * Pressing f5 will now start OctoPrint in debug + * Pressing ``F5`` will now start OctoPrint in debug mode * Your terminal inside vscode uses the virtual python environment * Saving a file will run an auto formatter and import sort - * Ctrl + shift + b can be used to run the 'build docs' task to rebuild the documentation + * ``Ctrl+Shift+B`` can be used to run the ``build docs`` task to rebuild the documentation