bhoov / manim-notebook

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

Consider multi-line Python statements for start scene #25

Open Splines opened 4 hours ago

Splines commented 4 hours 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 3 hours 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 3 hours ago

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