I have to develop several Java projects with different code styles at the same time. How to configure in Intellij Idea code style per project?
Thanks
In the editor, select a code fragment you want to reformat. Before reformatting, you can take a look at the code style settings that are applied to the selected code: press Alt+Enter and click Adjust code style settings. From the main menu, select Code | Reformat Code or press Ctrl+Alt+L .
Code style scheme settings are automatically applied every time IntelliJ IDEA generates, refactors, or reformats your code. The IDE comes with two pre-defined schemes: the Project scheme and the Default scheme. In the Project scheme, the settings that you configure apply only to your current project.
Sometimes code formatting can get out of sync, but there's an easy fix in IntelliJ IDEA. You can use ⌘⌥L (macOS), or Ctrl+Alt+L (Windows/Linux) to reformat a selection of code according to your reformat settings. You can also display the Reformat File dialog with ⌥⇧⌘L (macOS), or Ctrl+Alt+Shift+L (Windows/Linux).
You can configure project structure settings not only for the current project, but for all projects that you will be creating later. This means that you can set the new default structure for your projects. From the main menu, select File | New Projects Setup | Structure.
If you go to the Preferences -> Editor -> Code Style, there is a combo box at the top to choose to apply code style settings to the Project only, or at the global level.
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