Commit Graph

18 Commits (d45637782139c74c25597e6ed7c18e7b2fc96b3c)

Author SHA1 Message Date
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