Skip to content

Feature Enhancement: per-file coverage in Explorer, C/C++ Support & visualize branch/region execution#498

Open
mr-u0b0dy wants to merge 11 commits intoryanluker:masterfrom
mr-u0b0dy:master
Open

Feature Enhancement: per-file coverage in Explorer, C/C++ Support & visualize branch/region execution#498
mr-u0b0dy wants to merge 11 commits intoryanluker:masterfrom
mr-u0b0dy:master

Conversation

@mr-u0b0dy
Copy link
Copy Markdown

@mr-u0b0dy mr-u0b0dy commented Dec 21, 2025

Features

  • Explorer coverage badges: per-file coverage percentages with color-coded thresholds (≥80% green, ≥50% yellow, <50% red); configurable via showExplorerCoverage.
  • C/C++ coverage support: parse LLVM-cov JSON and visualize branch/region execution through CodeLens and Hover providers.
  • Hover enhancements: highlight the active coverage region and show the closest region’s execution count; include Cobertura per-line condition coverage details.

Issues

image

…providers

Features:
- Add LLVM-cov JSON parser for C++ coverage with region-wise execution counts
- Add branch coverage CodeLens and Hover providers for partial coverage visualization
- Add C example project with Cobertura XML (gcc + gcovr toolchain)
- Add C++ example project with LLVM JSON (clang + llvm-cov toolchain)

Infrastructure:
- Migrate esbuild.js to esbuild.mjs for ES module support
- Fix test package.json generation to ensure CommonJS output
- Add llvm-cov.json to default coverage file names
- Increase test timeout to 10s for headless xvfb runs
- Add comprehensive unit tests for branch coverage providers
- Add integration tests for C and C++ example projects

Documentation:
- Update README with C/C++ support highlights
- Add detailed C and C++ example READMEs with toolchain setup
- Add RegionHighlighter to emphasize the active LLVM region on hover
- Hover now displays only the closest region’s execution count
- Cobertura: show per-line condition coverage (%, edges covered/total) and per-condition details
- Switch complex regex to RegExp constructor to fix tsc invalid character errors

Build: type-check and bundle pass; lint/format applied
- Add CoverageFileDecorationProvider to display per-file coverage %
- Implement showExplorerCoverage config toggle (default: true)
- Color-code badges: green ≥80%, yellow ≥50%, red <50%
- Support absolute/relative paths and remote path mapping
- Integrate with coverage service update notifications
- Register provider for proper disposal and lifecycle management
- Extract per-line branch hit counts from Cobertura XML and use real counts instead of 0/1
- Fix branch merging to accumulate hit counts instead of incrementing by 1
- Add LLVM JSON support to use actual execution counts for true/false branches
- Add gcovr JSON fallback parser for per-branch coverage with accurate hit counts
- Store branch hit counts in section metadata for accurate hover display
- Generate C example coverage artifacts: Cobertura XML, LCOV, and gcovr JSON

Fixes hover display to show accurate per-branch execution counts instead of generic
coverage summaries. Enables comprehensive branch coverage visualization across multiple
coverage formats (Cobertura, LLVM JSON, gcovr JSON, LCOV).
- Add comprehensive Rust example project with calculator library
- Include sample LLVM JSON coverage report
- Add detailed README with instructions for cargo-tarpaulin and cargo-llvm-cov
- Update main README to list Rust as officially supported language
- Add 'rust' keyword to package.json for better discoverability
- Configure VS Code settings for Rust coverage files

The extension already supports LLVM JSON format, so Rust works
out of the box with tools like cargo-tarpaulin and cargo-llvm-cov.
@ryanluker ryanluker added this to the 2.15.0 milestone Dec 30, 2025
@ryanluker
Copy link
Copy Markdown
Owner

@mr-u0b0dy Massive props for the impactful PR across many open issues!
I have an in progress pull request where I am going through what you have so far (should be done in the next few days).

At first glance, it might be better to split up the PR into 3 parts so that way it will be easier to review and understand the changes you want to make. Thoughts?

In the meantime, I have approved your PR / Branch to use the CI runner so we can start working through any test failures.

@mr-u0b0dy
Copy link
Copy Markdown
Author

I’ve made separate commits for each feature addition, and I hope this makes the review easier. Since these are incremental commits—where upcoming changes depend on files introduced in the first commit—it might be better to include them in a single PR. I’ll proceed with fixing the test failures, and I’m also looking forward to the addition of the line hit count feature (#491).

…nt environments

The python integration test was failing because coverage XML contained relative file
paths but <source> entries specifying the project root. When tests ran in environments
with different workspace roots (CI/Windows), the SectionFinder couldn't match coverage
to the open file.

Changes:
- Extract <source> roots from Cobertura XML
- Expand relative file paths by joining with each <source> root to create absolute variants
- Keep original relative paths for backward compatibility with local environments
- Remove realpath parameter from parseContentCobertura to preserve relative paths during parsing

This ensures coverage matching works across different environment configurations.

Fixes: ryanluker#166 - 'Run display coverage on python test file @integration' failure
@ryanluker
Copy link
Copy Markdown
Owner

I’ve made separate commits for each feature addition, and I hope this makes the review easier. Since these are incremental commits—where upcoming changes depend on files introduced in the first commit—it might be better to include them in a single PR. I’ll proceed with fixing the test failures, and I’m also looking forward to the addition of the line hit count feature (#491).

Alright no worries on the mega PR this time, there might be some process improvements we can do in the future around leveraging stacked PRs for big code additions like this 🤔.
https://abhinav.github.io/git-spice/

@mr-u0b0dy
Copy link
Copy Markdown
Author

Makes sense — stacked PRs sound like a good fit for changes like this. I’ll take a look at git-spice and keep that in mind for future work. Thanks!

@ryanluker
Copy link
Copy Markdown
Owner

ryanluker commented Feb 10, 2026

Makes sense — stacked PRs sound like a good fit for changes like this. I’ll take a look at git-spice and keep that in mind for future work. Thanks!

Review progress wise, I should be able to finish up the review this upcoming weekend.

@ryanluker ryanluker removed this from the 2.15.0 milestone Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants