Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Intellij Idea Coverage display full colored lines?

In Eclipse, most of the coverage plugins, display covered/partially covered/uncovered lines with different colors (i.e. the whole line painted with a color)

In IntelliJ Idea, I couldn't find a way yet to paint the whole line with a descriptive color, only a small, almost imperceptible mark is added on the left hand side, making the visualization of partially covered / uncovered lines really difficult.

Any idea?

like image 992
Clint Eastwood Avatar asked Oct 02 '15 12:10

Clint Eastwood


People also ask

How do I see line coverage in IntelliJ?

Coverage in the Coverage tool window If you want to reopen the Coverage tool window, select Run | Show Code Coverage Data from the main menu, or press Ctrl+Alt+F6 . The report shows the percentage of the code that has been executed or covered by tests. You can see the coverage result for classes, methods, and lines.

How do I highlight code coverage in IntelliJ?

To enable code coverage highlighting In the IDEA IDE, on the Analyze menu, click Show Code Coverage Data, or use the Ctrl+Alt+F6 keyboard shortcut.

How do I know which lines are not covered in IntelliJ?

When you open a source file you can also see what lines are fully covered, partially covered, or not covered at all. You might want to customize the Colors & Fonts through File -> Settings -> Editor -> Colors & Fonts -> General modifying the following entries: Full line coverage. Partial line coverage.


2 Answers

I found the solution to this problem here but I thought it would be better to create a specific, well-phrased question so that people having exactly the same problem as me can find it better in Google / StackOverflow.

In a nutshell, through Editor -> Colors & Fonts -> General (or, at least from IntelliJ 2017.3 onwards, Editor -> Colors Scheme -> General)

you can customize the Colors & Fonts used for covered/partially covered/uncovered lines, modifying the background of the following entries:

  • Full line coverage
  • Partial line coverage
  • Uncovered line

Color configuration for Code Coverage in IntelliJ Idea

For example, I wanted to use the same default colors already provided but not only on the margin but on the whole line (similar to how Eclipse does it), so I disabled "Foreground" and enabled "Background". Voilà!

Whole lines painted in easy-to-view colors

like image 119
Clint Eastwood Avatar answered Oct 02 '22 10:10

Clint Eastwood


I think the UI has been updated the the way to get to this option has changed. While it is already mentioned by others, I'd like to elaborate with a more detailed image to make it easier to see.

Intellij > Preferences > Editor > Color Scheme > General > Line Coverage > 

There you will have three options.

  • Full
  • Partial
  • Uncovered

Here is the menu option: Line Coverage Menu Option

And here is what the question is specifically looking for: Line Coverage Background Coloring Menu Option

like image 31
AzzamAziz Avatar answered Oct 02 '22 09:10

AzzamAziz