Library to generate DAP protocol code for gen_dap.
For DAP code generation:
elixir -e 'Mix.install([{:dap_codegen, github: "elixir-lsp/dap_codegen"}]); DAPCodegen.generate(System.argv())' -- --path ./path/for/files
To update the debugAdapterProtocol.json, you can run the following:
curl --location 'https://microsoft.github.io/debug-adapter-protocol/debugAdapterProtocol.json' | jq . > priv/debugAdapterProtocol.json
A request in the Debug Adapter Protocol (DAP) is a message sent from the client (IDE) to the debug adapter. It typically includes the following features: Type: The type of message, which is always "request". Seq: A sequence number to identify the message. Command: The specific command being requested (e.g., "initialize", "launch"). Arguments: A set of parameters required for the command.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"type": { "type": "string", "enum": ["request"] },
"seq": { "type": "integer" },
"command": { "type": "string" },
"arguments": { "type": [ "array", "boolean", "integer", "null", "number" , "object", "string" ] }
},
"required": ["type", "seq", "command"]
}
An event is a notification sent from the debug adapter to the client, indicating a change in state or an occurrence of interest.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"type": { "type": "string", "enum": ["event"] },
"seq": { "type": "integer" },
"event": { "type": "string" },
"body": { "type": [ "array", "boolean", "integer", "null", "number" , "object", "string" ] }
},
"required": ["type", "seq", "event"]
}
A response is sent from the debug adapter back to the client in reply to a request.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"type": { "type": "string", "enum": ["response"] },
"seq": { "type": "integer" },
"request_seq": { "type": "integer" },
"success": { "type": "boolean" },
"command": { "type": "string" },
"message": { "type": "string" },
"body": { "type": [ "array", "boolean", "integer", "null", "number" , "object", "string" ] }
},
"required": ["type", "seq", "request_seq", "success", "command"]
}
An error response indicates that a request could not be processed successfully.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"type": { "type": "string", "enum": ["response"] },
"seq": { "type": "integer" },
"request_seq": { "type": "integer" },
"success": { "type": "boolean", "enum": [false] },
"command": { "type": "string" },
"body": {
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"id": { "type": "integer" },
"format": { "type": "string" }
"variables": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"sendTelemetry": {
"type": "boolean"
},
"showUser": {
"type": "boolean"
},
"url": {
"type": "string"
},
"urlLabel": {
"type": "string"
}
},
"required": ["id", "format"]
}
},
"required": ["error"]
}
},
"required": ["type", "seq", "request_seq", "success", "command", "body"]
}
This library is inspired by lsp_codegen by Mitchell Hanberg.