最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Why does the intellij formatter append a blank line after embedded script? - Stack Overflow

programmeradmin3浏览0评论

For example, HTML that looks like this:

<script>
    var hello;
</script>

Becomes this after formatting a few times (Code > Reformat code...):

<script>
    var hello;



</script>

For example, HTML that looks like this:

<script>
    var hello;
</script>

Becomes this after formatting a few times (Code > Reformat code...):

<script>
    var hello;



</script>
Share Improve this question asked Feb 2, 2015 at 15:36 matt burnsmatt burns 25.4k13 gold badges111 silver badges108 bronze badges 4
  • Perhaps, he believes that you write more :) – websky Commented Feb 5, 2015 at 14:56
  • I can't reproduce this issue with te same code. Try to explore your Javascript or HTML Code Style in Settings. – Getz Commented Feb 6, 2015 at 15:38
  • What happens if your code looks like this: <script>var hello;</script> ? That is, no carriage returns. – durbnpoisn Commented Feb 11, 2015 at 19:24
  • 2 Why would someone downvote this question? Are people just trying to be stupid or what? The same issue was happening to me and this question and answer have helped me. And I see this has been viewed 106 times already, so it must have helped somebody else. +1, man, and don't mind the retards – Igor Donin Commented Dec 16, 2015 at 3:30
Add a comment  | 

1 Answer 1

Reset to default 28

I still don't know why the extra line is being added but I found a way to stop it.

File > Settings > Editor > Code Style > HTML > Other > Keep white spaces inside: > Then add script

发布评论

评论列表(0)

  1. 暂无评论