talira

Django extension for Visual Studio Code

Beautiful syntax and scoped snippets for perfectionists with deadlines

open sourceMITfree

A VS Code extension for Django projects. Templates stay ordinary HTML files with the Django template syntax highlighted on top (tags, variables, filters and comments, even inside attributes, styles and scripts), so VS Code's HTML features and other HTML extensions keep working. In templates it adds go to definition and find references for template paths, blocks and custom tags (including django-cotton components), links from Django's tags and filters to the documentation for the project's Django version, snippets for templates and for each kind of Python file (models, views, forms, admin, URLs, migrations), and formatting through the tool the project already uses (djLint, djangofmt, djade or DjHTML). MIT licensed.

Problems it solves

  • Django template syntax highlighting in VS Code without losing HTML features
  • jump from an extends or include tag to the template file in my editor
  • snippets for Django models, views and forms
  • format Django templates in my editor the same way as my pre-commit hooks

Features

  • Django template syntax highlighting inside regular HTML files
  • go to definition for template paths, custom tags and template libraries
  • find references for custom tags, blocks and template paths
  • links from built-in tags and filters to the Django docs for the project's version
  • template and per-file Python snippets
  • formatting with djLint, djangofmt, djade or DjHTML
  • django-cotton component navigation

Limitations

  • Formatting runs a local tool, so it isn't available in VS Code for the Web
  • Open VSX carries an older version (1.8.0 from 29 Nov 2021) than the repository's 2.1 release

Alternatives

The same job

These do what Django extension for Visual Studio Code does.

  1. Jinja for Visual Studio Code Syntax highlighting and snippets for the Jinja template language in VS Code
  2. CSS Peek Peek at, jump to and hover over the CSS, SCSS and Less rules for a class or id in VS Code
  3. Better Comments Color-coded alerts, queries, TODOs and highlights in your code comments in VS Code
  4. Error Lens Shows errors and warnings inline at the end of the line in VS Code, with the whole line highlighted

Compare Django extension for Visual Studio Code with the top 3