现在的位置: 首页 > 综合 > 正文

Eclipse环境中配置Editor代码格式、xml格式方法步骤

2013年09月16日 ⁄ 综合 ⁄ 共 1061字 ⁄ 字号 评论关闭
文章目录

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

抱歉!评论已关闭.