krasa / Eclipsecodeformatter
Licence: apache-2.0
IntelliJ plugin - Allows using Eclipse's code formatter directly from IntelliJ. https://plugins.jetbrains.com/plugin/6546-eclipse-code-formatter
Stars: ✭ 390
Programming Languages
java
68154 projects - #9 most used programming language
Labels
Projects that are alternatives of or similar to Eclipsecodeformatter
Magento2 Phpstorm Plugin
PHPStorm Plugin for Magento 2
Stars: ✭ 294 (-24.62%)
Mutual labels: intellij, intellij-plugin
Intellij Plugin V4
An IntelliJ plugin for ANTLR v4
Stars: ✭ 318 (-18.46%)
Mutual labels: intellij, intellij-plugin
idea-php-advanced-autocomplete
Plugin for PhpStorm IDE. Adds auto-completion support for various built-in PHP functions, where parameter is a string literal.
Stars: ✭ 57 (-85.38%)
Mutual labels: intellij, intellij-plugin
MarioProgressBar
The Mario progress bar for IntelliJ IDEA and other JetBrains IDEs.
Stars: ✭ 29 (-92.56%)
Mutual labels: intellij, intellij-plugin
Intellij Dlanguage
Intellij Plugin for the D Programming Language
Stars: ✭ 279 (-28.46%)
Mutual labels: intellij, intellij-plugin
xmake-idea
🍨 A XMake integration in IntelliJ IDEA
Stars: ✭ 44 (-88.72%)
Mutual labels: intellij, intellij-plugin
Idea Android Studio Plugin
Android Studio Plugin
Stars: ✭ 293 (-24.87%)
Mutual labels: intellij, intellij-plugin
sourcegraph-jetbrains
Sourcegraph for JetBrains IDEs (IntelliJ)
Stars: ✭ 34 (-91.28%)
Mutual labels: intellij, intellij-plugin
Julia Intellij
💻 Julia Plugin for IntelliJ IDEA ┗😃┛ ┏😃┓ ┗😃┛
Stars: ✭ 258 (-33.85%)
Mutual labels: intellij, intellij-plugin
intellij-awk
The missing IntelliJ IDEA language support plugin for AWK
Stars: ✭ 18 (-95.38%)
Mutual labels: intellij, intellij-plugin
slides-presenter
Plugin to show slides and code examples directly from IntelliJ IDEs
Stars: ✭ 19 (-95.13%)
Mutual labels: intellij, intellij-plugin
Grepconsole
IntelliJ plugin - https://plugins.jetbrains.com/plugin/7125
Stars: ✭ 284 (-27.18%)
Mutual labels: intellij, intellij-plugin
eventbus-plugin
IntelliJ iDEA plugin to work with projects using greenrobot's EventBus library
Stars: ✭ 25 (-93.59%)
Mutual labels: intellij, intellij-plugin
Svelte Intellij
Svelte components in WebStorm and friends
Stars: ✭ 345 (-11.54%)
Mutual labels: intellij, intellij-plugin
intellij-mob
IntelliJ plugin for swift git handover and timer
Stars: ✭ 26 (-93.33%)
Mutual labels: intellij, intellij-plugin
idea-php-shopware-plugin
Shopware Plugin for PhpStorm which extends Symfony Plugin
Stars: ✭ 50 (-87.18%)
Mutual labels: intellij, intellij-plugin
bamboo-soy
An intellij plugin supporting Closure Template language (Soy)
Stars: ✭ 42 (-89.23%)
Mutual labels: intellij, intellij-plugin
gradle-cleaner-intellij-plugin
Force clear delaying & no longer needed Gradle tasks.
Stars: ✭ 26 (-93.33%)
Mutual labels: intellij, intellij-plugin
intellij-javacc
JavaCC and JJTree grammar support for the IntelliJ Platform
Stars: ✭ 31 (-92.05%)
Mutual labels: intellij, intellij-plugin
Yii2support
Yii2 Support for PhpStorm / IntelliJ IDEA
Stars: ✭ 280 (-28.21%)
Mutual labels: intellij, intellij-plugin
Eclipse Code Formatter
Allows using Eclipse's code formatter directly from IntelliJ. Solves the problem of maintaining a common code style in team environments where both IDEA and Eclipse are used.
Currently supports formatting of
- Java (also emulates Eclipse's imports optimizing)
Instructions
- Install the plugin
- Configure it
- Get Eclipse formatter settings file:
- Either, export formatter profiles to get a
*.xml
file- Go to
Eclipse | Windows | Preferences | Java | Code Style | Formatter
- Eclipse does not export default profiles, so you have to make your own via the
New
button - Export the profile via the
Export all...
button- The result should look like this
- Go to
- Or, enable project specific formatter settings to get
org.eclipse.jdt.core.prefs
- With your project open in Eclipse's workspace,
right-click
the project and choose Properties - Go to
Java Code Style | Formatter
and selectEnable project specific settings
- Click
OK
to save the settings - Go to the
.settings
directory inside your project's directory. There you will find theorg.eclipse.jdt.core.prefs
file which contains the Eclipse formatter settings- The result should look like this
- With your project open in Eclipse's workspace,
- Or, export a Workspace Mechanic configuration to get a
*.epf
file- The result should look like this
- Either, export formatter profiles to get a
- Open a project in IntelliJ
- Set path to the config file via
IntelliJ | Settings | Other Settings | Eclipse Code Formatter | Eclipse preference file
- When using exported profiles (the xml file), select desired profile in the combobox
Java formatter profile
- Check
Optimizing Imports
configuration- Set import order
- Either, leave the default
- Or, set path to Eclipse configuration file:
- Go to
Eclipse | Windows | Preferences | Java | Code Style | Organize Imports
- Either, click on
Export...
, (example) - Or, enable project specific settings and use
org.eclipse.jdt.ui.prefs
file which should contain the lineorg.eclipse.jdt.ui.importorder=...
- Either, click on
- Go to
- Set the value of
Class count to use import with
andName count to use static import with
inSettings | Editor | Code Style | Java | Imports
for Idea 14 orSettings | Editor | Code Style | Imports
for older Idea. Eclipse uses 99 by default - For versions lower than 4.0 - make sure to disable IntelliJ's
Import Optimizing
in the reformat dialog viaSettings | Editor | Show "Reformat Code" dialog
. The plugin will take care of imports anyway - For versions higher than 4.0 - imports will be reordered together with normal IntelliJ's import optimizing
- Disable
Optimize imports on the fly
- Set import order
- Get Eclipse formatter settings file:
- Format code as usual, notice the green bubble notification about successful formatting
- notifications can be disabled at
Settings | Notifications
- notifications can be disabled at
- Use
Ctrl + Alt + O
as usual, it will use this plugin - Use
Ctrl + ~
for quick switch between formatters or icon at the main toolbar - Give it 5 stars
- Make a donation
Possible problems with Java formatting
-
@formatter:off
is not working See: https://github.com/krasa/EclipseCodeFormatter/issues/64 - Nothing was formatted or formatting failed
- Make sure you are using proper language level in
Main Menu | File | Project Structure
- Make sure you are using proper language level in
- Trailing spaces inside javadocs are stripped
- Set
Strip trailing spaces on save
toNone
- Set
- File is formatted differently
- The file is actually formatted fine, it just looks different in the editor, as the tab size and indendation are set differently in IntelliJ in
Settings | Editor | Code Style | Java
than in Eclipse. Using of either tab only or space only whitespace is recommended. - Or it is a bug
- The file is actually formatted fine, it just looks different in the editor, as the tab size and indendation are set differently in IntelliJ in
- Eclipse indendation is configured for 2 spaces, but a new line gets indented by 4 spaces when Enter is pressed.
- Change code style in IntelliJ. Not all things get formatted by this plugin when you type them.
- If nothing helps
- check old issues
- Create a new issue here
Troubleshooting
If it is mysteriously not working, go to Main Menu | Help | Edit Debug Settings
and add:
krasa.formatter
Try to reformat something and create a new issue, including the log
YourKit supports open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of YourKit Java Profiler and YourKit .NET Profiler, innovative and intelligent tools for profiling Java and .NET applications.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].