Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .just/devtools.just
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ set unstable := true

justfile := justfile_directory() + "/.just/devtools.just"

export DJLS_DEBUG := "1"

[private]
default:
@just --list --justfile {{ justfile }}
Expand All @@ -22,6 +24,7 @@ fmt:

[no-cd]
debug:
echo $DJLS_DEBUG
cargo run --bin djls-tmux --package djls-dev

[no-cd]
Expand Down
25 changes: 24 additions & 1 deletion .lazy.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
vim.lsp.config["djls"] = {
cmd = { "uvx", "lsp-devtools", "agent", "--", "djls", "serve" },
cmd = { "uvx", "lsp-devtools", "agent", "--", "target/debug/djls", "serve" },
cmd_env = { DJLS_DEBUG = "1" },
filetypes = { "htmldjango" },
root_markers = { "manage.py", "pyproject.toml" },
}
Expand All @@ -12,4 +13,26 @@ vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
end,
})

vim.api.nvim_create_user_command("DjlsDumpState", function()
local clients = vim.lsp.get_active_clients({ name = "djls" })
if #clients == 0 then
vim.notify("Django Language Server is not active", vim.log.levels.WARN)
return
end

-- Execute the custom LSP command
local client = clients[1]
client.request("workspace/executeCommand", {
command = "djls/dumpState",
arguments = {},
}, function(err, result)
if err then
vim.notify("Error dumping state: " .. vim.inspect(err), vim.log.levels.ERROR)
else
local message = result and result.message or "State dumped successfully"
vim.notify(message, vim.log.levels.INFO)
end
end)
end, { desc = "Dump Django LS internal state for debugging (requires DJLS_DEBUG=1)" })

return {}
Loading
Loading