Manim-Notebook / manim-notebook

Simple commands to replicate the manim dev workflow in VSCode
MIT License
5 stars 0 forks source link

Detect reloading of VSCode #41

Open Splines opened 5 days ago

Splines commented 5 days ago

Users can reload the VSCode window and the terminal session stays open and with this also the ManimGL Preview window. However, as described in #30 we have this known limitation:

Reloading the VSCode window while having a Manim session open, then interacting with the extension is not a supported use case. Here, the current implementation will spawn a new terminal with a completely new session instead of reusing the existing one. In this case, users can just close the old session and that's it. This shouldn't really be a limitation.

As a solution to this issue, we could get the automatic Manim detection to work even when reloading the window. This would probably involve browsing the history of a terminal to see if the Manim welcome string is included and if a IPython terminal session is running. But the question here is how we detect that this session is still in use? We could say: well, the In [42]: IPython cell string should be the last data we received from the terminal. But then we have to also deal with edge cases, e.g. when -- after the reload -- a Manim preview is still running (was started before the reload) and outputs something to the terminal (is this scenario even possible?). Another question is if it's even possible to get the terminal data stream for a terminal that was reopened since the window was reloaded.

Or we just ignore and acknowledge this as limitation. But then we might think of ways to tell the users that they should close their remaining Manim sessions when a VSCode window is reloaded. However, I would find it very annoying if a popup indicated Close remaining Manim session every time I reload a window, even though I'm not even working with anything Manim-related (just have the extension installed).