Skip to content

joshuadavidthomas/django-language-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

695 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-language-server

PyPI PyPI - Python Version Django Version

A language server for the Django web framework.

Caution

This project is in early stages. All Most features are incomplete and missing.

Features

  • Completions - Template tag and filter autocompletion with snippets Completions
  • Diagnostics - Real-time error checking and validation Diagnostics
  • Go to definition - Jump to template, block, or variable definitions
    • Template navigation for {% extends %} and {% include %}
    • Exact template-name highlighting in editors that support definition links
    • Block and variable definitions
  • Find references - See where templates, blocks, and variables are used
    • Template references for {% extends %} and {% include %}
    • Block and variable references
  • Document links - Click through resolved template references and template libraries
    • Template names in {% extends %} and {% include %}
    • Template libraries in {% load %}
  • Folding ranges - Fold Django template regions Folding ranges
  • Hover - View documentation for Django template tags, filters, libraries, and template references Hover tag Hover filter Hover template
  • Code actions - Quick fixes for unloaded template libraries and mismatched closing block names
  • Formatting - Opt-in whole-document Django template formatting through djangofmt
  • Rename - Refactor names across files
  • Document symbols - Outline view of template structure
  • Workspace symbols - Search across all project templates
  • Signature help - Parameter hints while typing

Getting Started

Set up your editor's LSP client to run the server:

  • VS Code - Install the extension from the marketplace
  • Neovim - Configure with vim.lsp.config()
  • Sublime Text - Set up with LSP package
  • Zed - Install the extension

See all client configurations.

Most editors can use uvx --from django-language-server djls serve to run the server on-demand without installing it. Alternatively, install it globally first:

uv tool install django-language-server
# or: pipx install django-language-server

See the Installation guide for more options including pip, standalone binaries, and building from source.

Once configured, open any Django template file in your project to get:

  • Template tag and filter completions with snippets
  • Real-time syntax validation and diagnostics
  • Hover documentation for template tags, filters, libraries, and template references
  • Navigation to template definitions and references, including exact template-name highlighting for goto in supported editors
  • Clickable links for {% extends %}, {% include %}, and {% load %} names
  • Quick fixes for unloaded template tags/filters and mismatched {% endblock %} names
  • Folding for Django template regions
  • Outline symbols for template structure
  • Opt-in whole-document formatting through djangofmt

Documentation

Visit djls.joshthomas.dev for full documentation including installation guides, configuration options, and editor setup instructions.

License

django-language-server is licensed under the Apache License, Version 2.0. See the LICENSE file for more information.


django-language-server is not associated with the Django Software Foundation.

Django is a registered trademark of the Django Software Foundation.

About

A language server for the Django web framework

Resources

License

Code of conduct

Contributing

Stars

192 stars

Watchers

4 watching

Forks

Sponsor this project

 

Contributors