【发布时间】:2014-03-27 04:37:08
【问题描述】:
我在 save 命令上调用的 Eclipse 格式化程序设置为换行 cmets,因为这是我大部分时间想要的。但是,我偶尔希望 Eclipse 不要包装一些 cmets 行。这是一个例子。
如果我写:
/**
* My Eclipse formatter is set to wrap lines of comments, as this is what I
* desire most of the time. However, I occasionally want Eclipse NOT to wrap
* some lines of comments such as when I provide a simple example of an
* output format like here:
*
* Example output:
* <comments>
* <comment>This should be on one line</comment>
* <comment>And this on the next</comment>
* </comments>
*
*/
Eclipse 格式化程序会将其转换为:
/**
* My Eclipse formatter is set to wrap lines of comments, as this is what I
* desire most of the time. However, I occasionally want Eclipse NOT to wrap
* some lines of comments such as when I provide a simple example of an
* output format like here:
*
* Example output: <comments> <comment>This should be on one line</comment>
* <comment>And this on the next</comment> </comments>
*
*/
这是我不想要的。我知道我可以阻止每一行用<li> 换行,如下所示,但这很快就会变得很麻烦,使 cmets 更加混乱,并且仍然不能阻止 Eclipse 更改缩进:
/**
* My Eclipse formatter is set to wrap lines of comments, as this is what I
* desire most of the time. However, I occasionally want Eclipse NOT to wrap
* some lines of comments such as when I provide a simple example of an
* output format like here:
*
* Example output:<li>
* <comments><li>
* <comment>This should be on one line</comment><li>
* <comment>And this on the next</comment><li>
* </comments><li>
*
*/
我可以在“示例输出”之前添加一些内容来告诉 Eclipse 忽略格式化程序,以便它只保留我为部分 cmets 选择的缩进和换行吗?
【问题讨论】:
-
假设这是用于 Java,stackoverflow.com/questions/1820908/…。
-
完美。这正是我想要的。这里的协议是什么?你想把这个作为答案让我检查一下吗?还是我们将此问题标记为重复?
标签: eclipse formatting comments