Send selected lines to Espruino

Posted on
  • During testing, Terminal window is often used to send same commands.
    Typing same thing again and again is boring.
    Snippets could be one way to help, but working with several projects blows up snippets.
    I would prefer to save testing commands in project file, to have them available whenever comin back to project.
    Therfore just tested, how we could send selected lines from code window.
    Short extension to js/core/send.js(line 47) like this could help.
    It first checks for selected lines in code window, and sends this code only.
    If nothing is selected it sends whole project.
    I'm not fully satisfied with this solution.
    It would be a change for send button, any idea to do better ?

      var code = Espruino.Core.EditorJavaScript.getSelect­edCode();
      if(code.length > 0) 
            Espruino.Core.Serial.write(code,true);
      else
             Espruino.Core.Code.getEspruinoCode(Espru­ino.Core.CodeWriter.writeToEspruino);
    
    
  • Actually, if you go to Editor Key Shortcuts in Settings, you'll see:

    Shift + ENTER
    Upload just the text that is selected in the editor pane

    So that should do exactly what you want? It's not a specific button but just a keypress, but still...

    I guess another option is to have the snippets option be able to check the contents of the current editor file for comments of a special form:

    /* SNIPPETS
    Water Plants : turnWaterPumpOn();
    Reset : reset();
    */
    

    Might work?

  • Oh,...
    Shift + Enter works perfect for me.
    To be open, never checked shortcuts.
    Usually I dont use shortcuts, but this one is nice.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Send selected lines to Espruino

Posted by Avatar for JumJum @JumJum

Actions