scala xml literals + formatter => big frustrations

Hi,

It seems that the code formatter has inconsitent behavior when interpolating code in xml literals. This makes it harder than it should to compare the output in unit tests: ie, simple string comparisons are not sufficient, because whitespace is unpredictable. In the label example below, this is even worse because it changes the content of an element.

At this point (to me anyway) it seems that this feature does more harm than good, and you should provide a way to disable it.

Some examples:

<label>{label}:</label>

becomes

<label>
{label}
:</label>

which is not the same thing!

Or:

<div>
{gencode1}
{gencode2}
</div>

becomes

<div>
{gencode1}{gencode2}
</div>

4 comments
Comment actions Permalink

You can disable all reformatting within XML literals under: Settings, Code Style, Scala, Other Settings

0
Comment actions Permalink

Thanks, but I had already looked there for such a setting, how is it called? I don't see anything mentioning xml.

0
Comment actions Permalink

Sorry, I was working from memory.

The setting is under:  Code Style, Wrapping and Braces, Scala, Keep XML Formating.

0

Please sign in to leave a comment.