JetBrains
jetbrains.com › help › idea › reformat-and-rearrange-code.html
Reformat code | IntelliJ IDEA Documentation
4 weeks ago - To access the settings, in the Settings dialog (Ctrl+Alt+S) , go to Editor | Code Style, and switch to the Formatter tab.
JetBrains
blog.jetbrains.com › home › intellij idea › how to format java code
How to Format Java Code - The JetBrains Blog
June 6, 2024 - Under ‘for()’ statement in the Wrapping and Braces tab, we set Force braces to Always so IntelliJ IDEA will always insert curly braces around the body of our for loops. When we save these changes, they will be saved to our current Code Style scheme. Often we don’t want to reformat the whole file. If we were working on a file with some inconsistently formatted code, but we’ve only changed a small part of it, running Reformat Code might change parts of the file we haven’t touched.
java - how to configure code formatter on intellij - Stack Overflow
I have to write code in another style. Am I wondering how to configure IntelliJ for this purpose? More on stackoverflow.com
Strict Code Formatter
There is spotless which can format your code according to "Google style" or any Eclipse formatting profile. If you want formatting based on IntelliJ settings you are basically out of luck. I am not aware of any available tooling, and for the rest it is a proprietary engine. Further more, IntelliJ has just 1 config file for all formatting rules for all supporter languages. Which is rather problematic. At work we maintain an IntelliJ formatting profile and Eclipse formatting profile which should agree with each other. This also means certain formatting rules are disabled as IntelliJ and Eclipse have no compatible settings for certain rules. For example, nice Javadoc formatting results in conflicting results. So we use a less nice setting. Besides those formatting profiles we use checkstyle to verify the resulting code. More on reddit.com
Formatting Code
Changing the formatting of code in Eclipse to match the formatting used in IntelliJ IDEA can be done by configuring the code style settings in Eclipse to match those of IntelliJ IDEA. Here are the general steps to achieve this: **Install a Formatter Plugin (Optional):** - There are some Eclipse plugins available that can help you format your code according to IntelliJ IDEA's style. One such plugin is the "Eclipse Code Formatter" plugin, which can be found in the Eclipse Marketplace. **Configure Eclipse Code Formatter:** - If you've installed the Eclipse Code Formatter plugin or a similar tool, configure it to use the IntelliJ IDEA code style. - In Eclipse, go to `Window` > `Preferences`. - Expand `Java` > `Code Style` in the left-hand menu. - Click on `Formatter`. - You can create a new profile or edit an existing one. - In the Formatter Profile window, you can define your formatting preferences to match IntelliJ IDEA's style. This may include settings like indentation, brace placement, and more. **Import IntelliJ IDEA Code Style Settings:** - If you have access to IntelliJ IDEA, you can export its code style settings and import them into Eclipse. - In IntelliJ IDEA, go to `File` > `Settings` (or `IntelliJ IDEA` > `Preferences` on macOS). - In the settings dialog, navigate to `Editor` > `Code Style`. - Select your desired code style (e.g., Java) and customize it if needed. - Click the "Export" button to save the code style settings to an XML file. **Import IntelliJ IDEA Code Style into Eclipse:** - Back in Eclipse, under `Window` > `Preferences`, expand `Java` > `Code Style`. - Click on `Formatter`. - In the Formatter Profile window, click the "Import" button. - Browse to the XML file you exported from IntelliJ IDEA and import it. **Apply the IntelliJ IDEA Code Style:** - After importing the settings, you can apply the IntelliJ IDEA code style to your Java files. - Select the Java file(s) you want to format or use it globally for all files. - Right-click on the selected file(s) or folder and choose `Source` > `Format`. **Save the Preferences:** - To make sure your settings are saved, click "Apply" and then "OK" in the Preferences dialog. Keep in mind that Eclipse and IntelliJ IDEA may have some differences in their code formatting options, so achieving an exact match may not always be possible. You may need to make some manual adjustments or compromises to get as close as possible to your desired code style. Additionally, you may need to install additional plugins or extensions in Eclipse to fully match the IntelliJ IDEA experience, as some features may not be available out of the box. More on reddit.com
Intellij finally has a built in "Reformat code and organize imports" save action in 2021.2
It automatically saves, so usually I just use the reformat code shortcut (rather than using save and have auto format in other IDEs)
More on reddit.com13:17
Code Formatting in IntelliJ IDEA - YouTube
00:43
IntelliJ IDEA coding tips - reformat - YouTube
Auto-Formatting on Save with Save Actions - IntelliJ IDEA
07:41
How to reformat code in Android Studio and IntelliJ - Android Studio ...
09:31
Adding Google Code Formatter to the intellij IDEA - YouTube
JetBrains
jetbrains.com › help › idea › configuring-code-style.html
Code style schemes | IntelliJ IDEA Documentation
1 month ago - To configure a scheme for new projects, go to File | New Projects Setup | Settings for New Projects | Editor | Code Style in the main menu. Select the code style Scheme that you want to copy: the Project scheme or one of the IDE-level scheme.
JetBrains
jetbrains.com › help › idea › settings-code-style.html
Code Style | IntelliJ IDEA Documentation
1 month ago - If you decide to use IDE settings after creating the EditorConfig settings file, you need to clear the Enable EditorConfig support checkbox. In this area, specify the markers to limit code fragments that you want to exclude from reformatting. In the source code, formatting markers are written inside line comments.
JetBrains
jetbrains.com › help › idea › code-style.html
Code style and formatting | IntelliJ IDEA Documentation
February 11, 2024 - IntelliJ IDEA helps you maintain the required code style by formatting your code for you according to the code style rules. IntelliJ IDEA offers two ways of defining code style rules. You can use code style schemes: groups of settings that you can configure using the IDE interface, export, ...
Etendo
docs.etendo.software › developer-guide › etendo-classic › getting-started › installation › intellij-code-formatting
Code Formatting Style in IntelliJ - Etendo Documentation
This document covers how IntelliJ IDEA is capable of importing code formatter settings.
JetBrains
plugins.jetbrains.com › docs › intellij › code-formatting.html
Code Formatter | IntelliJ Platform Plugin SDK
1 month ago - Use the codeStyleSettings property of the FormattingContext to retrieve the settings which in turn provide access to custom settings through getCustomSettings(). These are commonly passed along and will be used to determine the correct amount of whitespace for indentations, wraps, etc.
JetBrains
jetbrains.com › help › idea › prettier.html
Prettier | IntelliJ IDEA Documentation
1 month ago - If you followed the standard installation procedure, IntelliJ IDEA locates the prettier package itself and the field is filled in automatically. To set Prettier as the default formatting tool, select the Run on 'Reformat Code' action checkbox.
JetBrains
jetbrains.com › help › idea › code-style-java.html
Code Style. Java | IntelliJ IDEA Documentation
July 2, 2026 - Use this page to configure formatting options for Java files. When you change these settings, the Preview pane shows how this will affect your code. Select or clear the checkboxes to insert, not to insert, or remove spaces in various contexts. In this tab, customize the code style options, which IntelliJ ...
Beansoft
beansoft.github.io › jetbrains › code-formatting.html
Code Formatter | IntelliJ Platform Plugin SDK
The formatting model is requested ... spacing settings. The formatting engine calculates the sequence of whitespace characters (spaces, tabs, and/or line breaks) that needs to be placed at every block boundary, based on the plugin's formatting model. The formatting model is requested to insert the calculated whitespace characters at necessary positions in the file. The structure of blocks is usually built so that it mirrors the PSI structure of the file – for example, in Java code, the top-level ...
JetBrains
blog.jetbrains.com › home › intellij idea › intellij idea 13: importing code formatter settings from eclipse
IntelliJ IDEA 13: Importing Code Formatter Settings from Eclipse - The JetBrains Blog
January 31, 2014 - All you need is to export settings from Eclipse (go to Eclipse’s Preferences → Java → Code Style → Formatter and export the settings to an XML file via the Export All button.), and then open IntelliJ IDEA Settings → Code Style → Java, click Manage, and import that XML file by simply clicking Import.
JetBrains
plugins.jetbrains.com › docs › intellij › code-style-settings.html
17. Code Style Settings | IntelliJ Platform Plugin SDK
March 19, 2025 - <extensions defaultExtensionNs... IDE Development Instance, open the Simple Language code formatting page: Settings | Editor | Code Style | Simple....
YouTube
youtube.com › intellij idea by jetbrains
Code Formatting in IntelliJ IDEA (2020) - YouTube
IntelliJ IDEA lets you reformat your code according to the requirements you've specified in the Code Style settings. In this screencast we're going to look a...
Published: May 20, 2020
Views: 14K
Top answer 1 of 2
5
You can change this in settings
File => Settings => Code Style => Java => Wrapping and Braces => Braces Placement.
2 of 2
0
IntelliJ IDEA 15
Code Style is under Editor.
File > Settings... > Editor > Code Style > Java > Wrapping and Braces > Braces Placement > change "End of line" to "Next line" for "In class declaration", "In method declaration" and "Other" > OK

On the right side, you will see a live preview.
Apply the new formatting
- For the current file:
- click on the editor area > press Ctrl + Alt + L
- For the whole project / a folder
- click on a folder from the project structure (E.g.: on src) > press Ctrl + Alt + L
GitHub
github.com › duraspace › codestyle › blob › master › ide-support › intellij.md
codestyle/ide-support/intellij.md at master · duraspace/codestyle
If you want IntelliJ to automatically add a copyright statement / license at the top of every Java class, you should ensure this is (re)configured: File → Settings → Editor → Copyright · Add a Copyright profile, using the + button · Set the notice which will appear at the top of all generated code files · Select the profile from the Default project copyright list · Select Formatting and uncheck the option "Add blank line after" Verify or set the following settings.
Author: duraspace