# Editor: Enable line wrapping of long lines

**URL:** <https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468>\
**Category:** Feature Requests\
**Created:** [22 July 2022 08:20 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468 "2022-07-22T08:20:52Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![hoegge](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hoegge/32/57502_2.png) [@hoegge](https://discourse.nodered.org/u/hoegge)\
**Post date:** [22 July 2022 08:20 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468/1 "2022-07-22T08:20:52Z")

</div>

It would be great to enable line wrapping of long lines in the editor.  
The editor pane is slim compared to a "real" editor, and the Monaco editor supports that out of the box. Just need the option to enable it.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 July 2022 08:28 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468/2 "2022-07-22T08:28:39Z")

</div>

> [@hoegge](#):
>
> It would be great to enable line wrapping of long lines in the editor.

You can add that in your settings file.

```auto
        codeEditor: {
            lib: "monaco", //can be "monaco" or "ace"
            options: {
                // /* theme - must match the file name of a theme in 
                // * packages/node_modules/@node-red/editor-client/src/vendor/monaco/dist/theme
                // * e.g. "tomorrow-night", "upstream-sunburst", "github", "my-theme"
                // */
                theme: "vs-dark",
                wordWrap: true,
                fontSize: 14,
                fontLigatures: true,
                fontFamily: "Cascadia Code, Fira Code, Consolas, 'Courier New', monospace"
            }
        }

```

---

<div class="post-metadata">

**Author:** ![hoegge](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hoegge/32/57502_2.png) [@hoegge](https://discourse.nodered.org/u/hoegge)\
**Post date:** [22 July 2022 09:00 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468/3 "2022-07-22T09:00:46Z")

</div>

Yes, but should be in the F1 menu, since it (at least for me) is something you toggle often (wrapping enables you too see everything without scrolling all the time, but wrapping also can make the code view ugly).

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 July 2022 09:05 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468/4 "2022-07-22T09:05:14Z")

</div>

Although programmatically, it is possible to add to the menu, this seems like something that should be requested on the monaco repository.

If you feel strongly enough about it, we'd be happy to consider a pull request.

---

<div class="post-metadata">

**Author:** ![hoegge](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hoegge/32/57502_2.png) [@hoegge](https://discourse.nodered.org/u/hoegge)\
**Post date:** [22 July 2022 09:22 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468/5 "2022-07-22T09:22:43Z")

</div>

Not sure if I know enough, but in VSCode the "View: Toggle Word Wrap" is part of the F1 menu. Whether that is then a Monaco or VSCode only thing, I'm not sure, since all the "View:xxx" items are not availabile in node-red

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 July 2022 09:30 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468/6 "2022-07-22T09:30:36Z")

</div>

Lets put it this way, I dont remove anything from Monaco default `f1` menu. So I would suggest VSCode pragmatically added "View: Toggle Word Wrap"

Might be worth asking why "View: Toggle Word Wrap" is not in monaco on the monaco repo? It may be just be some existing (obscure) option to setup.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [22 July 2022 09:40 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468/7 "2022-07-22T09:40:15Z")

</div>

I think you can call `editor.updateOptions({ wordWrap: "on" }) ` (and off) to toggle it... so maybe that can be bound to a key inside the monaco scope... I've no idea how to just add to the existing F1 list.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 July 2022 09:44 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468/8 "2022-07-22T09:44:55Z")

</div>

> [@dceejay](#):
>
> I've no idea how to just add to the existing F1 list

Here is how I did it for themes...

> <https://github.com/node-red/node-red/blob/dc7fef63952548277d7759c327ce2909fdce0a3c/packages/node_modules/%40node-red/editor-client/src/js/ui/editors/code-editors/monaco.js#L972-L976>

---

<div class="post-metadata">

**Author:** ![MaxVonEvil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/maxvonevil/32/38392_2.png) [@MaxVonEvil](https://discourse.nodered.org/u/MaxVonEvil)\
**Post date:** [28 July 2022 04:27 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468/9 "2022-07-28T04:27:43Z")

</div>

@Steve-Mcl, quick question as I'm not super familiar with the backend of Node Red, what is the path+filename of the settings file you mentioned? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [28 July 2022 05:40 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468/10 "2022-07-28T05:40:40Z")

</div>

> [@MaxVonEvil](#):
>
> what is the path+filename of the settings file you mentioned?

From [the docs](https://nodered.org/docs/user-guide/runtime/settings-file)...

> If you are not sure which settings file Node-RED is using, you should check the log output when Node-RED starts up. It will log the full path to the file:
> 
> 22 Jun 12:34:56 - [info] Settings file : /Users/nol/.node-red/settings.js

---

<div class="post-metadata">

**Author:** ![MaxVonEvil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/maxvonevil/32/38392_2.png) [@MaxVonEvil](https://discourse.nodered.org/u/MaxVonEvil)\
**Post date:** [28 July 2022 05:53 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468/11 "2022-07-28T05:53:51Z")

</div>

Thank you, sometimes it's just easier to AAFQ than RTFM 😉👍

---

<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:** [26 September 2022 05:54 UTC](https://discourse.nodered.org/t/editor-enable-line-wrapping-of-long-lines/65468/12 "2022-09-26T05:54:50Z")

</div>

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