Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add debugger support #739

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

theSuess
Copy link

@theSuess theSuess commented Dec 28, 2023

This PR adds an extension point for future debugger implementations.

We first investigated having the entire debugger codebase only use go-jsonnet as a dependency, but many of the fields and types needed to implement this are not exposed to external packages.

To solve this, we added a new Debugger type, which allows debugging frontends to control the evaluation of a specific file.

The API type is heavily inspired by the Debug Adapter Protocol and can be used to implement basic debugging functionality like:

  • Stepping through evaluation
  • Setting Breakpoints
  • Automatically breaking on exceptions
  • Viewing a rudimentary stack trace
  • Inspecting variables at runtime

Example implementations of clients using this interface can be found in the example-clients branch of our fork.

The following recording shows the basic capabilities in action by using the DAP example client with VSCode:

dap.mp4

@theSuess theSuess marked this pull request as ready for review December 28, 2023 08:26
@theSuess
Copy link
Author

We have released an implementation of the example client as a standalone package at grafana/jsonnet-debugger.

It is also integrated into the latest version of our vscode-jsonnet extension.

The debugger uses the grafana/go-jsonnet-debugger fork to implement the functionality until the PR is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant