Manim-Notebook / manim-notebook

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

Consider multi-line Python statements for start scene #25

Open Splines opened 1 week ago

Splines commented 1 week ago

With the behavior introduced in #17, via the Start scene at cursor command, the scene is started at the line of the cursor (or the whole scene is previewed when the cursor is at a class statement).

This might be problematic when one Python statement is spread over multiple lines. Manim will then fail and the user might not even notice if they don't have their terminal open.

Options to resolve this and more details are provided in this comment:

  1. Propagate this error to the user in a vscode notification
  2. Implement logic to detect the end of the python expression on the selected line

Where the first option would probably be easier to implement. Maybe one could also just open the terminal if an error is encountered?

VladimirFokow commented 1 week ago

(option 1) :

But how to detect if there was an error? -

Get the output from the ipython terminal via the VSCode API, and see if it's red / or contains substring that indicates this error?

Splines commented 1 week ago

I was able to get the stream of an already running terminal with this code.
(The code there is really bad, it's just my first attempts to get anything related to the progress indicator to work).

bhoov commented 1 week ago

I agree with this comment that we can treat this as an issue for future development. For v0.1.0, we can assume that users are viewing a terminal and can see the error.