Tags split onto several lines in Code View when formatting

This is more of an OCD issue than a bug :smile: . I like to use the ‘Format Selection’ and ‘Format Document’ when in Code View. As an example, the issue is that the code within the INPUT tag shown should stay as (not sure how else to describe this :cry: ) one paragraph, but when I use ‘Format Selection’ or ‘Format Document’ the code for the INPUT tag gets broken up into 3 paragraphs.

This happens randomly throughout each document it is applied to. And happens to any and all tags.

Is there any way this could be stopped from happening?

Does anyone else have this issue?

This is still happening with the updated Monaco Editor.
Any idea why?
What can I do to stop it?

there is a global option for this:

Hi George, I know about this feature but that is not what I am trying to show here.

The following screenshots are in sequence.

  1. The 'is=' and 'format=' highlighted are on two separate lines. I want them to be grouped together with the rest of the 'input' tag.

  1. I manually move them onto the same line.

  1. I then choose to 'Format Document'

image

  1. The 'is=' and 'format=' are split again onto two lines. They should be on the same line.

Hope this makes sense.

We use the default formatting options of the monaco editor, perhaps I could make the options configurable within Wappler.

Not sure what the defaults are, but here are all the options: https://microsoft.github.io/monaco-editor/api/interfaces/monaco.languages.html.htmlformatconfiguration.html

Let me know if we should make some of these options available in Wappler.

I would be great to have an option which does not add new lines that break a tag.
I am not sure which of the HTML Format Config option would work here for Wappler, but it would certainly be a great UX update.

1 Like

I see that we actually already set the wrapLineLength to 250, default is 120. Is the line where the attribute is placed on the next line longer then 250 characters?

Hi Patrick, just having had a very brief look, it seems that the wrapLineLength makes sense.

Although it will break apart a tag, it won’t break apart an attribute of that tag, so I have come across some single attributes that are still 400 to 500 characters long.

I have quite a few tags which are over 1000 characters long, especially when there are plenty of dmx attributes and multi-layered ternary operations.

In an ideal world I would like to be able to set that wrapLineLength to whatever I want, even having a noLimit as an option.

Also, is there an option to set every attribute to start on it’s own line. Perhaps being able to toggle it on and off? That would be a great option for me.

Looking through the options information on the https://microsoft.github.io/monaco-editor link you sent through, I wouldn’t have a clue as to which bits do what. It’s not clear to me.

There is no documentation that describes what these options do. I will do some testing with them and place the useful options in the options menu of Wappler.

2 Likes

Brilliant. I can’t ask for anything more. Keep up the great work :beer:

bump

Any progress on this?

Any progress on this Patrick, it drives me mad at times.

1 Like

There is not an option for the format document that keeps the attributes on the tag when you have wrap lines enabled. The best I can do is making all the options of the formatting available in the Wappler settings so that you have a bit more control over it.