Skip to content

Commit

Permalink
Do not send the 'body' field for DAP Initialized Event. (#1345)
Browse files Browse the repository at this point in the history
The body field is required on most DAP Events and optional on Terminated but
is actually not included in Initialized at all. Clients parsing the Events
strictly will think an Initialized Event with a body is malformed, so this
change drops the field entirely for Initialized.

https://microsoft.github.io/debug-adapter-protocol/specification#Events_Initialized
  • Loading branch information
the-mikedavis authored Jul 4, 2022
1 parent 9f70a42 commit d067267
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/els_dap/src/els_dap_protocol.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@
%%==============================================================================
%% Messaging API
%%==============================================================================
-spec event(number(), binary(), any()) -> binary().
%% TODO: Body is optional

-spec event(number(), binary(), map()) -> binary().
event(Seq, <<"initialized">> = EventType, _Body) ->
%% The initialized event has no body.
Message = #{
type => <<"event">>,
seq => Seq,
event => EventType
},
content(jsx:encode(Message));
event(Seq, EventType, Body) ->
Message = #{
type => <<"event">>,
Expand Down

0 comments on commit d067267

Please sign in to comment.