-
Notifications
You must be signed in to change notification settings - Fork 3
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
Introduce Manim Shell abstraction to preview terminal-free #30
Conversation
This fixes some weird dependencies between startScene() and the ManimShell and avoids recursion.
wow!😮
a great possibility that this PR opens! |
I am going through this PR -- it's a doozy. @Splines you continue to impress 💪 I will edit this comment as I go through your code and think of small improvements. All features mentioned in this comment are not critical to me approving this PR.
Overall, I find this PR a HUGE usability improvement over the previous version. And, because several other huge QoL PRs depend on this one, I vote to merge this in to get the pipeline moving forward. Let me quickly go through the code to make sure I understand everything. @Splines your coding standards are far higher than mine, so expect few if any stylistic comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly approve. Let's merge.
Closes #24.
In this PR we introduce an additional abstraction layer for the so-called
ManimShell
. This word means a VSCode Terminal that has a running Manim sessinon (IPython session). The notion of "just a terminal", without a running Manim session, is not needed, as we always ensure that commands are run inside an active Manim session.With this new abstraction layer, that provides methods like
executeCommand()
, we fully capture the output of Manim inside the IPython session and react accordingly. This allows us to implement many niceties in this PR:checkpoint_paste()
etc.checkpoint_paste()
.The best thing: new users just have to have
manimgl
installed, and that's it. Then they click onPreview Manim Cell
and it should automatically work. Look at the video in #33 to see how everything comes together.Known limitations
Note that
lockDuringStartup
is NOT doing what is described in [bug] Quits if "Preview Manim Cell" before it finishes #16, instead it only locks the startup of a new scene, not the complete command execution.Some Implementation details
So this one PR took me quite a while, it was very hard to figure out how the VSCode extension APIs worked and how to actually read the data stream (and then those anoying ANSI escape chars 🙄). In
ManimShell
, there's kind of a lot going on. When reviewing it's probably a good idea to start at theinitiateTerminalDataReading()
method.manimShell.ts
for regex that are used to match specific events like the end of a cell execution.async
. Just because the method is markedasync
does not mean we actually wait until the end of the command execution. Sometimes it suffices to wait for other events inside the method. This should be noted accordingly in docstrings.command executes -> scene not spawned yet -> new scene spawn is triggered -> command is executed in newly spawned Manim session
might be a bit hard to follow through in the code due to howstartScene()
is used when invoked via the command palette as well as when requested when we actually want to execute another command (seeretrieveOrInitActiveShell()
). The debugger might greatly help here.