Skip to content

Repository files navigation

django-lsp

django-lsp is a Rust language server focused on Django ORM query completions. It uses Ruff's Python parser to build a static workspace index and follows Django model relations without importing or executing the project.

from .models import Blog

Blog.objects.filter(author__team__name__icontains="Django")

Installation

Install the language server from PyPI with uv:

uv tool install django-lsp

pipx install django-lsp and python -m pip install django-lsp are also supported. Confirm the installed executable is available with:

django-lsp --version

Point an editor's LSP client at the django-lsp command, with no arguments. The server uses standard input and output for LSP communication.

Visual Studio Code

The repository includes a Visual Studio Code extension that runs django-lsp alongside Pylance, Pyright, Ruff, or another general Python language server. It uses a configured executable, one already installed on PATH, or the executable bundled into a platform-specific VSIX. See the extension README for development installation and packaging.

Zed

The repository includes a Zed extension that registers django-lsp alongside a general Python language server. It uses a server already installed on PATH, or downloads the matching executable from the latest GitHub release. See the extension README for development installation while its extension-gallery submission is in progress.

Documentation

  • Getting started covers installing, building, and connecting an editor.
  • Completion examples shows executable examples generated from the real LSP.
  • Configuration documents pyproject.toml options.
  • Testing explains the Rust, protocol, documentation, and Django compatibility test layers.

The website uses CrossDocs, the same documentation framework as Cross-Inertia. Preview the complete FastAPI and React application locally at http://localhost:8000 with:

cd website
uv sync --locked
bun install --frozen-lockfile
bun run serve

Current scope

  • workspace model indexing
  • completion inside filter(...), exclude(...), get(...), select_related(...), and prefetch_related(...)
  • forward, reverse, and recursive relation traversal
  • AUTH_USER_MODEL support
  • models re-exported from package __init__.py modules
  • function-local and dotted import resolution
  • unsaved editor buffer updates

Development

Building from source requires Rust 1.95 or newer.

cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo run --bin render-docs -- --check
cargo test --all-targets

Validate the documentation website separately with:

cd website
uv sync --locked
bun install --frozen-lockfile
bun run check
bun run build

The project intentionally does not provide Django runtime introspection, general Python language features, or exhaustive support for dynamic model-loading patterns.

About

Django ORM autocomplete powered by a Rust language server

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages