-
Notifications
You must be signed in to change notification settings - Fork 37.2k
Add "Go to Next/Previous Uncovered Line" navigation for Test Coverage #269505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 <giovimag123@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <175728472+Copilot@users.noreply.github.com>
- 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 <giovimag123@gmail.com>
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 <giovimag123@gmail.com>
connor4312
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm thanks!
|
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 <giovimag123@gmail.com>
Head branch was pushed to by a user without write access
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already available via the constants enum Testing.CoverageDecorationsContributionId
Signed-off-by: Giovanni Magliocchetti <giovimag123@gmail.com>
|
Still some errors -- these should be shown in your vscode window if you have the eslint extension installed:
|
Signed-off-by: Giovanni Magliocchetti <giovimag123@gmail.com>
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: