-
-
Notifications
You must be signed in to change notification settings - Fork 37
DAP support elixir
Zeioth edited this page Oct 4, 2023
·
2 revisions
Nothing special needs to be done for elixir.
Please note that this section has nothing to do with compiler.nvim. I'm documenting this to make your life easier. To debug elixir with DAP you have to:
- Install the mason package
elixir-ls
. -
:cd
your project root before running DAP. - Note that on elixir projects, your program code is in
./lib
, a dir above that you have the project root.
Here you have an example of how to configure DAP for elixir
local dap = require("dap")
-- Elixir
dap.adapters.mix_task = {
type = 'executable',
command = vim.fn.stdpath("data") .. '/mason/bin/elixir-ls-debugger';
args = {}
}
dap.configurations.elixir = {
{
type = "mix_task",
name = "mix test",
task = 'test',
taskArgs = {"--trace"},
request = "launch",
startApps = true, -- for Phoenix projects
projectDir = "${workspaceFolder}",
requireFiles = {
"test/**/test_helper.exs",
"test/**/*_test.exs"
}
},
}
Just insert a breakpoint, run :DapContinue
and you will see something like
Congratulations, now you can compile and debug elixir.
- You don't need to manually compile the program in debug mode before calling
DAP
. The debug adapter takes care of everything. - If you find any issue while configuring DAP, run
:DapSetLogLevel trace
and:DapShowLog
to find the reason.