Eclipse CDT Source->Implement Method 生成的代码不遵循定义的代码风格
我有时使用 Source->Implement Method,但我注意到生成的代码不遵循首选项中定义的代码样式(当我正确使用 Source->Format 时应用样式) - 是否有一些我错过的设置或者这是一个错误?
在 Ubuntu Linux 10.04 LTS 上使用 Eclipse 版本 3.5.2 和 CDT 6.0.2。
示例:我们将开头 { 定义为与类/方法定义在同一行,但 Implement Method 将其放在下一行。
I am using Source->Implement Method sometimes, but I noticed that the generated code does not follow the defined code style from the preferences (the style is applied when I use Source->Format correctly) - Is there some setting I missed or is that a bug?
Using Eclipse Version 3.5.2 and CDT 6.0.2 on Ubuntu Linux 10.04 LTS.
Example: we defined the opening { to be on the same line as the class/method definition, but Implement Method puts it on the following line.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚尝试过,没有遇到这个问题(我使用的是 Eclipse 3.3、3.4 和 3.6)。
我不知道你是否知道Eclipse的这个功能,但是在
Preferences>中爪哇>编辑>保存操作
,您可以定义保存当前正在编辑的 Java 类时自动运行的操作列表。此面板中有趣的元素是格式化源代码以及组织导入操作。
编辑评论:
此问题似乎与 Eclipse CDT 插件 有关,该插件不提供
保存操作
功能。我刚刚查看了 CDT 7.0 版,不幸的是这个功能还没有被添加。因此,我建议您在他们的 Bugzilla 实例 中记录一个错误,以报告您在
中遇到的问题实现方法
功能。最后,您还可以记录一个增强功能,在此插件中添加此保存操作
!I just tried, and I do not encounter this issue (I am using Eclipse 3.3, 3.4 and 3.6).
I don't know if you are aware of this Eclipse feature, but in
Preferences > Java > Editor > Save actions
, you can define the list of actions that are automatically run when you save the Java class you are currently editing.The interesting elements in this panel are the Format source code as well as the Organize imports actions.
Edit regarding the comments:
This problem seems to be related to the Eclipse CDT plugin which does not offer the
save actions
feature. I just had a look on CDT version 7.0 and this feature has not been added unfortunately.So I suggest that you log a bug in their Bugzilla instance to report the problem you encounter with the
Impement method
feature. Eventually, you can also log an enhancement to add thisSave actions
in this plugin!