Skip to content

Commit

Permalink
src/goCover.go: add go.coverMode to display coverage data and counts
Browse files Browse the repository at this point in the history
Provide an option, go.coverMode, to change the value for -covermode.
Provide the option for the user to display borders around covered and
uncovered code. These are named 'coveredBorderColor' and
'unocveredBorderColor' and default to the same colors used as
backgrounds. The boolean option go.coverShowCounts show how often each
block of code was executed by the tests.

Fixes #256.

Change-Id: I551e0682d0db1e31dc07a2ae9b44ad94f66bbf18
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/247769
Run-TryBot: Peter Weinberger <pjw@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
  • Loading branch information
pjweinbgo committed Aug 19, 2020
1 parent d41272c commit 139fd7d
Show file tree
Hide file tree
Showing 4 changed files with 230 additions and 66 deletions.
10 changes: 9 additions & 1 deletion docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,17 @@ If true, shows test coverage when Go: Test Single File command is run.

If true, shows test coverage when Go: Test Package command is run.

### `go.coverMode`

When generating code coverage, the value for -covermode: 'set', 'count', 'atomic'

### `go.coverShowCounts`

When generating code coverage, should counts be shown as --374--

### `go.coverageDecorator`

This option lets you choose the way to display code coverage. Choose either to highlight the complete line or to show a decorator in the gutter. You can customize the color for the former and the style for the latter.
This option lets you choose the way to display code coverage. Choose either to highlight the complete line or to show a decorator in the gutter. You can customize the color and border for the former and the style for the latter.

### `go.coverageOptions`

Expand Down
35 changes: 28 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,22 @@
"default": false,
"description": "If true, shows test coverage when Go: Test Single File command is run."
},
"go.coverMode": {
"type": "string",
"enum:": [
"set",
"count",
"atomic"
],
"default": "set",
"description": "When generating code coverage, the value for -covermode: 'set', 'count', 'atomic'",
"scope": "resource"
},
"go.coverShowCounts": {
"type": "boolean",
"default": false,
"description": "When generating code coverage, should counts be shown as --374--"
},
"go.coverageOptions": {
"type": "string",
"enum": [
Expand All @@ -1325,25 +1341,29 @@
"properties": {
"type": {
"type": "string",
"default": "highlight",
"enum": [
"highlight",
"gutter"
]
},
"coveredHighlightColor": {
"type": "string",
"default": "rgba(64,128,128,0.5)",
"description": "Color in the rgba format to use to highlight covered code."
},
"uncoveredHighlightColor": {
"type": "string",
"default": "rgba(128,64,64,0.25)",
"description": "Color in the rgba format to use to highlight uncovered code."
},
"coveredBorderColor": {
"type": "string",
"description": "Color to use for the border of covered code."
},
"uncoveredBorderColor": {
"type": "string",
"description": "Color to use for the border of uncovered code."
},
"coveredGutterStyle": {
"type": "string",
"default": "blockblue",
"enum": [
"blockblue",
"blockred",
Expand All @@ -1362,7 +1382,6 @@
},
"uncoveredGutterStyle": {
"type": "string",
"default": "blockblue",
"enum": [
"blockblue",
"blockred",
Expand All @@ -1385,10 +1404,12 @@
"type": "highlight",
"coveredHighlightColor": "rgba(64,128,128,0.5)",
"uncoveredHighlightColor": "rgba(128,64,64,0.25)",
"coveredBorderColor": "rgba(64,128,128,0.5)",
"uncoveredBorderColor": "rgba(128,64,64,0.25)",
"coveredGutterStyle": "blockblue",
"uncoveredGutterStyle": "slashyellow"
},
"description": "This option lets you choose the way to display code coverage. Choose either to highlight the complete line or to show a decorator in the gutter. You can customize the color for the former and the style for the latter.",
"description": "This option lets you choose the way to display code coverage. Choose either to highlight the complete line or to show a decorator in the gutter. You can customize the colors for the former and the style for the latter.",
"scope": "resource"
},
"go.testTimeout": {
Expand Down Expand Up @@ -2011,4 +2032,4 @@
]
}
}
}
}
Loading

0 comments on commit 139fd7d

Please sign in to comment.