Neovim for Beginners — Debugging using DAP

Code debugging using Debug Adapter Protocol (DAP).

alpha2phi
5 min readFeb 19, 2022
Neovim for Beginners — Debugging using DAP

We walked through the configuration of the built-in LSP client in previous articles. For code debugging, it is a little bit tricky. As of this writing, there are 2 plugins that can be used for debugging.

In this article, we will go through thenvim-dap plugin which is a debug adapter protocol client, or “debugger”, or “debug-frontend”. In a later article, we shall look at thevimspector plugin.

We are going to

  • Configure the nvim-dap plugin together with the UI/UX and language extensions.
  • Configure key mappings for debugging using which-key.nvim.
  • Configure debugging for Lua, Python, Go, and Rust.
  • Configure the rust-tools.nvim plugin for Rust debugging.

This article is part of the Neovim for Beginners series.

The Neovim configuration files can be found in this repository.

The Basics

Neovim does not have a built-in DAP client. Instead, nvim-dap acts as the DAP client (:h dap.txt). Using a debug adapter we can

  • Launch an application to debug
  • Attach to running applications to debug them

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.