|
Format | Search pattern | Fragments highlighting |
---|---|---|
LCOV | coverage/lcov*.info |
No |
Istanbul | coverage/coverage-final.json |
Yes |
Cobertura | cov*.xml |
No |
Highlight examples
Appearance depends on your code coverage format and configuration.
Code with highlighted fragments
Istanbul file is providing fragment highlighting:

Code with highlighted lines
The LCOV format was used there. Only uncovered lines were highlighted. This format doesn't support fragment highlighting:

Alternative appearance
You can enable wholeLine
mode. It will look especially good when your coverage format doesn't support fragments:

Status bar
Whereas extension be able to find coverage file, it will add icon to your status bar. There will be average code coverage percentage. Click on eye-icon will switch coverage displaying.

Configuration
You can adjust some of the configuration options.
Coverage report files
The extension will search coverage report files at start. Also it will start file system watcher. When file with target pattern will be changed, this extension will try to read it.
"vscode-coverage-highlighter.files": [
"coverage/coverage-final.json",
"coverage/lcov*.info",
"cov*.xml"
]
Show coverage by-default
When the target files would be found, should extension highlight coverage immediately? Coverage could be hidden instead. Click on eye on status bar will highlight coverage.
"vscode-coverage-highlighter.defaultState": "enable"
Highlight whole line or text only
This is an appearance option. When it is the true, a line will be highlighted wholly. Otherwise, only text will be highlighted.
"vscode-coverage-highlighter.wholeLine": false
The colors
The extension supports two colors. For covered and uncovered lines. It would be optimal to write colors in rgba notation. Because highlight with alpha channel wouldn't hide the other decorations.
You also can disable one or more colors completely. Just pass empty string for color and decoration won't be shown.
"vscode-coverage-highlighter.coveredColor": "rgba(20, 250, 20, 0.1)",
"vscode-coverage-highlighter.unCoveredColor": "rgba(255, 20, 20, 0.4)"
Show diagnostic messages
You also can enable following option to show diagnostic information on your Problems
tab. Each uncovered range will be mentioned there.
"vscode-coverage-highlighter.showDiagnostic": false
Commands
Open the Command Palette
and type Code Coverage
- Toggle coverage display: When text has been highlighted it will hide highlighting. By clicking on eye on your status bar you can do the same.