Releases: mfussenegger/nvim-dap
0.10.0
General
-
This is the last version supporting nvim 0.9.5. Going forward 0.10.x, 0.11.x and nightly are supported.
-
Changed how errors are logged for debug adapters.
stderroutput from a debug adapter is now always routed to a dedicated log file that is removed when the debug adapter process exits, unless it exits with an error. The same is the case forstdoutfor adapters communicating via TCP or PIPE. Note that some adapters (like delve) usedstdoutto show the output of the application you're debugging by default. These adapters typically also have an option to instead make use ofOutputEventevents which will result in the output showing up in the REPL. For delve the configuration property is calledoutputMode. -
The terminal buffer (
:help dap-terminal) now infers theerrorformatfrom the buffer from which you started a debug session. -
Added a
:DapPauseuser command.
API
-
Fixed an issue that caused response handlers for
session:requestto receive theerralso asresponse -
The
ErrorResponsevalues provided aserrparameter to event listeners or the response handler ofsession:requestnow has a__tostringmetatable method to supporttostring(err). -
Event listeners (
:help dap-listeners) can now returntrueto remove a registered listener. This can be useful for once-off listeners and mirrors nvim's autocmd API. -
Tweaked the display of the process information for
utils.pick_processto better fit onto the screen. The function now also takes alabelandpromptoption to customize that further.
REPL
-
Added
]]and[[keymaps to the REPL buffer to jump between prompts. -
Added an
optsparameter torepl.execute()to allow setting the context for anevaluaterequest.
0.9.0
Extensibility
-
Added support for configuration providers. A configuration provider is a function which discovers debug configurations and returns them. This allows nvim-dap extensions to either have dynamic configuration discovery or provide support for additional configuration formats. The two existing ways to create debug configurations - global via
dap.configurationsand per project via.vscode/launch.json- have been re-implemented as configuration provider. A side effect of this change is that it is no longer necessary to call aloadlaunchjsfunction to load configurations from.vscode/launch.jsonfiles and thetype_to_filetypesmapping is also no longer necessary. The.vscode/launch.jsonfile is always read on-demand when starting a new debug session. See:help dap-providers-configfor more information. -
Added a
on_confighook to allow plugins to pre-process configurations before they're used. See:help dap-listeners-on_configfor details. A common use case for this is to support custom${...}placeholder variables.
General
-
Improved the
switchbuflogic responsibility for selecting the window and buffer on a stopped event. It now has somesourcebuffer awareness to avoid running into "Debug adapter reported a frame at line X, cursor position outside buffer" errors - in particular if using a debug adapter which can show disassembly while stepping. -
Added a
usevisibleoption for theswitchbufsetting which prevents the cursor position from moving if the breakpoint that was hit is already visible in the current window. See:help dap.defaults. -
Fixed some races in regards to stopped event handling if the application is resumed concurrently with no user input. This solves some issues with debug adapters like the one for dart/flutter, which automatically pause and resume at the start of a debug session.
-
Improved process termination behavior to avoid (harmless) errors in the log when using
debugpyand fix process leaks when exiting nvim in the middle of a debug session using the javascript debug adapter. -
Added
allandhierarchyflags to theterminatefunction to allow either terminating all debug sessions, or the full hierarchy of a debug session which contains child-processes. The latter is useful for the javascript debug adapter which makes heavy use of child sessions and where a single terminate would otherwise not end the full debug session.
Widgets, REPL and expression evaluation
-
Added a "Copy as expression" action for variables to the action menu (
o). If yanking the value of a variable it will now also copy it's expression automatically to theeregister. For example if you evaluate a list and drill into the fourth item which has acountryproperty, which in turn has anameproperty and you yank the value, theeregister might contain an expression likeitems[3]["country"]["name"]- depending on the debug adapter. This is useful if you want to call functions on a specific item shown in a result as you can typei<C-r>eto insert the expression. -
The REPL and the variables and scopes widget now have a
tagfuncset which can be used to jump to the declaration location of a variable if the debug adapter provides the information. Use with<C-]>or<C-w ]> -
Added a
autostartoption to automatically start a debug session when evaluating an expression in the REPL. See:help dap.defaults. Tip: Use this with nluarepl to be able to always evaluate Lua expressions in the REPL. -
Added support for special
dap-eval://<ft>buffers which can be used to input multi-line expressions and evaluate them using:w. The output is shown in the REPL. -
Added a
:DapEvalcommand which opens adap-eval://buffer in a split window. The command has range support to pre-fill the new buffer with the selected text.
Terminals
-
The integrated terminal buffer now inherits the
pathoption from the source filetype for bettergfandC-w Fsupport. This is useful if running tests via a debug session where the output often contains stacktraces. -
External terminals now correctly use
envvariables provided by the debug adapter.
Performance
- Reduced the overhead of the RPC loop and removed various copy operations.
launch.json
-
Creating a new
.vscode/launch.jsonfile now usesvim.snippetto pre-fill the boilerplate. The file will also contain a$schemadefinition linking to dapconfig-schema to get diagnostics and completion support if usingvscode-json-languageserver. -
Improved the error message shown when the
.vscode/launch.jsonfile doesn't contain valid JSON.
utils
- Added a
splitstrfunction which can be used to parse command arguments. Opposed tovim.splitit preserves whitespace within quotes. See:help dap.utils.splitstr.
0.8.0
What's Changed
This is mostly a maintenance release, with a couple of smaller additions and
some fixes.
This is the last release to support nvim-0.8.
The supported versions will be bumped to latest nightly (0.11), latest
stable (0.10.x) and 0.9.5 after this release.
DAP compliance fixes:
- Fixed the casing of
clientIDandclientNamein theinitializerequest. - The sequence number now starts at 1 for compatibility with debug adapters
like ansibug widgets.hover()now setshoveras context in evaluate requests, instead
ofrepl
Features, Extensibility, UI improvements
-
Added a health check. This should help find common configuration mistakes
like using~within thecommanddefinition of an adapter. -
Added an option to override the output handler. See
on_outputunder:help dap.defaults. -
Added
dap.utils.pick_fileand a corresponding configuration variable
${command:pickFile}. This can be used in configurations to prompt for
executable files within the current working folder. -
dap.utils.processnow cancels the start of the debug session if you discard
the process dialog. -
The different widgets will now emit a message if you try to expand an item
that has no children. -
The
REPLand floating windows widgets now havenowrapset by default. If
you don't like that you can create adap-replordap-floatftpluginto
override the setting. -
Improved the error handling in various locations to give better feedback in
case you're holding it wrong. -
Tweaked how executable adapters are terminated. This should avoid warnings or
errors with adapters likegdbwho don't like having the theiriochannel
get closed early. -
Added an option to configure the wait timeout for
pipeadapters. -
The internal
threadscache is now updated at most once per stopped events.
This should solve performance issues when debugging a application with lots
of threads.
launch.json
- Inputs are now only evaluated at most once per use of the configuration's entry.
dap-repl
- Fixed an issue that caused
v:countto be ignored withG - Auto-scroll is now only activated on
0GorG
0.7.0
What's Changed
Core
- Added support for domain sockets/named pipes. See
:help dap-adapterfor
more information. An example of how it can be used:
local dap = require("dap")
dap.adapters.cmake = {
type = "pipe",
pipe = "${pipe}",
executable = {
command = "cmake",
args = {"--debugger", "--debugger-pipe", "${pipe}"}
}
}
dap.configurations.cmake = {
{
name = "Build",
type = "cmake",
request = "launch",
}
}- Adapters used with type=server and an executable will now receive a
sigterm
signal after the connection closes. This should ensure that there are no
process leaks. - Debug adapters are no longer terminated if there is a debug session active
when exiting vim and the debug session has a configuration with
request=attach. This avoids terminating processes that were started outside
of neovim. - If the debug adapter stops at a breakpoint, and the buffer containing the
breakpoint is already open in a window, the window is now focused, unless the
active window contains the REPL. - If the debug adapter stops at a breakpoint,
switchbufis set touseopen
orusetab, and the same buffer is open in multiple windows, the focused
window is now prioritized and will change to the breakpoint location. - Added some error handling improvements: Debug adapters exiting with a code
not equal to 0 will return in a warning, and errors in configurations should
now always propagate. - Increased the priority of the signs, to make sure breakpoints are shown even
if neovim diagnostics are present. - Added a dap.ABORT value that can be used in configurations to abort the start
of a session. This can be useful in combination with input prompts.
REPL
- If using the arrow up/down keys, the cursor is now moved to the end of the line
- Exposed a
repl.executefunction, to execute text as if entered in the REPL.
This can be used in a mapping to evaluate a variable under the cursor, for
example:
vim.keymap.set("n", "<leader>di", function()
dap.repl.open()
dap.repl.execute(vim.fn.expand("<cexpr>"))
end)- The REPL history is now no longer cleared when starting a new session, but
there is now a maximum size of 100 entries. - The REPL should no longer loose focus on breakpoint stopped events.
- Fixed an issue in the completion omnifunc implementation that could lead to
inserting duplicate words. For example-exec b some|completed to-exec b -exec b some_function()instead of-exec b some_function() - Fixed some rendering issues that could lead to empty prompts interleaved in
the output. - Variables marked as "lazy" by the debug adapter are now automatically
resolved when expanding children to avoid having to expand them twice to see
the full value.
Widgets
- Added a
listeneroption to thepreviewwidget - Fixed some issues that could cause floating windows to not close when
selecting an item - e.g in the frames or threads views. - Some more widgets will now show some information instead of being empty if
there is no data available. - The
hoverwidget will now always evaluate an expression, instead of looking
it up in the loaded variables. - Variables marked as "lazy" by the debug adapter are now automatically
resolved when expanding children to avoid having to expand them twice to see
the full value. - The
winoptsof widgets now accept atitleoption. - Calling
.toggle()on a widget multiple times should no longer append new
text each time, but replace the contents.
New Contributors
- @wookayin made their first contribution in #951
- @atouminet made their first contribution in #942
- @lervag made their first contribution in #974
- @MariaSolOs made their first contribution in #994
- @entropitor made their first contribution in #1016
- @NSteinhoff made their first contribution in #1024
- @Aeceon made their first contribution in #969
- @TheLeoP made their first contribution in #1043
Full Changelog: 0.6.0...0.7.0
0.6.0
🐰🥚
What's Changed
-
Some improvements around
startDebuggingthat should enable debug-adapters with atype=server+executableadapter definition to just work, without requiring extra logic in a adapter factory function. This enables vscode-js-debug support. See Debug Adapter Installation. (#877, #913) -
Fixed some regressions introduced by the multi-session support. (#879, #882, #906)
-
Fixed a race condition that could cause
run_to_cursorto fail if the session changed during its operation. -
Fixed lines in scope widget going under a wrong group (#889)
-
Changed the stop handling to jump to the top frame if the same thread is already marked as stopped. This can be the case if the execution was resumed using a debug adapter specific REPL command instead of one of the
nvim-dapstep/continue commands. (#901) -
Added a filter option to
pick_process
New Contributors
- @ktakiman made their first contribution in #889
- @ArtAndreev made their first contribution in #900
Full Changelog: 0.5.0...0.6.0
0.5.0
What's Changed
General
-
Added support for running multiple debugging session in parallel. This is
useful if you want to debug both a server application and a client. In this
initial version breakpoints are broadcast to all sessions, and whenever a
session emits astoppedevent, this session will get focused. This should
allow immediate inspection of variables and stepping from client to server
and vice versa. There is also a newsessionswidget that shows active
sessions.To start a second debug session you have to call
continue({ new = true })
orrun(config)with a configuration that has a different name than the
current active session, or withrun(config, { new = true }).For plugins or customizations that use listeners, keep in mind that if you
receive aterminatedordisconnectcommand, there can now still be other
sessions running.For an example of an advanced use-case using this capability, see Debugging
Neovim with Neovim and nvim-dap -
Added
startDebuggingsupport. This will enable support for debugging python
applications using multiprocessing withdebugpy, once support for it is
released indebugpyitself. The currentdebugpyversion 1.6.6 does not
support it but you can already try it using a version installed via git from
their main branch. This includes use-cases like debugging Django, Flask or
Celery with reload enabled.This should also enable support for vscode-js-debug once
startDebuggingis implemented in it as well. -
Some resiliency improvements around terminating sessions. In some cases
callbacks and listeners weren't triggered, and some late messages weren't
processed. -
Added support for the
restartproperty in a terminated event. This allows
debug adapters to restart a debug session. -
up()anddown()now no longer flip around at the top or bottom. -
Changed the REPL buffer to have
buflisted=false. -
Added the
supportsProgressReportingcapability. By default progress report
events sent from the debug adapter are shown via thestatus()function. The
main intention is to give users and plugins the capability to subscribe to
those events via the listeners and customize the progress reporting display.
launch.json
- Added support for underscores within the name of
${input}variables - Added support for { label: ..., value: } options in
pickString${input}variables.
Fixes
- Fixed an issue that caused defunct processes when using the
serveradapter type with anexecutable. - Fixed a regression that caused jumping to a frame where the source must be fetched to fail.
- Fixed handling of
outputevents. The REPL should now no longer break up lines at arbitrary places.
New Contributors
- @feoh made their first contribution in #834
- @mrcjkb made their first contribution in #855
- @cryptomilk made their first contribution in #873
Full Changelog: 0.4.0...0.5.0
0.4.0
What's Changed
General
- Dropped support for Neovim 0.6.x
- Removed deprecated functions from dap.utils
- Exception breakpoint information is now reported via the
vim.diagnostic
interface instead of writing the information to the REPL. Continueand step functions can now be called with a count to execute
multiple steps or continue several times automatically.- Changed the behavior for the window selection when jumping to a frame when a
breakpoint has been hit. Added a newswitchbufsetting derived from the
global Neovim'switchbuf'setting that can be used to change the behavior
to some degree. - Added autoscroll to the REPL. This behaves similarly to autoscroll in
terminal buffers. If you're at the end of the buffer (e.g. callingG) it
will activate, leaving the buffer while not at the end will disable it.
New functions
- Added a
focus_framefunction which allows to focus the current frame while
stopped at a breakpoint. - Added a
restart_framefunction which allows to reset the execution of the
current frame and restart it if the debug adapter supports it. - Added a
.clearcommand to the REPL.
Configurations
- Added support for a
${command:pickProcess}variable - Added support for
${env:<NAME>}variables. - Added support for
__callmetatables on configurations. This allows to
dynamically resolve multiple properties when a configuration is used. This
can be useful if you use something likevim.fn.inputto compute one
property and you're able to infer a second property from this input.
launch.json
- Added basic templating support. Creating a new
.vscode/launch.jsonfile now
adds the basic boilerplate. - Saving a
.vscode/launch.jsonfile now auto applies the configurations. - Added support for system specific
osx,windowsorlinuxproperties.
This allows users to use different properties depending on the system, for
example:
{
"type": "cppdbg",
"request": "launch",
"name": "Launch CPP",
"MIMode": "gdb",
"linux": {
"miDebuggerPath": "/usr/bin/gdb"
},
"windows": {
"miDebuggerPath": "C:\\MinGw\\bin\\gdb.exe"
}
}UI widgets
- The same type of UI widget can now be opened multiple times
- Floating widgets with auto resize when expanding variables will no longer try
to auto-resize if converted from float to regular window
New Contributors
- @ANtlord made their first contribution in #696
- @farhanmustar made their first contribution in #719
- @jedrzejboczar made their first contribution in #724
- @cladera made their first contribution in #723
- @ldelossa made their first contribution in #779
Full Changelog: 0.3.0...0.4.0
0.3.0
-
Increased the amount of connect retries when connecting to a debug-adapter of type
serverand exposed a setting to change the number of retries. This should help with debug adapters likecodelldbwhere you spawn an executable that starts a service listening on TCP. It may take a while for that service to become available and the connect attempt could initially fail. -
Added support for custom
inputsinvscode/launch.jsonfiles. See:help dap-launch.jsonfor details. -
Exposed a
json_decodefunction indap.ext.vscodeto allow users to override it with alternative json parsers. This can be used to hook in a JSON5 parser for better compatibility with Microsoft JSON. -
Added support for customizing the sign symbols before calling
require('dap'). Previously it was necessary to callsign_defineafter having imported thedapmodule. -
Improved the handling of error messages sent by debug adapters.
-
The
DapStoppedhighlight is now cleared when usingdap.close(). -
Added a
DapLoadLaunchJSONcommand that maps torequire('dap.ext.vscode').load_launchjs()
0.2.0
-
Improved the handling of disconnects. Previously if a user invoked terminate or disconnect multiple times, it would terminate or disconnect the session with the first invocation and the remaining invocations would eventually timeout. This timeout could cause a new session started later to disconnect as well, leading to an inconsistent state and unusable session.
-
Stepping operations (
step_out,step_into,step_over..) will now prompt for a thread to resume if there is no stopped thread in focus and if other threads are paused. This can be the case if either, threads were manually paused or if theauto_continue_if_many_stoppedoption is set to false. See Demo -
Functions used in configurations (
:h dap-configuration) can now also returncoroutine/threadvalues. This allows to use asynchronous operations to compute values to use in the configuration. There are some constraints:- The function must return a suspended
coroutine. - The function must eventually hand back control to
nvim-dapby resuming the outercoroutinewith the result. If it fails to do so, the launch-session operation will become stuck.
An example:
foo = function() return coroutine.create(function(dap_run_co) local items = {'one', 'two'} vim.ui.select(items, { label = 'foo> '}, function(choice) coroutine.resume(dap_run_co, choice) end) end) end,
- The function must return a suspended
-
The
pick_processhelper function which can be used in configurations to select a running process is now usingvim.ui.selectinstead ofinputlist. -
Added a
dap-typevariable to the integrated terminal buffer. Thisdap-typevariable contains the value of the:h dap-configurationtype. -
Added support for the
breakpointevent withreason = 'changed'to allow debug adapters to change the verified state of breakpoints.
Widgets
-
The
hoverwidget will now by default evaluate the selected expression if in visual mode. This makes it possible to define keymaps likevim.keymap.set('v', '<leader>dh', require('dap.ui.widgets').hover). Therequire("dap.utils").get_visual_selection_textfunction which could be used before to get a similar behavior is now deprecated. -
Added a new
previewwidget that can be used to show the values of variables in the preview window. You can create a mapping likevim.keymap.set({'n', 'v'}, '<leader>dp', require('dap.ui.widgets').preview)to use it. -
The
presentationHint.lazyflag is now recognized in widgets rendering variables. This has the effect that lazy variables no longer take an extra line when loaded but instead the existing line is updated in-place.
REPL
- Evaluating expressions in the REPL should no longer render a
dap>prompt between the first line of the result and subsequent lines.
0.1.0
Initial release
After almost 400 commits and more than 2 years it's time