Golang with Delve over Debug Adapter Protocol for Neovim (>= 0.5)
dap-go.nvim
is an extension for nvim-dap
to configurate Go with Delve debugger.
- Load
dap
configurations from a file.
This section should guide you on how to add the extension to nvim-dap
.
- Neovim (v.5.1) or higher.
- plenary.nvim for all the stuff I don't want to write twice.
- Delve
- telescope-dap to browse
the
dap
configurations. - nvim-dap-ui for more user friendly DAP user interface.
Using vim-plug
Plug 'nvim-lua/plenary.nvim'
Plug 'yriveiro/dap-go.nvim'
Using dein
call dein#add('nvim-lua/plenary.nvim')
call dein#add('yriveiro/dap-go.nvim')
Using packer.nvim
use {
'yriveiro/dap-go.nvim',
requires = { {'nvim-lua/plenary.nvim'} }
}
require('dap-go').setup()
See config.lua
If you want to use a json file to hold configurations for the debugger you need to enable the external config feature.
require('dap-go').setup({
external_config = {
enabled = true,
}
})
An example of the dap-go.json
file. This file can be used for custom configurations.
The default path to search for is the current directory or git (if the current project
is using git) root.
{
"Custom config": {
"type": "go",
"name": "Debug custom",
"request": "launch",
"program": "${file}",
"args": [
"--foo",
"bar"
],
"options": {
"env": {
"FOO": "bar"
}
}
}
}
All contributions are welcome! Just open a pull request. Please read CONTRIBUTING.md
Licensed under the MIT License. Check the LICENSE file for details.