Eclipse、Intellij idea格式化統一


Eclipse、Intellij idea格式化結果不一樣,導致長時間都是用兩個開發工具,idea開發eclipse進行格式化。但是現在這個問題可以解決了。使用Eclipse Code Formatter。

具體的插件地址:http://plugins.jetbrains.com/plugin/6546?pr=idea&offset=15&max=15#comments_pan

Intellij idea:
1,安裝插件:
網絡安裝:選擇Setting =>Plugins=>Browse repositories,搜索Eclipse即可出現,點擊左上角的Download and Install安裝。安裝之后重啟Intellij,即可在Setting =>Eclipse Code Formatter找到配置項。
硬盤安裝(推薦):Setting =>Plugins=>Install plugin from disk,選中下載好的安裝包【EclipseFormatter.zip】安裝,重啟后生效;
2,配置插件:
選擇Setting =>Eclipse Code Formatter,勾選Use the Eclipse-code-formatter,並在Eclipse Java Formatter config file選擇Eclipse用的code-style.xml文件,這個選項會決定格式化代碼的方式。
同時配置Import order的From File也為Eclipse用的code-style.xml文件,這個選項會決定組織import區域的方式。
3,使用插件
使用Intellij的格式化快捷鍵”Ctrl+ALT+L”即可進行格式化。如果出錯會輸出提示到Event Log里,如果看到’xxx formatted sucessfully by Eclipse code formatter’則表示格式化成功!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM