mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-08-04 01:58:18 +00:00
add neovim plugin (#59)
This commit is contained in:
parent
d9d0f4ee87
commit
accb8fdfb4
8 changed files with 176 additions and 65 deletions
27
editors/nvim/lua/djls/init.lua
Normal file
27
editors/nvim/lua/djls/init.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
local M = {}
|
||||
|
||||
M.defaults = {
|
||||
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 = {},
|
||||
}
|
||||
|
||||
function M.setup(opts)
|
||||
opts = vim.tbl_deep_extend("force", M.defaults, opts or {})
|
||||
|
||||
local configs = require("lspconfig.configs")
|
||||
if not configs.djls then
|
||||
configs.djls = {
|
||||
default_config = opts,
|
||||
}
|
||||
end
|
||||
|
||||
require("lspconfig").djls.setup(opts)
|
||||
end
|
||||
|
||||
return M
|
Loading…
Add table
Add a link
Reference in a new issue