This implements a file picker, to pick the file you want to execute with
the debugger.
Fixes#1130
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
10 levels can take a huge amount of time to load, and there's currently
no way to interrupt it.
modified=false and bufhidden=wipe should make it easier to get rid of
the buffers after being done viewing the diff.
nvim-dap reports `Launching debug adapter` before evaluating a adapter
function:
progress.report('Launching debug adapter')
But that message was never shown in `dap.status()` because at that point
no session is active and `status()` returned a `''`.
If the adapter function takes a long time, it gave
the impression that nothing was happening.
Solution:
Always show the last message in `status()`, and send a `""` if a session
closes.
From the spec:
> Sequence number of the message (also known as message ID). The `seq` for
> the first message sent by a client or debug adapter is 1, and for each
> subsequent message is 1 greater than the previous message sent by that
> actor.
As described in https://github.com/mfussenegger/nvim-dap/issues/1062
Some debug adapters heavily use the lazy hint.
For example, a collapsed list is initially displayed as:
settings: ArrayList@50 size=1
That's good. But after expanding, the contained items looke like this:
settings: ArrayList@50 size=1
0: Assignment@66
Each individual item had to be expanded to show the value:
settings: ArrayList@50 size=1
0: Assignment@66 "Assignment{column='stats.jobs_log_size', expressions=[1024]}"
This removes the intermediate step, to go from:
settings: ArrayList@50 size=1
Straight to:
settings: ArrayList@50 size=1
0: Assignment@66 "Assignment{column='stats.jobs_log_size', expressions=[1024]}"
`lnum` and `end_` need to be set to `nil` when appending additional
scopes to the widget, otherwise the final scope overwrites all previous
ones. In the case of `lldb`, where you have 'Local', 'Global', and
'Registers', only the last scope 'Registers' would be drawn to the
widget.
Problem: Any exceptions thrown inside coroutine-wrapped `trigger_run`
inside `dap.run()` are silenced. Dap session won't start silently
without any error messages displayed to users.
Solution: Protect the call of `trigger_run` and show error messages with
stacktrace, if any errors happened.
Fixes#1052.
Explanation:
* REPL buffer is based on `buftype=prompt`, where nvim makes sure that
there is always a prompt at the end of buffer in insert mode (`dap> ` ).
* When a new command is entered, `exec` function in `repl.lua` is
executed (registered via `vim.fn.prompt_setcallback`). nvim does not put
the next prompt until callback returns, so, within the callback, new
lines can simply be appendend at the end of the buffer. (e.g. `.help`
command does not leave an empty prompt in the middle).
* Things get a bit tricky with expression command because when a DAP
server request comes back, nvim-dap is aldready outside of the callback,
and there is an empty prompt at the end of the buffer. Two options here
so not to leave an empty prompt in the middle,
1. insert the new line(s) right in front of the empty prompt
2. overwrite the last line with the new line(s)
* `append` function inside `repl.lua` is updated to apply the first
option. `evaluate_handler` now calls this function instead of
`layer.render` where possible.
* The second opton is used where `tree.render` is called inside
`evaluate_handler`.
For mappings like:
dap.repl.open()
dap.repl.execute(vim.fn.expand("<cexpr>"))
`widgets.hover()` is nice to zoom in on a single variable, but sometimes
you want to compare the values of several variables. Having their output
displayed in the REPL next to each other makes that easier.
When severity_sort is enabled, diagnostic sign priority can be raised
above 10 (1 per severity). And so by putting it at 21 and 22, dap
breakpoints are always shown, even when there are diagnostics
(Related to #197 )