欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

phpstorm webstorm 去除多余的空行

shiping1 的头像
 ctrl+r 正则替换 Other than that -- Replace \n\n by \n as suggested above (this will remove all empty lines).
what mean STRG-R with regex  in sentences "replace \n\n by \n (STRG-R with regex)" ?
Other than that -- Replace \n\n by \n as suggested above (this will remove all empty lines).

It depends what kind of empty lines they are. Single empty line inside the code (function body etc) will most likely will never be removed as it is very often used to visually separate the code a bit, but things like double empty line, or multiple empty lines between methods etc can be removed if configured to do so -- make sure that you configured it at "Settings | Code Style | PHP | Blank Lines".

 

Also make sure that "Settings | Code Style | PHP | Wrapping and braces | Keep when reformatting | Line breaks" is unchecked -- it may affect other settings as well.

来自 https://devnet.jetbrains.com/message/5470559
 











Is there any way to remove blank lines inside blocks and comments in PhpStorm in CSS files?


In PhpStorm (and I suppose IntelliJ), there are quite a few options for removing blank lines in various code languages.

For CSS, there is not even a tab, just an option to set "Blank lines between blocks".

Is there any way to tell PhpStorm to remove blank lines inside blocks (and possibly comments) when clicking "Reformat code"?

Update: Here's my settings tab: Settings


http://stackoverflow.com/questions/26570320/is-there-any-way-to-remove-blank-lines-inside-blocks-and...

 

普通分类: