# Feature Request: Add prettify/beautify to function nodes

**URL:** <https://discourse.nodered.org/t/feature-request-add-prettify-beautify-to-function-nodes/33196>\
**Category:** Feature Requests\
**Created:** [22 September 2020 20:57 UTC](https://discourse.nodered.org/t/feature-request-add-prettify-beautify-to-function-nodes/33196 "2020-09-22T20:57:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tnrich](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tnrich/32/47942_2.png) [@tnrich](https://discourse.nodered.org/u/tnrich)\
**Post date:** [22 September 2020 20:57 UTC](https://discourse.nodered.org/t/feature-request-add-prettify-beautify-to-function-nodes/33196/1 "2020-09-22T20:57:29Z")

</div>

Hey there,

I find it really annoying not having a way to prettify the javascript code I'm writing in the function node. I think it would be nice to add a little "beautify" button that would format the code!

Thanks!  
Thomas

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [23 September 2020 04:57 UTC](https://discourse.nodered.org/t/feature-request-add-prettify-beautify-to-function-nodes/33196/2 "2020-09-23T04:57:50Z")

</div>

While it is technically doable to hook something like JS-Beautify into the underlying ACE editor, I think there is a greater picture to consider.

Code formatting is a very diverse topic, everyone has a different view of how the code should be formatted.  
Also, it's another library that has to be integrated, kept up-to-date and increases the download size of the editor UI.

From my experience, I have managed without that, because ACE is quite clever regarding auto-indentation and other little helpers. That only helps when typing code directly in the editor area, of course, not when you copy/paste from somewhere else. Occasionally, I copy/paste badly formatted code into VScode.

There has also been some work of integrating the Monaco editor instead of ACE. It's the editor used by VScode.

> [@Using Monaco editor - monaco branch now in fork (PR#2971)](https://discourse.nodered.org/t/using-monaco-editor-monaco-branch-now-in-fork/26561):
>
> UPDATE: 1-May-2021 - use monaco2 branch git clone [https://github.com/Steve-Mcl/node-red.git](https://github.com/Steve-Mcl/node-red.git) cd node-red git checkout monaco use monaco2 branch git checkout monaco2 npm install npm run build npm start notes: you can chose which editor to use by modifying your settings.js to include editorTheme.codeEditor.lib = "monaco" like this... // Customising the editor editorTheme: { projects: { // To enable the Projects feature, set this value to true enabled: …

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 November 2020 04:58 UTC](https://discourse.nodered.org/t/feature-request-add-prettify-beautify-to-function-nodes/33196/3 "2020-11-22T04:58:04Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
