Skip to content

Debounce bug: file blame isn't cleared when editing document while text in output window changes #2663

@russelldavis

Description

@russelldavis

Description

Repro steps:

  1. Run "Gitlens: Enable debug logging" command
  2. Open the Output panel in VS Code and select "GitLens" in the dropdown to see the debug logs
  3. Turn on File Blame (run the "Gitlens: Toggle File Blame" command)
  4. Type a character to edit the current file

Expected: The File Blame annotations should disappear.
Actual: The File Blame annotations remain, and editing becomes janky (newly typed characters appear inside the blame gutter).

I did some debugging and tracked this down to a problem with the debounce behavior for the onTextDocumentChanged event at

workspace.onDidChangeTextDocument(debounce(this.onTextDocumentChanged, 50), this),

The problem is that it is debouncing events that can come from different sources. In this case, a change event is first fired for the active file. Then, within the debounce timeframe, a change event is fired for the output window. so the first event (from the active file) gets dropped. The event for the output window gets processed, but since it's for the output window, it doesn't have any effect.

GitLens Version

13.5.0

VS Code Version

Version: 1.78.0
Commit: 252e5463d60e63238250799aef7375787f68b4ee
Date: 2023-05-03T20:15:29.774Z
Electron: 22.4.8
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 22.4.0
Sandboxed: No

Git Version

2.39.1

Logs, Screenshots, Screen Captures, etc

Screenshot 2023-05-07 at 11 07 28 PM

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions