Manim-Notebook / manim-notebook

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

clipboard buffer + several improvements #5

Closed VladimirFokow closed 1 week ago

VladimirFokow commented 2 weeks ago

Addresses #3, and also makes some improvements.

Added steps 1. and 3. Now the order is:

  1. Save clipboard to buffer
  2. Set clipboard to your selection, run the command
  3. After 0.5 sec – restore the original clipboard


Also added:

VladimirFokow commented 2 weeks ago

By the way, on another branch –– I've added the run_scene command, BUT:

I'm thinking that that change is under CC-BY-NC-SA-4.0 license (so I haven't made a PR from that branch yet), because it's adapted from repo 3b1b/videos (license discussion)

Maybe this workflow can be re-written, to be free from that license? Although Grant is saying he's mainly worried about others using "videos, and the assets" and "directly using content" which I'm not doing here, but still bound by that license..


Update (from that discussion) : an adaptation of the workflow itself - can be without the CC license

bhoov commented 2 weeks ago

Neat stuff! I'm currently traveling and I won't be able to look into this until likely early next week, but thank you for the contribution!

Splines commented 2 weeks ago

Wow, thanks for the quick implementation. The extension.ts file already gets quite large, maybe it'd be useful to extract the individual commands to separate files for better readability? Maybe there's also some shared behavior between commands that could also be outsourced?

VladimirFokow commented 2 weeks ago

The extension.ts file already gets quite large

On the other hand, spreading things over different places will make it harder to follow each one.

extension.ts is straightforward - it just defines commands 1 by 1, and inside each command you just read linearly from top to bottom to understand 100% what it's doing.

Right now there isn't much overlap, there may be some shared parts in the future, similar to manim_plugins.py, e.g. send_terminus_command is used in several places: https://github.com/3b1b/videos/blob/master/sublime_custom_commands/manim_plugins.py

But after all, I don't have strong opinions - I'd support what's fastest for everyone involved.

Splines commented 2 weeks ago

On the other hand, spreading things over different places will make it harder to follow each one.

I think quite the contrary is true ;) For me, it's easier to follow if the file is manageable and only contains of the things I need to look at (and no noise) — high cohesion, low coupling and separation of responsibilities. But maybe that's not too much of a problem yet in this early stage of the extension.

Of course, this is up to bhoov to decide in the end. I just think that it would make sense to watch out for this in the long-term run and to generally aim for high code quality right from the start to avoid aggregation of costs later on.

bhoov commented 2 weeks ago

extension.ts is straightforward - it just defines commands 1 by 1, and inside each command you just read linearly from top to bottom to understand 100% what it's doing.

I am in general in favor of this style by @VladimirFokow , provided we all use VSCode's code folding functionality to fold away each individual function that we don't work on, I would prefer to keep everything in one file. The editor ends up looking pretty clean. In your contributions for new functionality, please add a descriptive comment to each new command in a similar fashion

image
Splines commented 2 weeks ago

Note that it might be worth to first merge #7, then move the code that is adjusted in this PR (#5) to the respective previewCode() method. merge #8.

bhoov commented 1 week ago

Ended up integrating this into my local branch and doing some cleanup. I changed no functionality, works great. Thanks @VladimirFokow !

VladimirFokow commented 1 week ago

Great! I'm happy to have contributed! 👍