Eclipse:如何让代码格式化程序在 javadoc 标签后插入制表符
我想要:
/**
* @param from a point belonging to the map
* @param to a point belonging to the map
* @return a list of weighted edges on the shortest path from
* {@code from} to {@code to}
*/
但是日食给了我:
/**
* @param from a point belonging to the map
* @param to a point belonging to the map
* @return a list of weighted edges on the shortest path from {@code from}
* to {@code to}
*/
有没有办法改变这个?
I'd like to have:
/**
* @param from a point belonging to the map
* @param to a point belonging to the map
* @return a list of weighted edges on the shortest path from
* {@code from} to {@code to}
*/
But eclipse gives me:
/**
* @param from a point belonging to the map
* @param to a point belonging to the map
* @return a list of weighted edges on the shortest path from {@code from}
* to {@code to}
*/
Is there a way to change this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
添加
Eclipse 将为每个
包含一个换行符。此外,当您使用 Eclipse 生成 JavaDocs 时,它还包含强制换行符。
具有固定格式的另一种方法是
Add <br>
Eclipse will include a line-break for each <br>. In Addition, when you generate your JavaDocs with Eclipse it also includes a forced line-break.
Another way to have a fix format is the <pre> </pre> tag.
One Problem with <pre> is that you have a forced line-break before the opening <pre> and after the closing </pre> tag, wich means it cannot be used with @return, @param,...
Note: <pre> and <br> are only usable with JavaDoc-Comments /**. In a normal block-comment /* these two are ignored by eclipse.
当然,在 Eclipse 中,转到 Windows、首选项、Java>Code Style>Formatter,然后单击编辑。然后查找您要修改的注释并添加选项卡。
也就是说,您确定要这样做吗?请考虑指南,更不用说现在或将来,某些解析器可能无法找到您的 javadoc,并且某些程序员可能会对您感到非常恼火;)
编辑:哦:/恐怕您是对的;我正在考虑 Java>CodeStyle>CodeTemplates,它会在创建方法/类时放置您想要的任何内容。然而,自动格式化程序不会遵守这一点:(
Sure, in eclipse, go to Windows, preferences, Java>Code Style>Formatter, and click on edit. Then look for the comments you want to modify and add a tab.
That said, are you sure you want to do this? Please consider the guidelines, not to mention that now or in the future, some parsers might fail to find your javadoc, and some programmers might be very annoyed with you ;)
Edit: Oh :/ I'm afraid you're right; I was thinking of Java>CodeStyle>CodeTemplates, which will put whatever you want when a method/class is created. This, however, will not be respected by the autoformatter :(