Skip to content

Commit 2e3df8a

Browse files
authored
testing: coverage decorations in high contrast, better default behavior for position-only exts (microsoft#202676)
* testing: coverage decorations in high contrast, better default behavior for position-only exts * update snapshot
1 parent c4e96bc commit 2e3df8a

File tree

5 files changed

+53
-19
lines changed

5 files changed

+53
-19
lines changed

build/lib/stylelint/vscode-known-variables.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,9 @@
680680
"--vscode-terminalOverviewRuler-findMatchForeground",
681681
"--vscode-terminalStickyScroll-background",
682682
"--vscode-terminalStickyScrollHover-background",
683-
"--vscode-testing-coveredBackground",
684683
"--vscode-testing-coverage-lineHeight",
684+
"--vscode-testing-coveredBackground",
685+
"--vscode-testing-coveredBorder",
685686
"--vscode-testing-coveredGutterBackground",
686687
"--vscode-testing-iconErrored",
687688
"--vscode-testing-iconFailed",
@@ -697,6 +698,7 @@
697698
"--vscode-testing-peekHeaderBackground",
698699
"--vscode-testing-runAction",
699700
"--vscode-testing-uncoveredBackground",
701+
"--vscode-testing-uncoveredBorder",
700702
"--vscode-testing-uncoveredGutterBackground",
701703
"--vscode-textBlockQuote-background",
702704
"--vscode-textBlockQuote-border",

src/vs/workbench/contrib/testing/browser/codeCoverageDecorations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ export class CoverageDetailsModel {
452452
// and trailing whitespace.
453453
function tidyLocation(location: Range | Position): Range {
454454
if (location instanceof Position) {
455-
return Range.fromPositions(location);
455+
return Range.fromPositions(location, new Position(location.lineNumber, 0x7FFFFFFF));
456456
}
457457

458458
return location;

src/vs/workbench/contrib/testing/browser/media/testing.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,19 @@
430430

431431
.coverage-deco-gutter.coverage-deco-hit::before {
432432
background: var(--vscode-testing-coveredGutterBackground);
433+
border-color: var(--vscode-testing-coveredGutterBackground);
433434
}
434435

435436
.coverage-deco-gutter.coverage-deco-miss::before {
436437
background: var(--vscode-testing-uncoveredGutterBackground);
438+
border-color: var(--vscode-testing-uncoveredGutterBackground);
439+
}
440+
441+
.hc-light .coverage-deco-gutter::before,
442+
.hc-black .coverage-deco-gutter::before {
443+
border-width: 3px 0 3px 5px;
444+
border-style: solid;
445+
background: none;
437446
}
438447

439448
.coverage-deco-gutter.coverage-deco-miss.coverage-deco-hit::before {
@@ -456,10 +465,17 @@
456465

457466
.coverage-deco-inline.coverage-deco-hit {
458467
background: var(--vscode-testing-coveredBackground);
468+
outline: 1px solid var(--vscode-testing-coveredBorder);
459469
}
460470

461471
.coverage-deco-inline.coverage-deco-miss {
462472
background: var(--vscode-testing-uncoveredBackground);
473+
outline: 1px solid var(--vscode-testing-uncoveredBorder);
474+
}
475+
476+
.hc-light .coverage-deco-inline.coverage-deco-hit,
477+
.hc-black .coverage-deco-inline.coverage-deco-hit {
478+
outline-style: dashed;
463479
}
464480

465481
.coverage-deco-branch-miss-indicator {

src/vs/workbench/contrib/testing/browser/theme.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { Color, RGBA } from 'vs/base/common/color';
77
import { localize } from 'vs/nls';
8-
import { contrastBorder, diffInserted, diffRemoved, editorBackground, editorErrorForeground, editorForeground, editorInfoForeground, opaque, registerColor, transparent } from 'vs/platform/theme/common/colorRegistry';
8+
import { chartsGreen, chartsRed, contrastBorder, diffInserted, diffRemoved, editorBackground, editorErrorForeground, editorForeground, editorInfoForeground, opaque, registerColor, transparent } from 'vs/platform/theme/common/colorRegistry';
99
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
1010
import { TestMessageType, TestResultState } from 'vs/workbench/contrib/testing/common/testTypes';
1111

@@ -93,11 +93,18 @@ export const testingCoveredBackground = registerColor('testing.coveredBackground
9393
hcLight: null
9494
}, localize('testing.coveredBackground', 'Background color of text that was covered.'));
9595

96+
export const testingCoveredBorder = registerColor('testing.coveredBorder', {
97+
dark: transparent(testingCoveredBackground, 0.75),
98+
light: transparent(testingCoveredBackground, 0.75),
99+
hcDark: contrastBorder,
100+
hcLight: contrastBorder
101+
}, localize('testing.coveredBorder', 'Border color of text that was covered.'));
102+
96103
export const testingCoveredGutterBackground = registerColor('testing.coveredGutterBackground', {
97104
dark: transparent(diffInserted, 0.6),
98105
light: transparent(diffInserted, 0.6),
99-
hcDark: null,
100-
hcLight: null
106+
hcDark: chartsGreen,
107+
hcLight: chartsGreen
101108
}, localize('testing.coveredGutterBackground', 'Gutter color of regions where code was covered.'));
102109

103110
export const testingUncoveredBranchBackground = registerColor('testing.uncoveredBranchBackground', {
@@ -114,11 +121,18 @@ export const testingUncoveredBackground = registerColor('testing.uncoveredBackgr
114121
hcLight: null
115122
}, localize('testing.uncoveredBackground', 'Background color of text that was not covered.'));
116123

124+
export const testingUncoveredBorder = registerColor('testing.uncoveredBorder', {
125+
dark: transparent(testingUncoveredBackground, 0.75),
126+
light: transparent(testingUncoveredBackground, 0.75),
127+
hcDark: contrastBorder,
128+
hcLight: contrastBorder
129+
}, localize('testing.uncoveredBorder', 'Border color of text that was not covered.'));
130+
117131
export const testingUncoveredGutterBackground = registerColor('testing.uncoveredGutterBackground', {
118132
dark: transparent(diffRemoved, 1.5),
119133
light: transparent(diffRemoved, 1.5),
120-
hcDark: null,
121-
hcLight: null
134+
hcDark: chartsRed,
135+
hcLight: chartsRed
122136
}, localize('testing.uncoveredGutterBackground', 'Gutter color of regions where code not covered.'));
123137

124138
export const testMessageSeverityColors: {
@@ -168,19 +182,13 @@ registerThemingParticipant((theme, collector) => {
168182
const missBadgeBackground = editorBg && theme.getColor(testingUncoveredBackground)?.transparent(2).makeOpaque(editorBg);
169183

170184
collector.addRule(`
171-
.coverage-deco-inline.coverage-deco-hit {
172-
outline: 1px solid ${theme.getColor(testingCoveredBackground)?.transparent(0.75)};
173-
}
174185
.coverage-deco-inline.coverage-deco-hit.coverage-deco-hovered {
175186
background: ${theme.getColor(testingCoveredBackground)?.transparent(1.3)};
176-
outline: 1px solid ${theme.getColor(testingCoveredBackground)?.transparent(2)};
177-
}
178-
.coverage-deco-inline.coverage-deco-miss {
179-
outline: 1px solid ${theme.getColor(testingUncoveredBackground)?.transparent(0.75)};
187+
outline-color: ${theme.getColor(testingCoveredBorder)?.transparent(2)};
180188
}
181189
.coverage-deco-inline.coverage-deco-miss.coverage-deco-hovered {
182190
background: ${theme.getColor(testingUncoveredBackground)?.transparent(1.3)};
183-
outline: 1px solid ${theme.getColor(testingUncoveredBackground)?.transparent(2)};
191+
outline-color: ${theme.getColor(testingUncoveredBorder)?.transparent(2)};
184192
}
185193
.coverage-deco-branch-miss-indicator::before {
186194
border-color: ${missBadgeBackground?.transparent(1.3)};
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
[
22
{
3-
range: "[2,0 -> 2,0]",
3+
range: "[1,0 -> 2,0]",
4+
count: 1
5+
},
6+
{
7+
range: "[2,0 -> 2,2147483647]",
48
count: 2
59
},
610
{
7-
range: "[1,0 -> 4,0]",
11+
range: "[2,2147483647 -> 4,0]",
812
count: 1
913
},
1014
{
11-
range: "[4,3 -> 4,3]",
15+
range: "[4,0 -> 4,3]",
16+
count: 3
17+
},
18+
{
19+
range: "[4,3 -> 4,2147483647]",
1220
count: 4
1321
},
1422
{
15-
range: "[4,0 -> 5,0]",
23+
range: "[4,2147483647 -> 5,0]",
1624
count: 3
1725
}
1826
]

0 commit comments

Comments
 (0)