You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/index.md
+42-58Lines changed: 42 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,22 +12,31 @@ A language server for the Django web framework.
12
12
13
13
## Features
14
14
15
-
**None.**
15
+
**Almost none!**
16
16
17
17
😅
18
18
19
-
However, the foundation has been laid:
19
+
Well, we've achieved the bare minimum of "technically something":
20
+
21
+
-[x] Template tag autocompletion
22
+
- It works! ...when you type `{%`
23
+
- That's it. That's the feature.
24
+
25
+
The foundation is solid though:
20
26
21
27
-[x] Working server architecture
22
-
-[x]Server implementing the Language Server Protocol written in Rust
23
-
-[x]Python agent running as a persistent process within the Django project's virtualenv
24
-
-[x]Server-agent communication via Protocol Buffers
28
+
-[x] Language Server Protocol implementation in Rust
29
+
-[x]Direct Django project interaction through PyO3
30
+
-[x]Single binary distribution with Python packaging
25
31
-[x] Custom template parser to support LSP features
26
32
-[x] Basic HTML parsing, including style and script tags
27
33
-[x] Django variables and filters
28
34
-[ ] Django block template tags
29
35
- Early work has been done on an extensible template tag parsing specification (TagSpecs)
30
-
-[ ] Actual LSP features (coming soon!... hopefully)
36
+
-[ ] More actual LSP features (coming soon!... hopefully)
37
+
- We got one! Well, half of one. Only like... dozens more to go? 🎉
38
+
39
+
Django wasn't built in a day, and neither was a decent Django language server. 😄
31
40
32
41
## Requirements
33
42
@@ -42,62 +51,26 @@ See the [Versioning](#versioning) section for details on how this project's vers
42
51
43
52
## Installation
44
53
45
-
The Django Language Server consists of two main components:
46
-
47
-
-**An LSP server**: Rust binary `djls`, distributed through the Python package `djls-server`
48
-
-**A Python agent**: `djls-agent` package that runs in your Django project
49
-
50
-
Both will need to be available in your Django project in order to function.
51
-
52
-
The quickest way to get started is to install both the server and agent in your project's environment:
54
+
Install the Django Language Server in your project's environment:
53
55
54
56
```bash
55
-
uv add --dev 'djls[server]'
57
+
uv add --dev django-language-server
56
58
uv sync
57
59
58
60
# or
59
61
60
-
pip install djls[server]
62
+
pip install django-language-server
61
63
```
62
64
63
-
!!! note
64
-
65
-
The server should be installed globally on your development machine. The quick-start method above will install the server in each project's environment and is only intended for trying things out. See the [Server](#server) section below for details.
66
-
67
-
### Server
68
-
69
-
You can install the pre-built binary package from PyPI, or build from source using cargo.
70
-
71
-
The server binary is published to PyPI as `djls-server` for easy installation via uv or pipx:
72
-
73
-
```bash
74
-
uv tool install djls-server
75
-
76
-
# or
77
-
78
-
pipx install djls-server
79
-
```
65
+
The package provides pre-built wheels with the Rust-based LSP server compiled for common platforms. Installing it adds the `djls` command-line tool to your environment.
80
66
81
-
If you have a Rust toolchain available and prefer to build from source, you can install via cargo:
The agent needs to be installed in your Django project's environment to provide project introspection.
90
-
91
-
The agent is published to PyPI as `djls-agent` and should be added to your project's development dependencies:
67
+
!!! note
92
68
93
-
```bash
94
-
uv add --dev djls-agent
95
-
uv sync
69
+
The server must currently be installed in each project's environment as it needs to run using the project's Python interpreter to access the correct Django installation and other dependencies.
96
70
97
-
# or
71
+
Global installation is not yet supported as it would run against a global Python environment rather than your project's virtualenv. The server uses [PyO3](https://pyo3.rs) to interact with Django, and we aim to support global installation in the future, allowing the server to detect and use project virtualenvs, but this is a tricky problem involving PyO3 and Python interpreter management.
98
72
99
-
pip install djls-agent
100
-
```
73
+
If you have experience with [PyO3](https://pyo3.rs) or [maturin](https://maturin.rs) and ideas on how to achieve this, please check the [Contributing](#contributing) section below.
101
74
102
75
## Editor Setup
103
76
@@ -115,8 +88,6 @@ This project adheres to DjangoVer. For a quick overview of what DjangoVer is, he
115
88
116
89
In short, `v5.1.x` means the latest version of Django the Django Language Server would support is 5.1 — so, e.g., versions `v5.1.0`, `v5.1.1`, `v5.1.2`, etc. should all work with Django 5.1.
117
90
118
-
At this moment, all components of the Django Language Server (the `djls` binary, the `djls-agent` agent package on PyPI, and the `djls-binary` binary distribution package on PyPI) will share the same version number. When a new version is released, all packages are updated together regardless of which component triggered the release.
119
-
120
91
### Breaking Changes
121
92
122
93
While DjangoVer doesn't encode API stability in the version number, this project strives to follow Django's standard practice of "deprecate for two releases, then remove" policy for breaking changes. Given this is a language server, breaking changes should primarily affect:
@@ -137,13 +108,23 @@ The project needs help in several areas:
137
108
138
109
### Testing and Documenting Editor Setup
139
110
140
-
The server has only been tested with Neovim. Documentation for setting up the language server in other editors is sorely needed, particularly VS Code. However, any editor that has [LSP client](https://langserver.org/#:~:text=for%20more%20information.-,LSP%20clients,opensesame%2Dextension%2Dlanguage_server,-Community%20Discussion%20Forums) support would be welcome.
111
+
The server has only been tested with Neovim. Documentation for setting up the language server in other editors is sorely needed, particularly VS Code. However, any editor that has [LSP client](https://langserver.org/#:~:text=for%20more%20information.-,LSP%20clients,opensesame%2Dextension%2Dlanguage_server,-Community%20Discussion%20Forums) support should work.
112
+
113
+
If you run into issues setting up the language server:
114
+
115
+
1. Check the existing documentation in `docs/editors/`
116
+
2.[Open an issue](https://github.com/joshuadavidthomas/django-language-server/blob/main/../../issues/new) describing your setup and the problems you're encountering
117
+
- Include your editor and any relevant configuration
118
+
- Share any error messages or unexpected behavior
119
+
- The more details, the better!
141
120
142
121
If you get it working in your editor:
143
122
144
123
1. Create a new Markdown file in the `docs/editors/` directory (e.g., `docs/editors/vscode.md`)
145
124
2. Include step-by-step setup instructions, any required configuration snippets, and tips for troubleshooting
146
125
126
+
Your feedback and contributions will help make the setup process smoother for everyone! 🙌
127
+
147
128
### Feature Requests
148
129
149
130
The motivation behind writing the server has been to improve the experience of using Django templates. However, it doesn't need to be limited to just that part of Django. In particular, it's easy to imagine how a language server could improve the experience of using the ORM -- imagine diagnostics warning about potential N+1 queries right in your editor!
@@ -154,15 +135,18 @@ All feature requests should ideally start out as a discussion topic, to gather f
154
135
155
136
### Development
156
137
157
-
The project consists of both Rust and Python components:
138
+
The project is written in Rust using PyO3 for Python integration:
158
139
159
-
- Rust: LSP server, template parsing, and core functionality (`crates/`)
160
-
- Python: Django project and environment introspection agent (`packages/`)
140
+
- LSP server implementation (`crates/djls/`)
141
+
- Template parsing and core functionality (`crates/djls-template-ast/`)
142
+
- Python integration via PyO3 for Django project introspection
161
143
162
144
Code contributions are welcome from developers of all backgrounds. Rust expertise is especially valuable for the LSP server and core components.
163
145
164
-
Python and Django developers should not be deterred by the Rust codebase - Django expertise is just as valuable. The Rust components were built by [a simple country CRUD web developer](https://youtu.be/7ij_1SQqbVo?si=hwwPyBjmaOGnvPPI&t=53) learning Rust along the way.
146
+
One significant challenge we're trying to solve is supporting global installation of the language server while still allowing it to detect and use project virtualenvs for Django introspection. Currently, the server must be installed in each project's virtualenv to access the project's Django installation. If you have experience with PyO3 and ideas about how to achieve this, we'd love your help!
147
+
148
+
Python and Django developers should not be deterred by the Rust codebase - Django expertise is just as valuable. Understanding Django's internals and common development patterns helps inform what features would be most valuable. The Rust components were built by [a simple country CRUD web developer](https://youtu.be/7ij_1SQqbVo?si=hwwPyBjmaOGnvPPI&t=53) learning Rust along the way.
165
149
166
150
## License
167
151
168
-
django-language-server is licensed under the MIT license. See the [`LICENSE`](https://github.com/joshuadavidthomas/django-language-server/blob/main/LICENSE) file for more information.
152
+
django-language-server is licensed under the Apache License, Version 2.0. See the [`LICENSE`](https://github.com/joshuadavidthomas/django-language-server/blob/main/LICENSE) file for more information.
0 commit comments