Skip to content
This repository has been archived by the owner on Jan 31, 2025. It is now read-only.

Expose "Hard wrap at" setting to avoid linebreaks with unintended side effects #163

Open
orischwartz opened this issue Sep 12, 2018 · 2 comments

Comments

@orischwartz
Copy link

Closure templates has a potentially dangerous white space collapsing policy:

Consecutive lines are joined according to the following heuristic: if the join location borders a template or HTML tag on either side, the lines are joined with no space. If the join location does not border a template or HTML tag on either side, the lines are joined with exactly one space.

Right now there's no way to disable hard-wrapping without changing the default IntelliJ setting in Editor >> Code Style >> Hard wrap at.

Example:

Before

Closure templates will render the end of this as:

... some text some text

{template .hardWrap}
<div>Welcome to Bamboo Soy page. Long text that will break at 120 columns by default some text some text some <strong>text</strong></div>
{/template}

After formatting

Closure templates will render this with a missing space:

... some text sometext

{template .hardWrap}
  <div>Welcome to Bamboo Soy page. Long text that will break at 120 columns by default some text some text some
    <strong>text</strong></div>
{/template}

Guessing the change would have to be somewhere here but I'm not sure:

protected void initTabs(CodeStyleSettings settings) {
addIndentOptionsTab(settings);
}

@johnlinp
Copy link

+1 here.

@johnlinp
Copy link

IntelliJ IDEA has a Wrap text option for XML files:

Screen Shot 2019-06-24 at 16 33 08

If you turn it off, the formatter won't break long texts in XML files. I was expecting Bamboo Soy to have something like this. In the OP's example, I wish the formatter just give it an indent and don't wrap the long line:

{template .hardWrap}
  <div>Welcome to Bamboo Soy page. Long text that will break at 120 columns by default some text some text some <strong>text</strong></div>
{/template}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants