Repository: vscode
Issue: Improvements to in-editor view of code coverage
Labels: polish,testing,test-coverage

<!-- ⚠️⚠️ Do Not Delete This! feature_request_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- Please search existing issues to avoid creating duplicates. -->

<!-- Describe the feature you'd like. -->

While integrating Bazel's coverage reporting with VS Code's new coverage support (see https://github.com/bazelbuild/vscode-bazel/pull/366), I came across a couple of potential smaller UI/UX improvements. 

### Execution counts destroy code indentation

The counters which show how frequently a line / statement was executed lead to misaligned code.

![unaligned_cropped](https://github.com/microsoft/vscode/assets/6820896/7dcd9dff-c56e-4a9d-aa4b-d1488e2b5d6d)

In the screenshot above, this is particularly visible when looking at lines 37 and 39. While the `if` is aligned with the closing `}` in the original source code, this indentation gets distorted by the "1x" annotation on line 37.

For Java code this is only a smaller annoyance. For languages which rely on indentation for semantics (like Python), this makes the code much harder to understand.

**Proposed solution:** Render the annotation at the end of the covered region instead of at the beginning, as shown in the following mockup

![aligned_with_counts_cropped](https://github.com/microsoft/vscode/assets/6820896/7158e07f-b94c-4a17-8898-0873d8932353)

Thereby, the coverage annotations don't distort the indentation and the indentation of the `if` still matches the closing `}`. This would also work nicely for coverage providers which provide statement coverage, i.e. with multiple separate regions within a single line.

### Highlight complete lines for line coverage

Bazel and LCOV in general only provide line coverage and no statement coverage.
Currently, VS Code's UI seems to be tailored towards statement coverage, though: It highlights only parts of the line.
This leads to a visually rather "jagged" perception given each line has a different line lenhgt.

I would find it more visually appealing, if the complete line was colored (also including the empty space to the right of each line), similarly to how the complete lines in a git diff are highlighted as shown in this screenshot:

![full line highlight_cropped](https://github.com/microsoft/vscode/assets/6820896/7109ad6e-aec8-4949-a328-666c0e9dedb7)

**Proposed solution**: Detect if a file only contains per-line coverage data (i.e. all `position.column` values are 0). If so, switch to coloring complete lines. It is important to do this detection on a per-file level and not on a per-coverage-report level, because Bazel can provide coverage runs across languages (Java, C++, ...) and hence for some files we might only line coverage, while for other files we might have statement coverage.

### Tooltips on coverage regions provide little information

![image](https://github.com/microsoft/vscode/assets/6820896/3f920ca0-1de4-4d06-8ee3-82a7ec107476)

The text "was executed" provides no additional information. Whether the line is covered can already be seen based on the color. Similarly, execution counts (if available) are already visible in the code editor. Instead of this hover information, I would prefer to keep seeing the normal hovers provided by the language server.

**Proposed solution**: maybe just remove those tooltips?

### Tooltips with branch coverage are inconsistent

There seem to be two different tooltips, as soon as branch coverage is available. When hovering on the line itself, we get:

![image](https://github.com/microsoft/vscode/assets/6820896/4bef444b-49b4-48fb-809c-e00afab01fcb)

But when hovering the red "?" mark towards the end of the line, there is more information in the tooltip:

![image](https://github.com/microsoft/vscode/assets/6820896/69f5cad0-9af7-4ac4-ac24-e9f6d0842b6c)

**Proposed solution**: Remove the tooltip on the line itself (I want to see my language server's hovers instead) and only show it when hovering the red question mark?

### Tooltips on line numbers hide the source code

The tooltip on the line numbers hides the actual source code.

https://github.com/microsoft/vscode/assets/6820896/5761bea3-1e11-46b5-9216-92528e6b14fa

This is a bit annoying, since I hover over the coverage gutter to see more information, but then the tooltip actually hides information, i.e. the source code.

**Proposed solution**: Maybe move the "Toggle inline coverage" button somewhere else? E.g., in this menu

![image](https://github.com/microsoft/vscode/assets/6820896/116fed6c-a3b3-440d-8e4c-367f4a483f3f)

or even as another button directly next to the "Split Editor" button visible in the above screenshot