Skip to content

Commit 6517a4b

Browse files
update docs using plugin README
1 parent 3a8787e commit 6517a4b

File tree

5 files changed

+93
-65
lines changed

5 files changed

+93
-65
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The package provides pre-built wheels with the Rust-based LSP server compiled fo
7070

7171
The Django Language Server works with any editor that supports the Language Server Protocol (LSP). We currently have setup instructions for:
7272

73-
- [Neovim](docs/editor-setup/neovim.md)
73+
- [Neovim](docs/editors/neovim.md)
7474

7575
Got it working in your editor? [Help us add setup instructions!](#testing-and-documenting-editor-setup)
7676

docs/editor-setup/neovim.md

Lines changed: 0 additions & 55 deletions
This file was deleted.

docs/editors/neovim.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: Neovim
3+
weight: 10
4+
---
5+
6+
# djls.nvim
7+
8+
A Neovim plugin for the Django Language Server.
9+
10+
!!! note
11+
12+
This plugin is a temporary solution until the project is mature enough to be integrated into [mason.nvim](https://github.com/williamboman/mason.nvim) and [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig).
13+
14+
## Installation
15+
16+
### [lazy.nvim](https://github.com/folke/lazy.nvim)
17+
18+
Minimal setup:
19+
20+
```lua
21+
{
22+
"joshuadavidthomas/django-language-server",
23+
}
24+
```
25+
26+
The plugin takes advantage of lazy.nvim's spec loading by providing a `lazy.lua` at the root of the repository to handle setup and runtime path configuration automatically. This handles adding the plugin subdirectory to Neovim's runtime path and initializing the LSP client:
27+
28+
```lua
29+
{
30+
"joshuadavidthomas/django-language-server",
31+
dependencies = {
32+
"neovim/nvim-lspconfig",
33+
},
34+
config = function(plugin, opts)
35+
vim.opt.rtp:append(plugin.dir .. "/editors/nvim")
36+
require("djls").setup(opts)
37+
end,
38+
}
39+
```
40+
41+
The spec can also serve as a reference for a more detailed installation if needed or desired.
42+
43+
## Configuration
44+
45+
Default configuration options:
46+
47+
```lua
48+
{
49+
cmd = { "djls", "serve" },
50+
filetypes = { "django-html", "htmldjango", "python" },
51+
root_dir = function(fname)
52+
local util = require("lspconfig.util")
53+
local root = util.root_pattern("manage.py", "pyproject.toml")(fname)
54+
return root or vim.fn.getcwd()
55+
end,
56+
settings = {},
57+
}
58+
```

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ The package provides pre-built wheels with the Rust-based LSP server compiled fo
7676

7777
The Django Language Server works with any editor that supports the Language Server Protocol (LSP). We currently have setup instructions for:
7878

79-
- [Neovim](editor-setup/neovim.md)
79+
- [Neovim](editors/neovim.md)
8080

8181
Got it working in your editor? [Help us add setup instructions!](#testing-and-documenting-editor-setup)
8282

docs/processor.py

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -499,28 +499,53 @@ def replace_link(match: re.Match[str]) -> str:
499499

500500

501501
def main():
502-
console.print("[bold blue]File Processor[/bold blue]")
502+
"""Process documentation files."""
503+
console.print("[bold blue]Documentation Processor[/bold blue]")
503504

504-
processors = [
505-
add_frontmatter({"title": "Home"}),
505+
common_processors = [
506506
convert_admonitions,
507507
convert_repo_links(
508508
"https://github.com/joshuadavidthomas/django-language-server"
509509
),
510510
]
511511

512-
success = process_file(
512+
readme_success = process_file(
513513
input="README.md",
514514
output="docs/index.md",
515-
processors=processors,
515+
processors=[
516+
add_frontmatter({"title": "Home"}),
517+
*common_processors,
518+
],
516519
preview=True,
517520
description="README.md → docs/index.md",
518521
)
519522

520-
if success:
521-
console.print("\n[green]✨ Processing completed successfully![/green]")
523+
nvim_success = process_file(
524+
input="editors/nvim/README.md",
525+
output="docs/editors/neovim.md",
526+
processors=[
527+
add_frontmatter(
528+
{
529+
"title": "Neovim",
530+
"weight": 10,
531+
}
532+
),
533+
*common_processors,
534+
],
535+
preview=True,
536+
description="Neovim docs → docs/editors/neovim.md",
537+
)
538+
539+
if readme_success and nvim_success:
540+
console.print("\n[green]✨ All files processed successfully![/green]")
522541
else:
523-
console.print("\n[red]Processing failed![/red]")
542+
console.print("\n[red]Some files failed to process:[/red]")
543+
for name, success in [
544+
("README.md → docs/index.md", readme_success),
545+
("Neovim docs → docs/editors/neovim.md", nvim_success),
546+
]:
547+
status = "[green]✓[/green]" if success else "[red]✗[/red]"
548+
console.print(f"{status} {name}")
524549

525550

526551
if __name__ == "__main__":

0 commit comments

Comments
 (0)