A NeoVim plugin for managing several debuggers for Nvim-dap
Demo
- (Un)Installs debuggers
- List installed debuggers
- Can manage the configuration of every debugger [individually]
- Supports a wide range of debuggers
- User-friendly interface
Checkout the CHANGELOG.md file for more information on the notices below:
- 09-09-21: Refactored and formatted code.
- 26-07-21: Added API.
- Currently it only works for *nix systems (Linux, MacOS, ...) and Windows through WSL. Native support for Windows is coming soon.
You can use your favorite plugin manager for this. Here are some examples with the most popular ones:
Plug 'Pocco81/DAPInstall.nvim'
use "Pocco81/DAPInstall.nvim"
Plugin 'Pocco81/DAPInstall.nvim'
NeoBundleFetch 'Pocco81/DAPInstall.nvim'
As it's stated in the TL;DR, there are already some sane defaults that you may like, however you can change them to match your taste. These are the defaults:
installation_path = vim.fn.stdpath("data") .. "/dapinstall/",
The way you setup the settings on your configuration varies on whether you are using vimL for this or Lua.
For init.lua
local dap_install = require("dap-install")
dap_install.setup({
installation_path = vim.fn.stdpath("data") .. "/dapinstall/",
})
For init.vim
lua << EOF
local dap_install = require("dap-install")
dap_install.setup({
installation_path = vim.fn.stdpath("data") .. "/dapinstall/",
})
EOF
For instructions on how to configure the plugin, check out the configuration section.
This depends on your plugin manager. If, for example, you are using Packer.nvim, you can update it with this command:
:PackerUpdate
All the commands follow the camel casing naming convention and have the DI
prefix so that it's easy to remember that they are part of the DAPInstall.nvim plugin. These are all of them:
:DIInstall <debugger>
asserts dependencies and if they are met, installs<debugger>
.:DIUninstall <debugger>
uninstalls<debugger>
.:DIList
lists installed debuggers.
The API can be accessed by requiring it:
local di_api = require("dap-install.api.<module>")
Currently there is only one module available, and it's the debuggers
module which has the following functions
di_api.get_debuggers()
Returns a
table
with debuggers available on DAPInstall.
di_api.get_installed_debuggers()
Returns a
table
with the debuggers that are installed.
Although settings already have self-explanatory names, here is where you can find info about each one of them and their classifications!
This settings are unrelated to any group and are independent.
installation_path
: (String) path to where the debuggers will be installed. The only condition is that the path must end with a forward slash ("/")verbosely_call_debuggers
: (Boolean) if true, prints messages when calling a debugger.
To configure the debuggers DAPInstall.nvim provides the config("<debugger>", {<config>})
function that receives two arguments:
<debugger>
: the name of the debugger that can be found in the table below.<config>
: the configuration of the debugger itself.
In the <config>
you must pass a table with at least one of two keys (adapters
and/or configurations
). Every debugger has its own settings but they all something in common, they either have a adapters = {}
table, a configurations = {}
table or both. To edit the debuggers' settings in either of those sections just create the key and set the value to whatever you want. Remember that every debugger has its own config that can be found here
Examples:
- Will configure the Python debugger with its default values:
local dap_install = require("dap-install")
dap_install.config("python", {})
- Will override some values from the Python debugger:
local dap_install = require("dap-install")
dap_install.config(
"python",
{
adapters = {
type = "executable",
command = "python3.9",
args = {"-m", "debugpy.adapter"}
},
configurations = {
{
type = "python",
request = "launch",
name = "Launch file",
program = "${file}",
pythonPath = function()
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. "/usr/bin/python3.9") == 1 then
return cwd .. "/usr/bin/python3.9"
elseif vim.fn.executable(cwd .. "/usr/bin/python3.9") == 1 then
return cwd .. "/usr/bin/python3.9"
else
return "/usr/bin/python3.9"
end
end
}
}
}
)
You could also use a loop to configure every installed debugger like so:
local dap_install = require("dap-install")
local dbg_list = require("dap-install.api.debuggers").get_installed_debuggers()
for _, debugger in ipairs(dbg_list) do
dap_install.config(debugger)
end
DI. Name | Pro. Language | Debugger | Dependencies | Status |
---|---|---|---|---|
python |
Python | debugpy | python , pip |
Tested |
ccppr_vsc |
C, C++, Rust | vsc-cpptools | wget , unzip , make |
Tested |
go |
Go | delve, vscode-go | go , npm |
Tested |
php |
PHP | vscode-php-debug | git , npm |
Tested |
lua |
Lua | OSSFV | N/A | Tested |
dnetcs |
.NET, C# | netcoredbg | wget , tar |
Tested |
go_delve |
Go | delve | go |
Tested |
chrome |
JavaScriptReact, TypeScriptReact | vscode-chrome-debug | npm , git |
Tested |
codelldb |
C, C++, Rust, Swift | codelldb | wget , unzip |
Tested |
dart |
Dart | dart-code | git , npx |
Supported |
jsnode |
JavaScript | node-debug2 | npm , git |
Supported |
unity |
Unity3D, C# | UnityDebug | mono , wget , unzip |
Supported |
ruby_vsc |
Ruby | netcoredbg | git , npm |
Experimental |
ccppr_lldb |
C, C++, Rust | lldb-vscode | N/A | Experimental |
markdown |
Markdown | mockdebug | N/A | Experimental |
java |
Java | java-debug | N/A | Unsupported |
haskell |
Haskell | haskell-debug-adapter | N/A | Unsupported |
scala |
Scala | nvim-metals | N/A | Unsupported |
Tested
: Fully supportedSupported
: Fully supported, but needs testing.Experimental
: Still on the works.Legacy
: No longer supported, please migrate your configuration.Retired
: No longer included or supported.Unsupported
: No implementation whatsoever.
- Q: "How can I view the doc from NeoVim?"
- A: Use
:help DAPInstall.nvim
Pull Requests are welcomed as long as they are properly justified and there are no conflicts. If your PR has something to do with the README or in general related with the documentation, I'll gladly merge it! Also, when writing code for the project you must use the .editorconfig file on your editor so as to "maintain consistent coding styles". For instructions on how to use this file refer to EditorConfig's website.
This is a list of things I currently need help with:
- Testing the installers and reporting back via an issue
- Creating the missing installers for the various debuggers
- Correcting the installers that are broken
The following projects inspired the creation of DAPInstall.nvim. If possible, go check them out to see why they are so amazing :]
- kabouzeid/nvim-lspinstall: Provides the missing :LspInstall for nvim-lspconfig
DAPInstall.nvim is released under the GPL v3.0 license. It grants open-source permissions for users including:
- The right to download and run the software freely
- The right to make changes to the software as desired
- The right to redistribute copies of the software
- The right to modify and distribute copies of new versions of the software
For more convoluted language, see the LICENSE file.
High Priority
- Test every debugger
- Add support for Windows?
Low Priority
- None
Enjoy!