在Eclipse中重新格式化代码样式 [英] Reformat code style in Eclipse

查看:374
本文介绍了在Eclipse中重新格式化代码样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在eclipse中寻找一种自动的方式,将大括号重新格式化为K& R风格,消除单个语句的大括号,如果是这样的方式?


解决方案

在重新格式化之前,您需要自定义首选项对话框中的格式化程序设置



首选项对话框已打开(默认设置)。如果默认设置不符合您的要求,请将Java /代码样式/格式化添加到您的K&从主菜单/窗口/首选项



您甚至可以配置保存操作 Java / / Save Action 以保存时格式化源代码。


I'm looking for an automatic way in eclipse to reformat curly braces to K&R style, eliminating braces for single statements if, etc. Is there such a way?

Thanks.

解决方案

Before you reformat you need to customize the formatter settings in the Preferences Dialog Java/ Code Style / Formatter to your K&R settings if the default settings don't match your requirements.

The Preferences Dialog is opened from Mainmenu / Window / Preferences

You can even configure a save action Java / Editor / Save Action to format source code on save.

这篇关于在Eclipse中重新格式化代码样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆