...
Anchor | ||||
---|---|---|---|---|
|
In order for IntelliJ to format the code you need to import the OpenMRSFormatter.xml
Open the IntelliJ preferences and enter the search term "code style" which should show Code Style -> Java under the results in the left pane like shown here
Click on the "Manage..." button next to the "Scheme" drop-down at the top and select "Import..." in the pop-up window
Since the OpenMRSFormatter.xml is created using Eclipse select "Eclipse XML Profile"
Navigate to and select the tools/src/main/resources/eclipse/OpenMRSFormatter.xml and click "Open".
Import the formatter then in an own IntelliJ scheme and call it for example "OpenMRS Formatter"
Ensure the scheme you just created is selected in the "Scheme" dropdown
...
- Install Eclipse Code Formatter plugin in intelliJ | Go to
Files
->Settings
->Plugins
| Select Marketplace and search for Eclipse Code Formatter, then install it and restart your IntelliJ
- Get OpenMRS Formatter XML file
- Go to
Files -> Settings -> Other Settings -> Eclipse Code Formatter
| The configuration must look like this
- Turn on the Eclipse Code Formatter
- Import the previously downloaded XML file
- Turn off the option for Optimizing Imports
Keep everything else to default.
4. Apply the changes
From now on you can let IntelliJ format any java class for you. Read IntelliJ - Reformatting Source Code on ways to do that.
...