Skip to content

Neovim Debugging

Source: Debug With Neovim: A Dev’s Edge in the AI Age, LazyVim Extras for Neovim configuration and recommended plugins

Use the Neovim Debug Adapter Protocol (DAP)

Setup with nvim-dap-ui to user interface

An easy way to setup is to use LazyVim DAP Core extra and language extra for language you are using

  • Set breakpoints for place in code you want to start debugging
  • Turn on user interface and set breakpoint(s)
  • Run debugger with program and see:
    • Local variables, scopes
    • Set breakpoints, can step into a program running, going into code and libraries
    • Threads
    • Expressions - view details and make changes
      • Check values similar to a REPL and query

You can use expressions to check program information. Code can be edited in real time.

Threads are useful for going through multi threaded programs.