diff --git a/.gitignore b/.gitignore index 7f1c42d..e2cedd3 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/README.md b/README.md index 4bb3d25..b4e23fd 100644 --- a/README.md +++ b/README.md @@ -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. - + -**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. - + -**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. + - +**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. + -**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. + + +**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. + + + +**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. + + --- @@ -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. --- @@ -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 | diff --git a/assets/demo.gif b/assets/demo.gif index b62d2e1..1d21ed8 100644 Binary files a/assets/demo.gif and b/assets/demo.gif differ diff --git a/assets/feature-auto-run.png b/assets/feature-auto-run.png new file mode 100644 index 0000000..9c5413c Binary files /dev/null and b/assets/feature-auto-run.png differ diff --git a/assets/feature-codelens.png b/assets/feature-codelens.png new file mode 100644 index 0000000..3d92088 Binary files /dev/null and b/assets/feature-codelens.png differ diff --git a/assets/feature-dashboard.png b/assets/feature-dashboard.png new file mode 100644 index 0000000..604f1b5 Binary files /dev/null and b/assets/feature-dashboard.png differ diff --git a/assets/feature-highlights.png b/assets/feature-highlights.png new file mode 100644 index 0000000..a8f38e9 Binary files /dev/null and b/assets/feature-highlights.png differ diff --git a/assets/feature-hover.png b/assets/feature-hover.png new file mode 100644 index 0000000..e0edb1a Binary files /dev/null and b/assets/feature-hover.png differ diff --git a/assets/feature-sidebar.png b/assets/feature-sidebar.png new file mode 100644 index 0000000..7f8e274 Binary files /dev/null and b/assets/feature-sidebar.png differ diff --git a/assets/feature-status-bar.png b/assets/feature-status-bar.png new file mode 100644 index 0000000..9a2b16a Binary files /dev/null and b/assets/feature-status-bar.png differ diff --git a/package-lock.json b/package-lock.json index c639780..089290e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coverage-visualizer", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coverage-visualizer", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "dependencies": { "sql.js": "^1.14.1" diff --git a/package.json b/package.json index 0e09430..fd8c551 100644 --- a/package.json +++ b/package.json @@ -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"