Is it possible to format only a selected block of code. I could only either format the whole file or the whole project with IntelliJ. I use community edition 2017.2 on MacOS.
From the IntelliJ IDEA Help (Reformat File Dialog):
Highlight the block of code.
Open the Reformat File
dialog:
Click the "Selected Text" radio button.
Click the "Run" button.
It should look something like this:
Yes; simply highlight the block of code and format it, either through the keyboard or through the menu. How it will be formatted, and what will be formatted, are driven solely by your formatting preferences.
Reformat a code fragment in a file:
Ctrl+Alt+L
.Note. If you don't select a code fragment, IntelliJ IDEA will reformat the whole file.
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