You are reading a single comment by @neshanjo and its replies. Click here to read the full conversation.
  •   function formatCode() {
        var code = Espruino.Core.EditorJavaScript.getCode()­;
        var cursor = Espruino.Core.EditorJavaScript.getCodeMi­rror().getCursor();
        code = prettier.format(code, {
          parser: "babel",
          plugins: prettierPlugins,
          tabWidth: parseInt(Espruino.Config.TAB_SIZE),
          useTabs: Espruino.Config.INDENTATION_TYPE == "tabs",
          semi: true,
          singleQuote: true

    get/setCursor principally seems to do the trick, however, it changes the scrolling position. The line with the cursor becomes the last line in the editor window. You can try this by e.g. using large app code like­lob/master/apps/trex/trex.js
    Any ideas how to fix this?


Avatar for neshanjo @neshanjo started