Commit graph

638 commits

Author SHA1 Message Date
Mathias Fussenegger
ef44e4784e Increase chance to trigger request callbacks on debug adapter exit
If the client sends a terminate the debug adapter can send the response,
terminate event and terminate the debug adapter process. In that case
the client immediately closed the stdout handle and cleared the message
callbacks table, preventing it from reliably processing the last few
messages.

This makes use of the async stdout:shutdown/client:shutdown to give it a
chance to process these last messages.

This is a follow up to
03807a4682
and should ensure that event_terminated listeners triggers happen in
most (all?) cases.
2023-01-14 13:15:31 +01:00
Mathias Fussenegger
67ef9a5d07 Remove vim.json compatibility layer
vim.json exists in all supported versions
2023-01-14 10:04:09 +01:00
Mathias Fussenegger
0a6a8e2da3 Remove deprecated dap.omnifunc 2023-01-14 10:04:09 +01:00
Mathias Fussenegger
03807a4682 Make terminate callback trigger more resilient
A debug adapter could exit the process before the client had an
opportunity to process the terminated response and event. In that case
`terminate` will timeout. The callback to `dap.terminate` should still
get triggered
2023-01-14 10:01:24 +01:00
Mathias Fussenegger
50e203723d Clear stale closed session on terminate 2023-01-14 10:01:24 +01:00
Mathias Fussenegger
69e01ae8c8 Clear main session via on_close hook
This moves the ownership of the global session to the dap module.
Once multiple/hierarchical sessions are supported it is no longer safe
to reset the global session from within a session. It could cause a
child session to clear the reference to a parent session.
2023-01-14 10:01:24 +01:00
Mathias Fussenegger
00562db954 Add type annotations for listeners 2023-01-14 10:01:24 +01:00
Mathias Fussenegger
a7aebe97e9 Clear messages in Session:close instead of transport close 2023-01-14 08:30:28 +01:00
Mathias Fussenegger
266a3bc9e7 Add namespace pool and use per-session namespace for signs/diagnostic
In preparation for multiple/hiearhical sessions which will be required
for the `startDebugging` reverse request.

With a global namespace we'd clear signs and diagnostics of all sessions
if one exits. That's a problem.
2023-01-14 08:30:28 +01:00
Axel Dahlberg
b8201fd104
Use switchbuf setting instead of global variable as default (#818) 2023-01-12 20:44:09 +01:00
Mathias Fussenegger
700a3c7d6f Fix hover and threads widget name conflicts 2023-01-08 09:52:48 +01:00
Mathias Fussenegger
1077a86c83 Use utils.fmt_error in goto error notification 2023-01-05 12:21:16 +01:00
Mathias Fussenegger
a9f21a2093 Add autoscroll for the REPL
Closes https://github.com/mfussenegger/nvim-dap/issues/640
2023-01-05 12:14:28 +01:00
Mathias Fussenegger
be73a0be5c Add a focus_frame function
Closes https://github.com/mfussenegger/nvim-dap/issues/796
2023-01-05 10:51:02 +01:00
Mathias Fussenegger
4902566da4 Add switchbuf setting to control jump to breakpoint behavior
Follow up to https://github.com/mfussenegger/nvim-dap/pull/789

Should close:

- https://github.com/mfussenegger/nvim-dap/issues/793
- https://github.com/mfussenegger/nvim-dap/issues/676
2023-01-05 10:25:29 +01:00
Mathias Fussenegger
0f482cad01 Make dap.utils import in dap.lua lazy 2023-01-04 14:41:45 +01:00
Rónán Carrigan
2bb4827658
Pass request seq number to listeners (#798)
Allows users to distinguish between their own requests and other
requests when listening.

The motiviation for this is that nvim-dap maintains some state
internally for its functionality (e.g. session.current_frame) which
nvim-dap-ui needs to be aware of so users don't have issues with the two
plugins showing different information. Some of this state is set after
requests such as `stackTrace` for the current frame. nvim-dap-ui needs
to listen for this and refresh after it has been processed. Issues arise
when the listener causes more stack trace requests, leading to infinite
recursive calls because the listener can't distinguish between calls
made by nvim-dap and itself.

This is occurring now because of a large refactor of nvim-dap-ui which
moves away from maintaining state (which previously used the nvim-dap
request result) to making direct calls to the debugging adapter for all
data.
2023-01-04 13:24:21 +01:00
Mathias Fussenegger
69b7c684cd Support system specific properties in launch.json
Closes https://github.com/mfussenegger/nvim-dap/issues/794
2022-12-31 15:39:44 +01:00
Mathias Fussenegger
dc69846b0b Support calling continue and step with a count
Closes https://github.com/mfussenegger/nvim-dap/issues/797
2022-12-31 14:09:23 +01:00
Mathias Fussenegger
6f2ea9e33b Make jump to stopped location more aggressive
- Allow to switch current tabpage if the buffer is open in another tab
- Change current active window/buffer, if all else failed instead of
  printing a warning
2022-12-21 18:49:37 +01:00
Mathias Fussenegger
284c754f60 Stop resizing widgets if converted to non-float window 2022-12-19 18:57:09 +01:00
Mathias Fussenegger
3971d9b665 Allow opening multiple frames or scopes widgets 2022-12-19 18:54:01 +01:00
Louis DeLosSantos
68d9687111
Fix invalid buffer error on session.close/diagnostic reset (#779)
Swapping the session close and the reset of the namespace should fix the following error:

```
Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/diagnostic.lua:1458: Invalid buffer id: 22
stack traceback:
        [C]: in function 'nvim_exec_autocmds'
        /usr/share/nvim/runtime/lua/vim/diagnostic.lua:1458: in function 'reset'
        /home/louis/.config/nvim/after/nvim-dap/lua/dap/session.lua:1399: in function 'close'
        /home/louis/.config/nvim/after/nvim-dap/lua/dap/session.lua:703: in function 'callback'
        /home/louis/.config/nvim/after/nvim-dap/lua/dap/session.lua:958: in function </home/louis/.config/nvim/after/nvim-dap/lua/dap/session.lua:950>
```

Signed-off-by: Louis DeLosSantos <louis.delos@gmail.com>
2022-12-12 18:48:27 +01:00
Mathias Fussenegger
a8fd28aec4 Add type annotations to code examples in docs 2022-12-09 13:57:40 +01:00
Mathias Fussenegger
3440b0df4c Add dedicated documentation for the dap.defaults settings 2022-12-09 13:57:40 +01:00
Carlos Galan Cladera
8f396b7836
Handle nvim_buf_set_name failure when setting terminal name (#723)
Set terminal dap buffer name with protected call. If setting
buffer name fails, use a placeholder.

Fixes #722
2022-12-01 12:18:04 +01:00
Mathias Fussenegger
f0573ea26f Add assert for config __call result 2022-11-28 21:45:44 +01:00
Mathias Fussenegger
be1b630776 Show reason in frames widget if no frames available 2022-11-28 21:45:44 +01:00
Mathias Fussenegger
87572115d8 Support __call metatable on configuration 2022-11-28 21:30:40 +01:00
Mathias Fussenegger
2f91672647 Handle nil context in ui trigger_actions 2022-11-28 21:07:18 +01:00
Mathias Fussenegger
bb6a98781e Add some type annotations to ui module 2022-11-26 11:52:13 +01:00
Mathias Fussenegger
2b8266d8e9 Add luarc 2022-11-26 11:52:13 +01:00
Mathias Fussenegger
61643680dc Show exception info on stopped via diagnostic
So far the exception info was shown in the REPL, but users may have the
REPL closed in which case they don't see the exception details.

This instead uses the diagnostic API to add the exception details as an
error.
2022-11-05 12:42:55 +01:00
Mathias Fussenegger
6fd283f540 Check canRestart frame property in restart_frame 2022-11-04 23:01:30 +01:00
Mathias Fussenegger
ff8650d6ce Handle missing thread in auto_continue handling
There may not be a thread anymore for the `stopped_thread_id`.
That resulted in an error.

An alternative could be to reset the `stopped_thread_id` and assume it
is not stopped anymore, but not sure if that is safe.
2022-11-04 18:47:04 +01:00
Mathias Fussenegger
3d0d7312bb Inline with_win 2022-10-19 19:35:46 +02:00
Jędrzej Boczar
dcb8c8ceea Fix incorrect cursor position when opening frame from dapui 2022-10-19 19:35:46 +02:00
Mathias Fussenegger
1798c756c8 Expand config variables lazy 2022-10-19 19:29:25 +02:00
Farhan Mustar
e71da68e59
Add support for env variables reference. (#719)
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2022-10-14 20:00:25 +02:00
Mathias Fussenegger
6b12294a57 Add restart_frame function and DapRestartFrame command
Allows to restart execution of the current frame
2022-10-09 11:06:58 +02:00
Mathias Fussenegger
698e573913 Add support for ${command:pickProcess} variable 2022-10-09 10:57:59 +02:00
Mathias Fussenegger
684f57f9d6 Add templating support for launch.json and auto-load on save 2022-10-08 14:49:27 +02:00
Mathias Fussenegger
0b320f5bd4 Support neovim 0.8.0, drop 0.6.1 2022-10-01 12:00:18 +02:00
Mathias Fussenegger
5d57c401ca Fix "setting non-standard global variable action" warning
Slipped through in https://github.com/mfussenegger/nvim-dap/pull/696
2022-09-30 10:17:09 +02:00
Mathias Fussenegger
16a19525e2 Log error on missing callback and don't trigger listeners
Closes https://github.com/mfussenegger/nvim-dap/issues/699
2022-09-30 10:17:09 +02:00
ANtlord
cf94cfb61d
Change list breakpoints to create new qf-list if current isn't listing breakpoints 2022-09-29 16:41:13 +02:00
Mathias Fussenegger
2e600ca2f3 Tune feature issue template 2022-09-29 16:25:14 +02:00
Mathias Fussenegger
9368dca5b8 Add .clear repl command
Closes https://github.com/mfussenegger/nvim-dap/issues/702
2022-09-29 13:29:34 +02:00
Mathias Fussenegger
2f52569188 Remove deprecated functions from dap.utils 2022-09-29 12:20:15 +02:00
Mathias Fussenegger
764899df5c Fix nil body handling in fmt_error 2022-09-24 11:02:05 +02:00