【发布时间】:2017-06-06 01:57:26
【问题描述】:
在 HTML 文件上使用 IntelliJ(和其他 JetBrains IDE)中的“重新格式化代码”将在文本中添加换行符,以确保文本不会超出右边距。我正在寻找的是能够将部分文本移回上一行,如果上一行有空间的话。
例如,如果我原来有:
<p>
This is some text that is fairly long and won't fit on a single line without going over the right margin.
</p>
重新格式化代码会产生类似的结果(假设右边距非常小):
<p>
This is some text that is fairly long and
won't fit on a single line without going
over the right margin.
</p>
但是如果我删除一些文本:
<p>
This is some text that
won't fit on a single line without going
over the right margin.
</p>
我想重新格式化代码以自动生成:
<p>
This is some text that won't fit on a
single line without going over the right
margin.
</p>
我查看了重新格式化代码的设置,但没有看到如何执行此操作。可能是“保留换行符”选项之一,但删除这些选项似乎也会删除标签之间的换行符。有没有办法做到这一点?
【问题讨论】:
标签: html intellij-idea pycharm jetbrains-ide