fgy*_*ica 10 java eclipse code-formatting
您可能知道,Eclips允许您为源代码的某些部分禁用代码格式化程序(请参阅此问题).
现在,我的问题是,格式化程序显然在//@formatter:off找到标记的行的最开头停止格式化代码.结果是,格式化程序标记本身(本质上只是一个注释行)放在一个奇怪的位置,即在行的最开头没有缩进.
看这个例子.
我输入的内容:
//@formatter:off
Some code {
with indentation
that I dont want to be formatted.
}
//@formatter:on
Run Code Online (Sandbox Code Playgroud)
点击[Ctrl + F]后,它看起来像这样:
//@formatter:off
Some code {
with indentation...
that I dont want to be formatted.
}
//@formatter:on
Run Code Online (Sandbox Code Playgroud)
好吧,我意识到这纯粹是一个美容问题,但是当我在代码中到处看到这个问题时,我的OCD让我疯狂.特别是在专门使用格式化标签后,使代码看起来更好.
您使用什么版本的 Eclipse?
我刚刚在 Eclipse 4.3.1 中尝试过这个,它似乎完全按照你想要的方式工作。更好的是,如果您的代码最终像第二个代码块一样,格式化程序实际上会将第一个//@formatter:off代码块缩进到正确的缩进。
也许您需要升级 Eclipse 版本?
| 归档时间: |
|
| 查看次数: |
12675 次 |
| 最近记录: |