Eclipse CDT 中算术表达式的换行/缩进样式

发布于 2024-10-02 18:00:26 字数 445 浏览 0 评论 0原文

我正在使用适合我的品味和需求的定制 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱的那么颓废 2024-10-09 18:00:26

编辑:我收回它。忽略这个答案。这是不正确的。 : /

格式化程序/代码样式设置有一个棘手的问题。除了设置设置树的叶节点这一更明显的事情之外,您还可以确定分支上的属性。

因此,即使 Expressions 分支只有 ConditionalsInitializer list 作为子项,并且没有 算术表达式(如果您选择) 表达式并将缩进策略更改为列缩进我相信它会达到您的期望。

顺便说一句,我正在使用

  • 版本:Helios Service Release 2
  • 构建 ID:20110218-0911

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 has Conditionals, and Initializer list as children and no Arithmatic expressions if you select Expressions and change the indentation policy to Indent on column I believe it will do what you are hoping for.

Btw I'm using

  • Version: Helios Service Release 2
  • Build id: 20110218-0911
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文