Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring DAP for julia #532

Closed
tapyu opened this issue Apr 20, 2022 · 4 comments
Closed

Configuring DAP for julia #532

tapyu opened this issue Apr 20, 2022 · 4 comments

Comments

@tapyu
Copy link

tapyu commented Apr 20, 2022

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.

@mfussenegger
Copy link
Owner

mfussenegger commented Apr 20, 2022

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.

@tapyu
Copy link
Author

tapyu commented Apr 20, 2022

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')

@mfussenegger
Copy link
Owner

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.

@tapyu
Copy link
Author

tapyu commented Apr 22, 2022

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants