PasiBergman / DAPInstall.nvim

πŸ¦† A NeoVim plugin for managing several debuggers for Nvim-dap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ¦† DAPInstall

A NeoVim plugin for managing several debuggers for Nvim-dap

Repository's starts Issues License
Say thanks Latest commit GitHub 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:

  • 26-07-21: Added API.

πŸ“¦ 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/",
verbosely_call_debuggers = false,

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/",
	verbosely_call_debuggers = false,
})

For init.vim

lua << EOF
local dap_install = require("dap-install")

dap_install.setup({
	installation_path = vim.fn.stdpath("data") .. "/dapinstall/",
	verbosely_call_debuggers = false,
})
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> installs <debugger>.
  • :DIUninstall <debugger> uninstalls <debugger>.
  • :DIList lists installed debuggers.

API

The API can be accessed by requiring it:

local di_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 table of available debuggers in which the key is the name of the debugger and the value is another table in which index 1 has name of the module whithin DAPInstall.nvim and index 2 has the installation path.

di_api.get_installed_debuggers()

Returns a table with the names of the installed debuggers.

🐬 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:
local dap_install = require("dap-install")
dap_install.config("python_dbg", {})
  1. Will override some values from the Python debugger:
local dap_install = require("dap-install")
dap_install.config(
	"python_dbg",
    {
        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.debuggers_list").debuggers

for debugger, _ in pairs(dbg_list) do
	dap_install.config(debugger, {})
end

List of debuggers

DI. Name Pro. Language Debugger Status
python_dbg Python debugpy Tested
go_dbg Go delve, vscode-go Tested
go_delve_dbg Go delve Tested
php_dbg PHP vscode-php-debug Tested
lua_dbg Lua OSSFV Tested
dnetcs_dbg .NET, C# netcoredbg Tested
dart_dbg Dart dart-code Supported
jsnode_dbg JavaScript node-debug2 Supported
ruby_vsc_dbg Ruby netcoredbg Experimental
ccppr_lldb_dbg C, C++, Rust lldb-vscode Experimental
ccppr_vsc_dbg C, C++, Rust vsc-cpptools Experimental
markdown_dbg Markdown mockdebug Experimental
java_dbg Java java-debug Unsupported
haskell_dbg Haskell haskell-debug-adapter Unsupported
scala_dbg Scala nvim-metals Unsupported
  • 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

Low Priority

  • None

Enjoy!

About

πŸ¦† A NeoVim plugin for managing several debuggers for Nvim-dap

License:GNU General Public License v3.0


Languages

Language:Lua 93.5%Language:Vim Script 6.5%