Skip to content
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

explorer: integrate test coverage bars #198891

Merged
merged 3 commits into from
Nov 27, 2023

Conversation

connor4312
Copy link
Member

@connor4312 connor4312 commented Nov 22, 2023

This adds coverage bars in the explorer view. These are only shown when test coverage is open, and I took some care to avoid any performance hit when it's not. The idle case involves no DOM manipulation and just an observable listener on the test coverage service.

In the explorer, coverage is shown in its 'compact' view which will only render a single bar representing the user's chosen overall test coverage calculation (defaults to a weighted sum of all types of coverage available).

Works with rename, decorations, and ellipses overflow. Screenshot:

image

Detailed coverage information is shown when the user hovers on the coverage bar. We could optionally drop the displayed % number and just let users hover for more detail; a complete overview is available in a dedicated Test Coverage view. Open to suggestions 🙂

I opted to implement this in the explorer files renderer versus in the decoration service, because coverage bars should not be shown anywhere the filename is renderer except for the explorer, unlike other decoration types. Most of this diff is just moving the computed tree creation into the test results service; you can see the existing TestCoverageBars.ts for implementation. (The tree is used to generate combined coverage numbers on e.g. directories where only individual files will generally report coverage)

For #123713

This adds coverage bars in the explorer view. These are only shown when
test coverage is open, and I took some care to avoid any performance
hit when it's not. The idle case involves no DOM manipulation and just
an observable listener on the test result service.

In the explorer, coverage is shown in its 'compact' view which will only
render a single bar representing the user's chosen overall test coverage
calculation (defaults to a weighted sum of all types of coverage
available).

Works with rename, decorations, and ellipses overflow. Screenshot:

For #123713
@@ -67,6 +67,7 @@ import { IHoverService } from 'vs/workbench/services/hover/browser/hover';
import { HoverPosition } from 'vs/base/browser/ui/hover/hoverWidget';
import { IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
import { mainWindow } from 'vs/base/browser/window';
import { TestCoverageBars } from 'vs/workbench/contrib/testing/browser/testCoverageBars';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think conceptually contrib/files should not have a dependency to contrib/testing

@bpasero
Copy link
Member

bpasero commented Nov 23, 2023

This looks fantastic! But I have some concerns with dependencies, can we make this a contributable feature like decorations?

@connor4312
Copy link
Member Author

Done in the most recent commit! Let me know what you think.

@connor4312 connor4312 dismissed bpasero’s stale review November 27, 2023 17:52

moved to a contribution model

@connor4312 connor4312 merged commit 5d33960 into main Nov 27, 2023
6 checks passed
@connor4312 connor4312 deleted the connor4312/coverage-bars-in-explorer branch November 27, 2023 18:01
@connor4312 connor4312 mentioned this pull request Dec 7, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants