Visual Studio Code debug adapter for Datasonnet and Jsonnet
Visual Studio Code debug adapter for Datasonnet and Jsonnet
Features •
Issues •
This is a Visual Studio Code extension that adds support for debugging Datasonnet and Jsonnet scripts.
This implementation is based on the Camel VS Code Debugger
Debugging Datasonnet
This extension uses the Datasonnet Mapper to execute the scripts. You can debug and run Datasonnet and Jsonnet scripts. Datasonnet adds supports for different formats like XML, CSV and YAML, provides libraries supporting extra functionality to what Jsonnet provides, and is used primary as a mapping tool. You can check more example in its cookbook.
To debug a script, just open it on the editor and create a launch configuration. The minimal launch configuration is:
{
"type": "datasonnet",
"request": "launch",
"name": "Datasonnet - JSON",
"program": "${file}",
"fileBasename": "${fileBasename}",
}
This will run the program
. If you need to specify a payload, add:
"payload": "${workspaceFolder}/resources/payload.json",
The input content type is inferred from the file extension.
And if you need to specify an output type other than JSON, set the following type to the appropriate MIME type:
"outputType": "application/xml"
Dependencies
To be able to set breakpoints, you need to install a Datasonner Language Exstension. While we have this extension in preview, you'll need to manually install the extension from a VSIX file. The file can be found on this extension's repo
Once you have the file, you can go on VS Code to the extensions
tab, next on the ellipsis menu above to Install from VSIX
and then install the extension.
Once you have both extensions enabled, they'll look like this:
Features
- Add/Remove breakpoints
- Inspect variable values on suspended breakpoints
- Stepping
- Output is printed on the Debug Console
- You can set input and output formats ( JSON, XML, CSV )
Issues
Something is not working properly? In that case, feel free to open issues, add feature requests, report bugs, etc.