Ensure editor is visible before measuring block decorations #854
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Identify the Bug
The bug is probably the cause of this issue in the
github
package.Description of the Change
For the reasons described in the link above, this change is certainly more correct than what we already had:
measureBlockDecorations
is to pre-compute the heights of certain editor additions (like the “stage hunk” controls in thegithub
diff view that exhibits the bug)0
values for things that definitely would have height if the editor were visibleBut how do we know this fixes the issue? After all, the fact that this code block is being run before the editor is visible seems like it’s a bug in itself!
Perhaps so, but
updateSync
code pathupdateSync
when the editor is not yet visible, it’s safe to assume that there will be later trip through the same code path, hence another opportunity to measure the block decorations when they will be more accurateAlternate Designs
This was the only fix I could think of that didn’t involve doing a deep dive into the exact timing of editors being hidden and shown as a result of changing tabs in a workspace pane.
Possible Drawbacks
I can’t think of any. Any scenarios that could be affected negatively by this code change are scenarios in which this bug was already manifesting. At worst it’s a lateral move!
Verification Process
My comment linked above illustrates one way I was able to trigger this bug. I can attest that those instructions didn’t reproduce the bug anymore once this fix was applied. But I advise you to try it on your own.
Release Notes
Fix a measurement issue that was causing visual glitches in the
github
package’s diff views.