DEV Community


VS Code Extensions / Shortcuts for Python / Web

dev0928 profile image dev0928 ・2 min read

I use Visual Studio Code editor by Microsoft for Python development. I find below shortcuts and extensions particularly very useful during application development. Hope you find them useful as well!

Python extension for Visual Studio Code by Microsoft

With over 20 million installs, this is one of the most popular extensions for Python development in VS Code. Some of the commonly used editor options are:

  • Go to Definition (F12) jumps from the current code into the code that defines an object. This command is especially useful when working with libraries and want to learn more about them.
  • Peek Definition (Alt+F12), is similar, but displays the definition directly in the editor.
  • To run a specific section of code in Python, highlight the section and press shift + Enter. This runs just the highlighted portion of code from the Python file.
  • To enable brackets completion and linting - Press ctrl + shift + p and type settings.json to get the settings file. In settings.json file, add below:
    "python.linting.enabled": true,
    "python.autoComplete.addBrackets": true,
  • To get a printable reference of all shortcuts in VS Code: Press ctrl + shift + p and type Keyboard Shortcuts Reference in the search box. This will take you to the shortcuts link containing nice printable version of shortcuts in a pdf format.
  • Please note default keyboard shortcuts could be changed using Code > Preferences option.

Visual Studio IntelliCode by Microsoft

This is again another popular extension that helps with code completion. Pausing or pressing ctrl + space after module name activates and displays list of code completion options.

Better Jinja by Samuel Colvin

Jinja code added in the html template usually looks unformatted. To add colorization effect, install Better Jinja by Samuel Colvin. Then add below association in settings.json file

    "files.associations": {
       "*.html": "jinja-html"

Flask snippets by cstrap

Flask snippets by cstrap provides shortcuts for generating commonly used snippets in Flask and Jinja. Once extension is installed, typing hw in the editor generates below snippet:

from flask import Flask
app = Flask(__name__)

def hello():
    return 'Hello World!'

if __name__ == '__main__':

Python DocString Generator by Nils Werner

This Python DocString Generator extension provides a consistent way to provide documentation to Python functions and modules.


Discussion (0)

Forem Open with the Forem app