1、Editor代碼格式配置
點擊Eclipse菜單欄Window—Preferences,打開Preferences設置窗口:選擇左側Java選項—Code Style—Formatter,打開右側Formatter Tab;
方法一:對已存在Active profile配置文件進行重編輯管理,click Edit/Remove。
方法二:New profile or Import external profile existed,Then edit the profile. We can also export our active profile.
Ps:一般類、方法聲明以及枚舉等,{ }都另起一行,在Braces/New Lines兩個Tab進行打勾選擇即可;
2、xml代碼格式配置
與Editor操作類似,點擊Eclipse菜單欄Window—Preferences,打開Preferences設置窗口:選擇左側XML選項—XML Files—Editor,打開右側Editor Tab;
在Formatter area中,進行選擇配置。Line Width爲代碼一行的寬度,具體選擇item如圖片所示。
Ps:第一項Spilt multiple設置分行顯示,Indent using tabs設置製表符爲Tab格,Indent using spaces 4設置製表符使用4個空格;
3、說明
不同的項目,規約不同,所以我們可以隨時根據需要,按照以上步驟進行配置My Profile。在實際工作中,會遇到和解決很多經典的問題、技術要點,這是我在csdn發表的第一篇文章
,希望廣大技術朋友多多支持,後續會堅持寫更多的技術文章。
4、Eclipse Text 格式設置
點擊Eclipse菜單欄Window—Preferences,打開Preferences設置窗口:選擇左側General選項—Editors—Text Editors,打開右側Text Editors Tab;
如圖Text Editors.
5、Eclipse 代碼提示彈不出
原因:快捷鍵設置問題,系統默認下content assist(Ctrl+Space)和word completion(Alt + /).
解決方法 :點擊Eclipse菜單欄Window—Preferences,打開Preferences設置窗口:選擇左側General選項—Keys。對word completion(Alt + /)進行unband
command;content assist(Ctrl+Space)修改爲Alt + /。
如圖所示CodePromoteHelper