有没有办法在 Netbeans 或 Eclipse 中隐藏注释?
也许是一个愚蠢的问题,但如果有一种方法可以在 Netbeans(或 Eclipse)中查看源代码时隐藏或折叠 Java 注释,那就太好了。 我没有找到任何选项,快速搜索也没有找到任何结果。
这是“你永远不应该这样做,代码折叠是一种罪恶!”之一吗? 事物?
就我个人而言,我发现它对于带注释的实体类很有用。 所有的 hibernate/etc 注释都是无用的,一旦我的映射工作正常,我就不会再看它们。 确实和进口的差不多。
(是的,我可以使用 XML 代替注释,我可能会开始这样做。但我只是想知道......)
Maybe a dumb question, but it would be nice if there was a way to hide or collapse Java annotations when viewing source in Netbeans (or Eclipse). I'm not finding an option and a quick search didn't turn anything up.
Is this one of those "you should never want to do that, code folding is a sin!" things?
Personally I'd find it useful for annotated entity classes. All the hibernate / etc annotations are just fluff that I never look at once my mapping is working fine. It's similar to imports, really.
(Yes, I can use XML instead of annotations, which I might start doing. But I was just wondering...)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是如何“隐藏”@Annotations 的一个很好的解决方案。
使 @Annotations 的颜色比其他颜色更浅,例如浅绿色。
如何:
首选项:Java> 编辑器> 语法着色
在“元素”框中,选择“注释”。
单击颜色按钮。
注释:浅绿色。 我使用 RGB:0, 240, 0
注释元素引用:浅绿色:RGB:0, 170, 80
这样,注释是可见的,但当您尝试阅读和编辑功能代码时,它们不会分散您的注意力。
如果您确实不想知道您的@Annotations,您可以使它们与背景颜色相同或非常接近,例如白色。 然后只显示 = 值。
佩罗·布兰科? 没有那么聪明。
胡安·礼萨·普里尔
Here's a good solution to how to "hide" @Annotations.
Make the color of the @Annotations a lighter color than the rest, such as light green.
How to:
Preferences: Java> Editor> Syntax Coloring
in the Element box, select Annotations.
Click Color button.
annotations: lighter green. I use RGB: 0, 240, 0
annotation element references: light green: RGB: 0, 170, 80
This way, the Annotations are visible, but they are much less distracting when you're trying to read and edit the functional code.
If you really want to be unaware of your @Annotations, you could make them the same or very close to the background color, such as white. Then only the =values will show.
Pero blanco? no es muy inteligente.
Juan Reza-Prieur
只使用过 Eclipse 或 IDEA,我不知道有任何 IDE 选项可以隐藏注释,在我看来这是一件好事。
您的注释会影响代码的编译方式,并且通常会影响代码的运行方式。 在我看来,隐藏它们相当于隐藏方法签名或语言的任何其他组件中的
public
/protected
/private
关键字。 他们的排除改变了周围环境的含义,从而改变了开发人员的期望。Having only used Eclipse or IDEA, I'm unaware of any IDE options to hide annotations, and in my opinion it's a good thing.
Your annotations affect the way your code compiles and often, how it runs. In my opinion hiding them is tantamount to hiding
public
/protected
/private
keywords in method signatures, or any other component of the language. Their exclusion changes the meaning of their surrounding context and therefore, a developer's expectations.