Description
🎈 Motivation
We have introduced the concept of Manim Cells in our extension to ease previewing certain parts of the code. However, what we might really want is a fully-featured debugger that is way more flexible than such cells.
💠 Feature
Imagine you could step through Manim animations like you can step through your Node.js code via the in-built Node.js debugger:
Such an Manim Animation Debugger (MAD) would be amazing:
- Set a breakpoint anywhere to pause the animation
- Preview until the next breakpoint. This would replace/complement Manim Cells.
- Preview the animation line by line.
(Maybe even "scrub" through the code, i.e. consider it a vertical video timeline. However, the native VSCode Debugger does not support this.)
Implementation
I would guess that a feature like this would constitute an XXXL PR. I have no clue if this is even possible with the VSCode API. Here are some first links to get some ideas and maybe possible APIs we could make use of:
- Guide for Debugger Extensions. This is usually meant to contribute a new debugger for a language, e.g. a Python debugger. It seems to be the most promising extension contribution point since we could leverage the in-built VSCode debugger functionality.
- Custom Editor API. However, I have no ambitions in rewriting the VSCode editor as a custom webview via HTML/CSS/JS. This would give us every flexibility we need, but users will miss lots of features that the VSCode team put into the text editor itself. And supporting a complete text editor is not at all the scope of the Manim Notebook extension.
- Decoration Render Options
Further considerations:
- If we go for the debugger route, consider somehow hooking into the existing Python debugger such that we could still display useful information like variable names and their values in the sidepane etc.
- In the background, we could add a Manim Checkpoint to every single line of the
construct()
method such that users can really step through it line by line. Otherwise, Manim might not correctly cache the scene states.