Add "Go to Next/Previous Uncovered Line" navigation for Test Coverage#269505
Conversation
Implements [microsoft#258967](https://github.com/obrobrio2000/vscode/issues/258967) - Add commands to navigate to next/previous uncovered lines - Add navigation buttons to coverage toolbar widget - Add keyboard shortcuts (Alt+F9 / Shift+Alt+F9) - Navigation wraps around at file boundaries - Buttons appear in coverage toolbar and editor title menu This feature helps developers efficiently review coverage gaps by allowing them to jump between uncovered lines without manual scrolling through the file. Signed-off-by: Giovanni Magliocchetti <[email protected]>
There was a problem hiding this comment.
Pull Request Overview
This PR adds keyboard shortcuts and UI navigation buttons to jump between uncovered lines in VS Code's test coverage view, making it easier for developers to navigate through untested code sections.
- Adds two new commands for navigating to next/previous uncovered lines with Alt+F9 and Shift+Alt+F9 keybindings
- Implements navigation logic in the CodeCoverageDecorations class to find and jump to missed coverage lines
- Adds up/down arrow buttons to the coverage toolbar widget for UI-based navigation
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/testing/common/constants.ts | Adds command IDs for the new navigation commands |
| src/vs/workbench/contrib/testing/browser/codeCoverageDecorations.ts | Implements navigation methods and registers Action2 commands with keybindings and menu items |
src/vs/workbench/contrib/testing/browser/codeCoverageDecorations.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/testing/browser/codeCoverageDecorations.ts
Outdated
Show resolved
Hide resolved
…ns.ts Co-authored-by: Copilot <[email protected]>
- Add proper sorting of missed lines by line number - Fix corrupted control flow in previous/back navigation - Add missing variable declarations - Remove duplicate/incorrect conditional blocks This fixes the navigation to work correctly with properly ordered missed lines. Signed-off-by: Giovanni Magliocchetti <[email protected]>
src/vs/workbench/contrib/testing/browser/codeCoverageDecorations.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/testing/browser/codeCoverageDecorations.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Giovanni Magliocchetti <[email protected]>
|
There are some compile errors: |
- Add static ID property to CodeCoverageDecorations class - Remove unused isMissedLine method (logic handled inline) - Fixes TypeScript compilation errors Signed-off-by: Giovanni Magliocchetti <[email protected]>
Head branch was pushed to by a user without write access
f33d35e
| const BRANCH_MISS_INDICATOR_CHARS = 4; | ||
|
|
||
| export class CodeCoverageDecorations extends Disposable implements IEditorContribution { | ||
| public static readonly ID = 'editor.contrib.coverageDecorations'; |
There was a problem hiding this comment.
This is already available via the constants enum Testing.CoverageDecorationsContributionId
Signed-off-by: Giovanni Magliocchetti <[email protected]>
|
Still some errors -- these should be shown in your vscode window if you have the eslint extension installed:
|
Signed-off-by: Giovanni Magliocchetti <[email protected]>
Fixes #258967
Related to #258961
Description
Adds navigation buttons and keyboard shortcuts to jump between uncovered lines in the test coverage view.
Changes
New Commands:
testing.coverage.goToNextMissedLine(Alt+F9)testing.coverage.goToPreviousMissedLine(Shift+Alt+F9)UI Enhancements:
Navigation Behavior:
Implementation Details
The implementation follows VS Code's existing navigation patterns (similar to "Go to Next Error"):
CodeCoverageDecorationsclass iterate through decorations marked withCLASS_MISSICommandServiceTesting
To test: