An extension for nvim-dap providing configurations for launching kotlin debugger (kotlin-debug-adapter) and debugging individual tests.
- Auto launch kotlin-debug-adapter. No configuration needed. You just have to have
kotlin-debug-adapter
in your path. - Run just the closest test from the cursor in debug mode (uses treesitter). See debugging tests section below for more details.
- Configuration to start a debug session in the main function.
- Configuration to start a debug session in the latest cached main function.
- Configuration to run tests in a debug session.
- Neovim
- nvim-dap
- kotlin-debug-adapter >= 0.4.3
This plugin extension make usage of treesitter to find the nearest test to debug.
Make sure you have the Kotlin treesitter parser installed.
If using nvim-treesitter plugin you can install with :TSInstall kotlin
.
using vim-plug:
Plug 'Mgenuit/nvim-dap-kotlin'
using packer.nvim:
use 'Mgenuit/nvim-dap-kotlin'
using Lazy:
{ "Mgenuit/nvim-dap-kotlin", config = true }
In neovim
:MasonInstall kotlin-debug-adapter
brew install kotlin-debug-adapter
Call the setup function in your init.vim
to register the go adapter and the configurations to debug go tests:
lua require('dap-kotlin').setup()
NOTE: When installing with Lazy this step is done by the plugin manager automatically.
It is possible to customize nvim-dap-kotlin by passing a config table in the setup function.
The example below shows all the possible configurations:
lua require('nvim-dap-kotlin').setup {
dap_command = "kotlin-debug-adapter",
project_root = "${workspaceFolder}",
enable_logging = false,
log_file_path = "",
}
- Call
:lua require('dap').continue()
to start debugging. - All pre-configured debuggers will be displayed for you to choose from.
- See
:help dap-mappings
and:help dap-api
.
To debug the closest test method above the cursor use you can select the Closest Test
configuration.
This support both normal and backtick enclosed method names.
Thanks to nvim-dap-go for the inspiration.