Skip to content

An extension for nvim-dap providing configurations for launching go debugger (delve) and debugging individual tests

Notifications You must be signed in to change notification settings

soyum2222/nvim-dap-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

nvim-dap-go

An extension for nvim-dap providing configurations for launching go debugger (delve) and debugging individual tests.

Pre-reqs

This plugin extension make usage of treesitter to find the nearest test to debug. Make sure you have the Go treesitter parser installed. If using nvim-treesitter plugin you can install with :TSInstall go.

Installation

  • Install like any other neovim plugin:
    • If using vim-plug: Plug 'soyum2222/nvim-dap-go'
    • If using packer.nvim: use 'soyum2222/nvim-dap-go'

Usage

Register the plugin

Call the setup function in your init.vim to register the go adapter and the configurations to debug go tests:

lua require('dap-go').setup()

Use nvim-dap as usual

  • Call :lua require('dap-go').start_debug() to start debugging.
  • See :help dap-mappings and :help dap-api.

Debugging individual tests

To debug the closest method above the cursor use you can run:

  • :lua require('dap-go').debug_test()

It is better to define a mapping to invoke this command. See the mapping section bellow.

Mappings

nmap <silent> <leader>c :lua require('dap-go').start_debug()<CR>

Acknowledgement

Thanks to the nvim-dap-python for the inspiration.

About

An extension for nvim-dap providing configurations for launching go debugger (delve) and debugging individual tests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%