清除 Eclipse 中突出显示的覆盖范围
在 Eclipse 中运行覆盖率报告(使用 cobertura 或 EMMA 插件)后,我的源代码文件会以绿色、红色和黄色突出显示,具体取决于测试覆盖了哪些代码行。
完成后如何清除该突出显示?
After running coverage reports in Eclipse (using cobertura or an EMMA plugin), my source code files get highlighted in green, red and yellow depending on which lines of code were covered by tests.
How can I clear this highlighting after I'm done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
单击“覆盖范围”视图工具栏中的“删除所有会话”按钮。
Click the "Remove all Sessions" button in the toolbar of the "Coverage" view.
在 4.2 eclipse 上,似乎不可能删除 eCobertura 亮点。遗憾的是 eCobertura 插件似乎不再维护了。然而,如果你开始在课堂上写作,它就消失了。所以输入一个空格,然后撤消,它就消失了。
On 4.2 eclipse it seems to be impossible to remove the eCobertura highlights. Sadly eCobertura plugins seems to be not maintained anymore. However if you start writing into the class, its gone. So type a space, and then undo, and its gone.
对于无法找到覆盖范围视图的用户,请按照以下步骤操作:
转到 Windows 菜单栏 >显示视图>其他>输入coverage并打开它。
单击覆盖范围。
要清除突出显示,请根据方便单击X 或XX 图标。
For people who are not able to find the coverage view , follow these steps :
Go to Windows Menu bar > Show View > Other > Type coverage and open it.
Click on Coverage.
To clear highlightings, click on X or XX icon as per convenience.
我在 GitHub 上找到了解决方法:https://github.com/jmhofer/eCobertura/issues/8
不想点击链接的朋友可以看下面的评论:
我这样做了,并且在 Eclipse Juno 中运行得很好。
这要归功于 UsulSK。
I found a workaround over on GitHub: https://github.com/jmhofer/eCobertura/issues/8
For those who don't want to click the link, here's the text of the comment:
I did this and it worked quite well in Eclipse Juno.
Credit for this goes to UsulSK.
如果删除覆盖会话,覆盖颜色也会消失。为此,请点击“覆盖范围”视图工具栏中的“删除会话”或“删除所有会话”。
http://eclemma.org/faq.html
If you remove the coverage session, also the coverage coloring will disappear. For this, hit Remove Session or Remove All Sessions in the Coverage view's toolbar.
http://eclemma.org/faq.html
对于那些像我一样使用 Cobertura 并且只有 Coverage Session View 的人,只需尝试关闭 Eclipse 并再次启动它即可。这对我来说不再突出显示。
For those using Cobertura and only have the Coverage Session View like I do,just try closing Eclipse and starting it up again. This got rid of the highlighting for me.
当“编辑 Java 源代码”以“删除活动会话”时,向键绑定添加了快捷键 Ctrl+Shift+XC(窗口 -> 首选项 -> 键过滤器)。
Added shortcut Ctrl+Shift+X C to Keybindings (Window -> Preferences -> filter for Keys) when 'Editing Java Source' for 'Remove Active Session'.
如果您想删除活动会话/项目/文件夹,则可以单击
“覆盖范围”视图工具栏中的“删除活动会话”按钮。
If you would like to remove active session/project/folder then you can follow
Click the "Remove Active Session" button in the toolbar of the "Coverage" view.
我使用了Open Clover工具来进行代码覆盖率,我也找了很长时间。
它非常简单,在“覆盖率浏览器”选项卡中,您可以找到三个方形按钮,其中表示您要显示的代码行,单击“隐藏覆盖率”方框即可消失。下图中最后一个按钮:
I have used the Open Clover Tool for the code coverage, I have also been searching this for a long time.
Its pretty straightforward, in the Coverage Explorer tab, you can find three square buttons which says the code lines you wanted to display, click on hide the coverage square box and its gone. Last button in the image below:
关闭 IDE 并再次打开。如果您没有使用任何代码覆盖率工具并且只是单击 IDE 中的基本“覆盖率”图标,则此方法有效。
Close the IDE and open it again. This works if you did not use any code coverage tools and have just clicked the basic "Coverage" icon in the IDE.