Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ demo-python-project/
# Local dev scripts (not part of the extension)
scripts/verify-sqlite-parse.mjs

# Original/archived assets — not shipped in the extension
assets/archive/

# macOS
.DS_Store

Expand Down
60 changes: 33 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,33 @@ You run `pytest`. You get 73%. But 27% of what? Finding uncovered lines means op

## Features

**Inline highlights** — green line backgrounds for covered lines, red for missed, with overview ruler markers so you can scan an entire file at a glance without scrolling.
**Auto-run on test save** — write a test, hit save, and pytest runs automatically in the background. No terminal, no command — the extension detects the file change, waits 2 seconds for you to finish typing, then kicks off a full coverage run. The status bar shows a spinner while it runs so you always know something is happening. Turn it off via `autoRunOnTestChange` if your suite is too slow to run on every save.

<!-- demo GIF: record opening a Python file after Show Coverage, showing green/red line backgrounds appearing -->
<img src="assets/feature-auto-run.png" width="420" />

**CodeLens** — a live coverage percentage appears above every `def` and `class` as you work. See a function's coverage without opening any report.
**Inline highlights** — covered lines get a green background, missed lines get red, and overview ruler markers appear along the right edge so you can spot gaps in a file without scrolling a single line. Open any Python file after running coverage and the highlights are already there.

<!-- demo GIF: record CodeLens percentages above def/class lines -->
<img src="assets/feature-highlights.png" width="700" />

**Hover tooltips** — hover any highlighted line for an instant ✓ Covered or ✗ Not covered message.
**Interactive dashboard** — a full coverage report inside VS Code, no browser needed. The ring chart shows your overall percentage at a glance; the file table lists every file sorted by coverage with a progress bar per row. Click any filename and the editor jumps straight to that file.

**Interactive dashboard** — an SVG ring chart, overall stats, and a sortable file table. Click any filename to jump straight to it in the editor.
<img src="assets/feature-dashboard.png" width="700" />

<!-- demo GIF: record opening dashboard and clicking a file row -->
**CodeLens** — a coverage percentage appears above every `def` and `class` as you work, updated live whenever coverage changes. At a glance you can see which functions are well-tested and which are being ignored, without opening any report.

**Sidebar tree view** — a persistent Coverage panel in the Explorer sidebar shows every file with a pass / warn / fail icon. Always visible, always current.
<img src="assets/feature-codelens.png" width="600" />

**Status bar** — your total coverage percentage sits in the status bar. Click it to open the dashboard.
**Sidebar tree view** — the Coverage panel in the Explorer sidebar stays open as you work and shows every file with a green check, yellow warning, or red cross depending on your configured thresholds. No need to open the dashboard to know where you stand.

**Auto-reload** — file watchers detect changes to your coverage file and refresh all decorations instantly. Run your tests, save — done.
<img src="assets/feature-sidebar.png" width="380" />

**Hover tooltips** — hover any highlighted line and a tooltip confirms whether that exact line is covered or not. Useful when you want to verify that a specific branch or edge case was actually exercised by your tests.

<img src="assets/feature-hover.png" width="500" />

**Status bar** — your overall coverage percentage sits in the bottom status bar at all times. Click it to open the dashboard. When a coverage run is in progress the percentage is replaced with a spinner so you know it's updating.

<img src="assets/feature-status-bar.png" width="420" />

---

Expand All @@ -53,19 +61,16 @@ Search for **Python Coverage Visualizer** in the Extensions panel (`Cmd+Shift+X`
## Quick Start

1. Install pytest-cov in your Python project:

```bash
pip install pytest-cov
```

2. Run your tests and generate coverage:
```bash
pytest --cov=. --cov-report=json
```
2. Open the Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) and run **Coverage Visualizer: Show Coverage**. The extension runs pytest and generates coverage automatically.

3. In VS Code, open the Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) and run:
**Coverage Visualizer: Show Coverage**
3. Green and red highlights appear across all open Python files immediately.

Green and red highlights appear across all open Python files immediately.
From this point, save any test file and coverage updates on its own — no command needed.

---

Expand All @@ -83,13 +88,14 @@ Green and red highlights appear across all open Python files immediately.

Open **Settings** (`Cmd+,`) and search for **Coverage Visualizer**, or add to `settings.json`:

| Setting | Default | Description |
| -------------------------------------------- | ------------------------- | ------------------------------------------------------ |
| `coverageVisualizer.thresholdGood` | `80` | % at or above which a file shows green in the sidebar |
| `coverageVisualizer.thresholdWarn` | `50` | % at or above which a file shows yellow (below → red) |
| `coverageVisualizer.coveredHighlightColor` | `rgba(0, 180, 0, 0.10)` | Background color for covered lines |
| `coverageVisualizer.uncoveredHighlightColor` | `rgba(220, 50, 50, 0.10)` | Background color for uncovered lines |
| `coverageVisualizer.enableCodeLens` | `true` | Show coverage % above `def` / `class` definitions |
| `coverageVisualizer.enableHoverMessages` | `true` | Show covered / not-covered tooltip on hover |
| `coverageVisualizer.autoReloadOnChange` | `true` | Auto-reload decorations when coverage files change |
| `coverageVisualizer.coverageJsonPath` | `coverage.json` | Path to coverage.json relative to workspace root |
| Setting | Default | Description |
| -------------------------------------------- | ------------------------- | ------------------------------------------------------------------------------------- |
| `coverageVisualizer.autoRunOnTestChange` | `true` | Re-run pytest automatically when a test file is saved |
| `coverageVisualizer.autoReloadOnChange` | `true` | Auto-reload decorations when coverage files change on disk |
| `coverageVisualizer.thresholdGood` | `80` | % at or above which a file shows green in the sidebar |
| `coverageVisualizer.thresholdWarn` | `50` | % at or above which a file shows yellow (below → red) |
| `coverageVisualizer.excludeTestFiles` | `true` | Skip highlights and CodeLens on test files (`test_*.py`, `*_test.py`, `tests/` dirs) |
| `coverageVisualizer.enableCodeLens` | `true` | Show coverage % above `def` / `class` definitions |
| `coverageVisualizer.enableHoverMessages` | `true` | Show covered / not-covered tooltip on hover |
| `coverageVisualizer.coveredHighlightColor` | `rgba(0, 180, 0, 0.10)` | Background color for covered lines |
| `coverageVisualizer.uncoveredHighlightColor` | `rgba(220, 50, 50, 0.10)` | Background color for uncovered lines |
Binary file modified assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/feature-auto-run.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/feature-codelens.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/feature-dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/feature-highlights.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/feature-hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/feature-sidebar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/feature-status-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "coverage-visualizer",
"displayName": "Python Coverage Visualizer",
"description": "Visualize Python test coverage inline in VS Code — highlights, CodeLens, dashboard, and sidebar tree view",
"version": "1.1.0",
"version": "1.1.1",
"publisher": "kool7",
"engines": {
"vscode": "^1.90.0"
Expand Down
Loading