TinyTapeout / tt-commander-app

Web app to control the Tiny Tapeout Demo board
https://commander.tinytapeout.com
Other
0 stars 3 forks source link

Improve on ways to dump code into REPL #14

Closed algofoogle closed 2 weeks ago

algofoogle commented 2 weeks ago

Enhancement: A specific feature for better pasting of code into the REPL and optionally even writing a MicroPython file to flash.

I haven't thought this through completely, but I'll explain the barrier I'm hitting and how it could be an enhancement.

I can paste this code (Ctrl+Shift+V; not Ctrl+V) into the REPL, and it parses correctly:

class MyHelper:
  def __init__(self, whatever):
    self.whatever = whatever
  def __repr__(self):
    return f'MyHelper({self.whatever})'

...but this does not; the blank line before the __repr__ function breaks it:

class MyHelper:
  def __init__(self, whatever):
    self.whatever = whatever

  def __repr__(self):
    return f'MyHelper({self.whatever})'

This is probably a MicroPython (or general REPL) issue, and I could just ugly-up my code by deleting all blank lines, but there could be a nice Commander workaround anyway...

Maybe there could be a way to drag-drop a file and have it upload to flash, then present the REPL command that would execute it?

Otherwise, maybe drag-dropping a file into the REPL region (OR pasting with Ctrl+Shift+V) could automatically fix what the REPL itself doesn't like, and immediately execute.

I know these are easier said than done, but I'm just mentioning it in case there's an easy option.

urish commented 2 weeks ago

Use Ctrl+E to enter into paste mode.