Skip to content

Repository files navigation

🦆 DAPInstall

A NeoVim plugin for managing several debuggers for Nvim-dap

Repository's startsIssuesLicense
Say thanksLatest commitGitHub repository size

Demo


TL;DR

DAPInstall.nvim is a NeoVim plugin written in Lua that extends nvim-dap's functionality for managing various debuggers. Everything from installation, configuration, setup, etc... can be done using DAPInstall.nvim. To get started, install it with your favorite plugin manager and then install the debuggers you'd like to use using the ':DIInstall ' command and [optionally] use their default configs.

🌲 Table of Contents

🎁 Features

  • (Un)Installs debuggers
  • List installed debuggers
  • Can manage the configuration of every debugger [individually]
  • Supports a wide range of debuggers
  • User-friendly interface

📺 Notices

Checkout the CHANGELOG.md file for more information on the notices below:

  • 09-09-21: Refactored and formatted code.
  • 26-07-21: Added API.

👻 Caveats

  • Currently it only works for *nix systems (Linux, MacOS, ...) and Windows through WSL. Native support for Windows is coming soon.

📦 Installation

Prerequisites

Adding the plugin

You can use your favorite plugin manager for this. Here are some examples with the most popular ones:

Vim-plug

Plug'Pocco81/DAPInstall.nvim'

Packer.nvim

use"Pocco81/DAPInstall.nvim"

Vundle

Plugin'Pocco81/DAPInstall.nvim'

NeoBundle

NeoBundleFetch'Pocco81/DAPInstall.nvim'

Setup (configuration)

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

localdap_install=require("dap-install")
dap_install.setup({
installation_path=vim.fn.stdpath("data") .."/dapinstall/",
})

For init.vim

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

Updating

This depends on your plugin manager. If, for example, you are using Packer.nvim, you can update it with this command:

:PackerUpdate

🤖 Usage

Commands

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.

API

The API can be accessed by requiring it:

localdi_api=require("dap-install.api.<module>")

Modules:

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.

🐬 Configuration

Although settings already have self-explanatory names, here is where you can find info about each one of them and their classifications!

General

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.

Debuggers

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:

  1. Will configure the Python debugger with its default values:
localdap_install=require("dap-install")
dap_install.config("python", {})
  1. Will override some values from the Python debugger:
localdap_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()
localcwd=vim.fn.getcwd()
ifvim.fn.executable(cwd.."/usr/bin/python3.9") ==1thenreturncwd.."/usr/bin/python3.9"elseifvim.fn.executable(cwd.."/usr/bin/python3.9") ==1thenreturncwd.."/usr/bin/python3.9"elsereturn"/usr/bin/python3.9"endend
}
}
}
)

You could also use a loop to configure every installed debugger like so:

localdap_install=require("dap-install")
localdbg_list=require("dap-install.api.debuggers").get_installed_debuggers()
for_, debuggerinipairs(dbg_list) dodap_install.config(debugger)
end

List of debuggers

DI. NamePro. LanguageDebuggerDependenciesStatus
pythonPythondebugpypython, pipTested
ccppr_vscC, C++, Rustvsc-cpptoolswget, unzip, makeTested
goGodelve, vscode-gogo, npmTested
phpPHPvscode-php-debuggit, npmTested
luaLuaOSSFVN/ATested
dnetcs.NET, C#netcoredbgwget, tarTested
go_delveGodelvegoTested
chromeJavaScriptReact, TypeScriptReactvscode-chrome-debugnpm, gitTested
dartDartdart-codegit, npxSupported
jsnodeJavaScriptnode-debug2npm, gitSupported
ruby_vscRubynetcoredbggit, npmExperimental
ccppr_lldbC, C++, Rustlldb-vscodeN/AExperimental
markdownMarkdownmockdebugN/AExperimental
javaJavajava-debugN/AUnsupported
haskellHaskellhaskell-debug-adapterN/AUnsupported
scalaScalanvim-metalsN/AUnsupported
  • Tested: Fully supported
  • Supported: 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.

🙋 FAQ

  • Q: "How can I view the doc from NeoVim?"
  • A: Use :help DAPInstall.nvim

🫂 Contribute

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.

Need help

This is a list of things I currently need help with:

  1. Testing the installers and reporting back via an issue
  2. Creating the missing installers for the various debuggers
  3. Correcting the installers that are broken

💭 Inspirations

The following projects inspired the creation of DAPInstall.nvim. If possible, go check them out to see why they are so amazing :]

📜 License

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.

📋 TO-DO

High Priority

  • Test every debugger
  • Add support for Windows?

Low Priority

  • None

Enjoy!

About

🦆 A NeoVim plugin for managing several debuggers for Nvim-dap

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages