if a sign is already set in some user config we do not overwrite the
value and skip it. This enables sign configuration by the user
regardless where the user requires the dap plugin
Error messages reported by `error` or `assert` calls could go unnoticed
depending on the `vim.ui.select` implementation.
Scheduling the callback should avoid that.
If running within a coroutine the callback argument can now be omitted
to get the result as return value.
This can be utilized to avoid nesting via multiple callbacks if a method
requires multiple requests.
Makes sure `vim.keymap.set('v', lhs, require('dap.ui.widgets').hover)`
works as expected and makes it unnecessary to use something like this
instead:
[[<ESC><CMD>lua require'dap.ui.widgets'.hover(require("dap.utils").get_visual_selection_text)<CR>]]
This can be used by scripts or similar to process the terminal buffers
output depending on the config type. If a session ended, the information
is otherwise no longer available.
For example, one could parse the output of `python unittest` into the
quickfix list with something like this:
local efms = {
python = [[%C %.%#,%A File "%f"\, line %l%.%#,%Z%[%^ ]%\@=%m]],
}
function M.load()
local buf = api.nvim_get_current_buf()
local ft = vim.b[buf]['dap-type'] or vim.bo.filetype
local efm = efms[ft] or vim.bo.errorformat or vim.g.errorformat
local lines = api.nvim_buf_get_lines(buf, 0, -1, true)
vim.fn.setqflist({}, 'r', { efm = efm, lines = lines })
end
If a user called disconnect multiple times and then started a new
session, the disconnect callback would fire after a timeout and close
the new session, leaving the client in a inconsistent state.
Also removes a duplicate test case
This would allow using stuff like `vim.ui.select` within the
configuration values.
The requirements are:
- The function must return a coroutine
- The coroutine must resume the **outer** coroutine with the result
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,
```
If you position the cursor over a variable in anticipation of hitting
the breakpoint to inspect it, it's a bit annoying if it jumps to the
first column.
This makes the adapter definition for adapters that don't support STDIO
but only TCP a bit easier. For example, for delve it reduces the adapter
definition to:
dap.adapters.delve = {
type = 'server',
port = '${port}',
executable = {
command = 'dlv',
args = {'dap', '-l', '127.0.0.1:${port}'},
}
}
Debugging something and deleting the terminal buffer before the
process exits caused `Invalid channel id` errors because the output of
the process can no longer be sent to the terminal buffer.
This mutes the messages.