mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-07-07 20:55:02 +00:00
.. | ||
lua/djls | ||
README.md |
djls.nvim
A Neovim plugin for the Django Language Server.
Note
This plugin is a temporary solution until the project is mature enough to be integrated into mason.nvim and nvim-lspconfig.
Installation
lazy.nvim
Minimal setup:
{
"joshuadavidthomas/django-language-server",
}
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:
{
"joshuadavidthomas/django-language-server",
dependencies = {
"neovim/nvim-lspconfig",
},
config = function(plugin, opts)
vim.opt.rtp:append(plugin.dir .. "/editors/nvim")
require("djls").setup(opts)
end,
}
The spec can also serve as a reference for a more detailed installation if needed or desired.
Configuration
Default configuration options:
{
cmd = { "djls", "serve" },
filetypes = { "django-html", "htmldjango", "python" },
root_dir = function(fname)
local util = require("lspconfig.util")
local root = util.root_pattern("manage.py", "pyproject.toml")(fname)
return root or vim.fn.getcwd()
end,
settings = {},
}