This module contains the core logic for handling DAP requests sent by DAP clients which are most
commonly IDE extensions controlled interactivly by a progammer. The main entry point is da_server/1.
The implementation is most dominently guided by the DAP
specification.
- da_server(+Options) is det
- Starts the DAP server in the current thread. Options:
- in(+Stream)
- Stream will be used by the server to read incoming messages from the client. Defaults to
user_input
.
- out(+Stream)
- Stream will be used by the server to emit outgoing messages to the client. Defaults to
user_output
.
- setup(:Setup)
- Setup will be called just before entering the main DAP server loop. Defaults to
true
.
- on_command(:OnCommand)
- OnCommand is a closure of arity 6 which will be called during the DAP session loop
to handle incoming DAP request, like so:
call(OnCommand, +Command, +Arguments, +RequestSeq, +Handle, +State0, -State)
Where:
- Command is an atom identyfing the type of the DAP request, e.g.
stepIn
.
- Arguments is either the atom
null
or a dict containing Command -specific parameters.
- RequestSeq is an integer identifying the received request in the scope of the current session.
- Handle can be used to with the predicates from module
da_sdk
to
communicate DAP messages (including the response for the handled command) back to the client.
- State0 and State can be used to pass arbitrary terms between invocations of OnCommand
during the course of a DAP session. The session loop will initially call OnCommand with
State0 bound to an initial state term determined by the
initial_state
option of this
predicate, in the next invocation State0 will be bound to the State argument of the prior
invocation, and so forth.
- cleanup(:Cleanup)
- Cleanup will be called after the main DAP server loop completes. Defaults to
true
.
- initial_state(+State)
- State will be used as the initial state argument passed to OnCommand. Defaults to [].