mfussenegger / nvim-dap

Debug Adapter Protocol client implementation for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Configuring DAP for julia

tapyu opened this issue · comments

Debug adapter definition and debug configuration

I am trying to use nvim to debug julia code, but the DAP config failed. I used the julia's DAP debugger for vscode. For configure it, I use this code

local dap = require('dap')

dap.adapters.julia = {
  type = "executable",
  command = "/usr/bin/julia $HOME/git/DebugAdapter.jl/src/DebugAdapter.jl",
}

dap.configurations.julia = {
	{
		-- The first three options are required by nvim-dap
		type = "julia",
		request = "launch",
		name = "Launch file",
		program = "${file}",
	},
}

where <path/to> is the path to DebugAdapter.jl/ in my system.

Debug adapter version

1.0.1

Steps to Reproduce

  1. run git clone https://github.com/julia-vscode/DebugAdapter.jl
  2. set the julia DAP config as shown before
  3. On nvim, run :lua require'dap'.continue()

Expected Result

I expected my debugger to work properly.

Actual Result

Unfortunately, I've received the the following error

Screenshot from 2022-04-20 06-14-14

I have never done configurations for Debugger Adapter Protocols before, so any help is welcome.

Try

dap.adapters.julia = {
  type = "executable",
  command = "/usr/bin/julia",
  args = { vim.fn.expand("$HOME/git/DebugAdapter.jl/src/DebugAdapter.jl") },
}

Otherwise the whole string is used as a single command. And environment variables are not automatically expanded, a vim.fn.expand call is needed for that.

Now it seems to expand correctly, but still not working.

Screenshot from 2022-04-20 14-29-50

In /home/tapyu/.cache/nvim/dap.log, I got:

[ DEBUG ] 2022-04-20T14:32:47Z-0300 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:800 ]	"Spawning debug adapter"	{
  args = { "/home/tapyu/git/DebugAdapter.jl/src/DebugAdapter.jl" },
  command = "/usr/bin/julia",
  type = "executable"
}
[ DEBUG ] 2022-04-20T14:32:47Z-0300 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:989 ]	"request"	{
  arguments = {
    adapterID = "nvim-dap",
    clientId = "neovim",
    clientname = "neovim",
    columnsStartAt1 = true,
    linesStartAt1 = true,
    locale = "en_US.UTF-8",
    pathFormat = "path",
    supportsRunInTerminalRequest = true,
    supportsVariableType = true
  },
  command = "initialize",
  seq = 0,
  type = "request"
}
[ INFO ] 2022-04-20T14:32:48Z-0300 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:819 ]	"Closed all handles"
[ INFO ] 2022-04-20T14:32:48Z-0300 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:822 ]	"Process closed"	20042	false

I have set :lua require'dap'.set_log_level('TRACE')

Are you sure that DebugAdapter.jl is launching the debug adapter and that it supports communication via stdio?

I had a quick look at the julia-vscode sources and it looks like part of the debug adapter is implemented there. I'm not familiar with julia so I'm not sure what DebugAdapter.jl provides but it does look somewhat incomplete.

Judging from puremourning/vimspector#256 and emacs-lsp/dap-mode#173 it looks like others came to a similar conclusion.

You are right. My bad. It have been quite frustrating trying to work along with Julia on NeoVim... I cannot give up of the debugging functionality, so I can't use Neovim. Nevertheless, there is a guy who made a video explaining who to setup neovim to work with Julia. I didn't see it thoroughly and seems to be a little bit outdated (2019), but could fit to someone else...

ezoic increase your site revenue