Eclipse CDT 中算术表达式的换行/缩进样式
我正在使用适合我的品味和需求的定制 Eclipse 代码样式。问题是,据我所知,我想要的设置不是 Eclipse(最新版本,顺便说一句)向我提供的代码样式对话的一部分。
这就是我想要的:
int lenghty_sum = a_function_with_a_long_name(double some_argument)
+ another_lengthy_function();
也就是说,操作数应该按列对齐。然而,Eclipse 产生的东西更像是一些
int lengthy_sum = a_function_with_a_long_name(double some_argument)
+ another_lenghty_function();
我觉得读起来有点混乱的东西。
I'm using a customized Code style for Eclipse that suits my taste and needs. The problem is that, as far as I figured out, the setting I desire is not part of the code style dialogue presented to me by Eclipse (latest version, btw).
Here's what I want:
int lenghty_sum = a_function_with_a_long_name(double some_argument)
+ another_lengthy_function();
That is, the operands should be aligned column-wise. What Eclipse produces, however, is something more like
int lengthy_sum = a_function_with_a_long_name(double some_argument)
+ another_lenghty_function();
which I find a bit messy to read.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:我收回它。忽略这个答案。这是不正确的。 : /
格式化程序/代码样式设置有一个棘手的问题。除了设置设置树的叶节点这一更明显的事情之外,您还可以确定分支上的属性。
因此,即使
Expressions
分支只有Conditionals
和Initializer list
作为子项,并且没有算术表达式
(如果您选择)表达式
并将缩进策略更改为列缩进
我相信它会达到您的期望。顺便说一句,我正在使用
EDIT: I take it back. Disregard this answer. It's incorrect. : /
There's a trickiness to the formatter/code styler settings. You can determine properties on branches in addition to the more obvious thing of setting the leaf nodes of the settings tree.
So even though the
Expressions
branch only hasConditionals
, andInitializer list
as children and noArithmatic expressions
if you selectExpressions
and change the indentation policy toIndent on column
I believe it will do what you are hoping for.Btw I'm using