PhpStorm resets code style settings when reopening project - intellij-idea

PhpStorm can't save code style settings in project.
I've changed settings to use Double quotes in HTML. The Single quote option is still selected when I close and reopen the project.
The following <option name="HTML_QUOTE_STYLE" value="Single" /> line keeps returning in .idea/codeStyles/Project.xml file when opening the project.
I've also tried copying code style settings from the IDE and saving it in .editorconfig file...

Related

How to disable auto-recognition of file types when IntelliJ is started

I am working with the file type *.properties, for which I don't want to use IntelliJ's property file editor, which is assigned to that file extension by default. In Settings > Editor > Code Style > FileTypes, I have removed the "*.properties" pattern from the "Properties" under Recognized File Types, and added it to "Text". This works until I restart IntelliJ, then it automatically reassigns "*.properties" to "Properties". In the bottom right corner, it shows a corresponding message with a "Revert"-Button, to undo IntelliJ's auto reassignment:
Is it possible to disable this auto-reassignment? If yes, how?

How do I prevent PhpStorm from moving cursor to the left when I press Ctrl+S for save file? [duplicate]

I just updated to PhpStorm 2016 and I noticed that suddenly every time I press Ctrl + S to save the file it removes the spaces/tabs that I pressed to continue writing after testing this bit of code.
Pleas help, this is very annoying for me, since I save my file after every line of code.
Here is a screenshot when I'm about to save, so after hitting Ctrl + S the text cursor will move all the way to the left, deleting all spaces & tabs.
You need to disable Settings/Preferences | Editor | General | Remove trailing spaces on: option.
(NOTE: in older IDE versions you may have just a drop down box and have to select the None option there)
P.S. Please note that if you have .editorconfig files in your project then corresponding setting from there (trim_trailing_whitespace) will overwrite such IDE setting. It is expected as it's the whole nature of such files.
If you do not like that then either edit your .editorconfig file accordingly (https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#current-universal-properties) or disable such support in the IDE (Settings/Preferences | Editor | Code Style | Enable EditorConfig support)
I recently experienced the behavior that trailing spaces got removed everywhere although the option Settings/Preferences > Editor > General > Strip trailing spaces on Save was set to Modified Lines. Setting the option to None didn't help nigher.
The reason for that was, that I had installed the JetBrains IDE plugin EditorConfig. In the root of my (PHP-) project I had a
.editorconfig file with the setting trim_trailing_whitespace = true. Setting that to false, fixed the issue.
PhpStorm 2021.2.3
Just Settings/Preferences > Editor > General
scroll down to On Save

How to stop IntelliJ IDEA from removing empty lines from .properties files?

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.
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.

IntelliJ keeps folding my code by default

When I open up any code file .java or .html IntelliJ (12.x) keeps the code folded and I always have to expand everything.
How do I make code expand by default?
In the preferences (ctrl+alt+s on my machine), under Editor, you will find an entry called Code Folding. In there you can choose what's folded by default. In your case, you'll probably want to remove all the defaults.

IntelliJ - not asking if I want to save a file

I'm new to the IntelliJ IDE. In the past I was working with Visual Studio or Eclipse.
In those IDEs there was an asterisk * above the name of the file which has been modified.
But in IntelliJ with the default configuration I can't see if the file is modified. What's more the file is saved automatically when I change focus to another window.
I've found some options under Settings -> IDE Settings -> General -> Synchronization:
Synchronize files on frame activation
Save files on frame deactivation
Save files automatically if application is idle for...
After unchecking all that options the file is not saved automatically every time I change focus to another window, which is good. But still I can't:
see if the file is modified (no asterisk)
decide if the file should be saved when I'm closing it (IDE doesn't ask for that)
And when I'm closing IntelliJ file which has been modified is saved without even noticing.
Do you know what can I do to change how IntelliJ behaves?
After unchecking mentioned options go to:
Settings/Editor(IDE Settings)/Editor Tabs:
Check "Mark modified tabs with asterisk"
On 2019.3 Ultimate it's under:
Settings/Editor/General/Editor Tabs:
Mark modified (*)
The exact Save feature like eclipse is not available in IntelliJ.
Because IntelliJ IDEA has the ability to change so many files
simultaneously in large refactoring actions, and change them without
ever opening them, single file saves don't make very much sense. In
recognition of this, IntelliJ IDEA reserves the right to save any of
your files literally whenever it wishes. It's actually quite nice to
never have to worry about your file's save statuses, once you get used
to it.
"What if I don't like some changes I made, and want to roll them
back?", I hear you say. Well, for that IntelliJ IDEA includes this
amazing feature called the Local History. Every time it saves your
files, IntelliJ IDEA actually saves a diff of your file from it's
previous state, and saves that as well. You can see the entire edit
history of your files (going back some number of days), see the
changes you've made, and roll back any change. It rules triumphantly,
and more than makes up for the temporary disorientation caused by lack
of single-file save.
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206336279/comments/207351939
To show an asterisk when a file is modified: open Settings (CTRL+ALT+S), switch to Editor > General > Editor Tabs and select the Mark modified tab with asterisk checkbox.
To remove autosave, uncheck: Appearance & Behavior > System Settings > Save files on frame deactivation