How to stop IntelliJ IDEA from removing empty lines from .properties files? I want to use empty lines to separate sections of files (database properties, RabbitMQ properties, business properties, etc).
When file is saved, empty lines are removed. I have IntelliJ IDEA 2016.1.2, with 'Save actions' and 'Properties' plugins. I see no option to controll empty lines in .properties files anywhere.
Use str2. trim() or move str2 = str2. replaceAll("\\s","") after the second replaceAll() .
From the main menu, select Help | Edit Custom Properties. If you do not have any project open, on the Welcome screen, click Configure and then select Edit Custom Properties. If you cannot start IntelliJ IDEA, manually create an empty idea. properties file in the IntelliJ IDEA configuration directory.
HOME\idea. properties (where HOME is the user's home directory on the system) IDE_HOME\bin\idea. properties.
This is a bug in 2016.1 and 2016.2: IntelliJ Bug IDEA-157903
This will be fixed in 2016.3, you can try the IntelliJ EAP
As a workaround, I defined Shift
+ Ctrl
+ s
to be the Save All, so when I notice that IntelliJ delets my blank lines, I issue an undo and use the shortcut with Shift
to save the file without reformating.
Update November 2016: I can confirm that a option to keep blank lines in property files was added in version 2016.3
IntelliJ does that when you run Reformat Code action.
It can be disabled by disabling "Formatting actions -> Reformat file" in the Save Actions plugin settings. However, by doing this all your files are of course not being reformatted upon save.
There is blank lines settings for java code in Settings -> Editor -> Java -> Blank lines, but unfortunately not for property files as far as I know.
Better way to prevent reformatting would be just to add property file exclusion using the following regex
.*/.*\.properties
However, there seems to be issue currently which ignores this settings in some cases
https://github.com/dubreuia/intellij-plugin-save-actions/issues/29
Edit: issue is resolved in 0.11 version of the plugin. Exclusion regex works properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With