Commit Graph

21 Commits (ac7bd40eeaa73445126b4f8b697c78dff8c3c13f)

Author SHA1 Message Date
Jason Williams 2338b44909
DAP: Support the startDebugging reverse request (#13403) 2025-06-23 09:48:05 -05:00
Michael Davis 8d2870b94a
Reuse content buffer in JSONRPC recv for LSP and DAP
Previously `recv` for new messages from the language server or debug
adapter allocated a fresh Vec for each message. Instead we can reuse
the buffer. This resolves TODO comments.

Co-authored-by: Rolo <roloedits@gmail.com>
2025-06-06 10:19:33 -04:00
Michael Davis 26db54155e
DAP: Drain pending requests on recv failure
This matches <https://redirect.github.com/helix-editor/helix/pull/4852>
for the DAP transport: when there is a failure to receive a message from
the debugger we should drain all pending requests and respond to them
with the StreamClosed error.

This improves the behavior when a debugger fails to initialize, for
example starting debugpy without debugpy installed. Previously the UI
would freeze until the request timed out. Now it instantly prints a
statusline error saying that the debugger failed to start up.
2025-02-04 09:09:54 -05:00
Michael Davis fec5101a41
DAP: Refactor handling of Event and Request protocol types
This change refactors the DAP `Event` type, the `helix_dap` module and
the `helix_dap::transport` module to be closer to the equivalent
implementations in `helix_lsp`. The DAP `Event` type is similar to LSP's
`Notification` so this change rewrites the enum as a trait which is
implemented by empty types (for example `enum Initialized {}`).

`Event` is then reintroduced as an enum in `helix_dap` with a helper
function to convert from the `Event` as the transport knows it. By
separating the definitions of `Event` between lib and transport, we can
handle incoming events which are not known to our `Event` enum. For
example debugpy sends `"debugpySockets"` which is unknown. With this
change, unknown events are discarded with an info-level log message.

The `Request` type was already a trait but did not have an enum with the
known values. This change also introduces a `helix_dap::Request` enum
similar to `helix_dap::Event`. This resolves a TODO comment about
avoiding `unwrap` when parsing the request's arguments.
2025-01-27 15:27:35 -05:00
A-Walrus 8839eb0af4
Fix unwrap bug in DAP (#6786) 2023-04-17 15:36:04 -05:00
Blaž Hrastnik c2c1280f02
Resolve a bunch of upcoming clippy lints 2022-11-04 21:06:28 +09:00
Blaž Hrastnik bd549d8a20 Merge remote-tracking branch 'origin/master' into debug 2022-02-13 18:31:51 +09:00
Blaž Hrastnik 5545f8ebb5 dap: Add RunInTerminal reverse request, support replying to requests 2021-12-03 16:09:28 +09:00
Blaž Hrastnik ea59f77a6b Port over parsing improvements from the LSP
We need to terminate if we ever read 0 bytes which indicates closed
stream.
2021-10-17 13:54:47 +09:00
Blaž Hrastnik 7b61c63ece Handle stderr 2021-09-03 13:26:30 +09:00
Blaž Hrastnik 28658836ee Add more event types, simplify event decoding 2021-08-22 16:05:12 +09:00
Blaž Hrastnik d39baa3b4e Start integrating into the editor's event loop 2021-08-20 13:48:32 +09:00
Blaž Hrastnik 0300dbdeb3 Avoid cloning a request on send 2021-08-20 13:43:54 +09:00
Dmitry Sharshakov 279db98d3c refactor: use tagged enum for handling DAP payloads 2021-08-20 13:43:54 +09:00
Dmitry Sharshakov c5492788a2 compat: remove seq from Response and Event 2021-08-20 13:43:54 +09:00
Dmitry Sharshakov 59d6b92e5b refactor response processing 2021-08-20 13:43:54 +09:00
Dmitry Sharshakov 9678df1c62 refactor server message handling 2021-08-20 13:43:54 +09:00
Dmitry Sharshakov 26a55dcefd dap: make transport IO-agnostic 2021-08-20 13:43:54 +09:00
Dmitry Sharshakov 5fd0a2ddda format 2021-08-20 13:43:54 +09:00
Dmitry Sharshakov fd709bc56d dap: logging using fern 2021-08-20 13:43:54 +09:00
Dmitry Sharshakov 0f6e81b85b Initial debug adapter protocol implementation 2021-08-20 13:43:54 +09:00