You are reading a single comment by @JumJum and its replies. Click here to read the full conversation.
  • Just checked an idea for "format only the selected code" in my environment.
    At the end it is extremly easy to implement.
    Should be similiar for prettier

    	var code = Espruino.Core.EditorJavaScript.getCode()­;
    	var selected = Espruino.Core.EditorJavaScript.getSelect­edCode();
    	if(selected) code = code.replace(selected,js_beautify(select­ed,options) + "\n"); //had to add linefeed for beautify, don't know wether prettier  needs this
    	else code = js_beautify(code,options);
    	Espruino.Core.EditorJavaScript.setCode(c­ode);
    
    
About

Avatar for JumJum @JumJum started