IntelliJ keeps folding my code by default - intellij-idea

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.

Related

PhpStorm AutoComplete code is not working

I'm using PhpStorm over 3 months and it's a good IDE. I do not know what I've clicked yesterday but since yesterday I have issue with code completion in CSS mainly.
On the screen I have VS Code and PhpStorm and also I've opened the same project.
In VS Code it works perfectly. In PhpStorm it doesn't. I tried some Google First Aid like clear cache, update the IDE, turn On/Off Safe mode etc. but nothing changed.
My Code Completion settings:
Based on your PhpStorm editor area screenshot (many thanks for that BTW: not many people do post it even if asked), all your CSS files are treated as a Plain Text. It's rather unlikely to be a glitch, more like accidental settings change.
Settings/Preferences | Plugins -- make sure that CSS plugin is enabled. If not -- enable and restart the IDE.
If still the same: Settings/Preferences | Editor | File Types -- locate "Cascading style sheet" entry and make sure that it has *.css pattern there.
If not there -- it's possible that you have somehow reassigned it to "Text" file type. If it's there -- just add *.css to Cascading style sheet patterns (it will remove it from Text when doing that).
If still nothing: you would need to provide more/new screenshots.

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 IDEA doesn't want to indent with tab

I want to indent with tabs, so I checked "Use tab character" in settings. But when I open projects which were indented with tabs, IntelliJ IDEA still asks me if I want to convert the indenting to spaces or keep it that way. Also, it creates new classes with space indenting. How can I solve this?
Your screenshot shows the settings for your Default (1) scheme. Those settings are not applied to your project automatically. It's not enough to just select it in the combobox. You need to import this scheme into your project.
Click Manage... and Copy to Project, and it should work as expected. This needs to be done for all your projects.
Also, make sure you're changing the language-spefic settings, so instead Code Style select Code Style > Java (or whatever language you are using). Those settings may override the default code styles.

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

IntelliJ missing all inspections

I'm having an issue with IntelliJ, that I cannot seem to find a solution for myself. I have not changed any settings, yet when I started my IDE this morning, all Inspections and other highlighting has disappeared.
By highlighting, I mean stuff like variable names becoming purple, static finals shown with italic text, etc.
Inheritance seems to be broken as well, in that an implementing method links to the implemented interface method, but interface methods do not link to the implementing method.
My search for this tells me that there is an icon for this in the bottom right. That's set to "Inspections", and under configuration, it seems like everything is set to default.
Is there some way to un-break my IDE?
Another solution:
File -> Power Save mode
It needs to be disabled.
The (or at least one) answer to this is:
File -> Invalidate Caches
Make sure the folder the code is in is marked as the sources root. If it's not marked as the sources root, syntax highlighting will be very limited.
To mark a directory as the sources root, right click the directory, then navigate down to "Mark directory as" and select "Sources root."