editor: Defer rendering the git blame popover until after the markdown is parsed#52231
Conversation
896450e to
e8a1c89
Compare
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
Thank you for the idea.
Roughly estimating, we have 63 occurrences of Entity<Markdown>, which means we have to fix them all?
Would it make more sense to show an empty div() in the markdown's rendering if it's not parsed yet instead?
It seems to me that this is already effectively what's happening, with the popover only very briefly fitting above the blame annotation while it doesn't yet contain the markdown, but it needing too much vertical space and therefore being rendered below the blame annotation once the markdown has been parsed.
Yeah, fair, maybe there are other places where we might want to do something similar. Though I think this one is particularly noticeable because of the aforementioned way the position of the blame popover is determined. It's not super obvious tot me that not rendering the thing that contains markdown before the markdown has been parsed is the right behavior in every place that markdown is being rendered? |
Yep, apologies, the PR description was a bit light on details, it could have been clearer.
There seems to be some precedence for it here: zed/crates/editor/src/code_context_menus.rs Lines 1062 to 1070 in 36557bd Where I think I currently tend towards fixing this in the way that I did in this PR using Still I'm totally happy to iterate on this, if this feels too hacky 🙂 I'm not entirely sure right now what a more robust solution would look like, though.
Oh interesting! This looks like a completely separate bug, that the blame popover falls off the bottom of the window if the popover is too tall, instead of shrinking. I can also reproduce this in the regular Zed. |
|
I am sure that completion-related popovers that render completion items' details and docs, and signature help popovers are sure affected by this design, e.g. the latter used to flicker with empty elements when invoked rapidly. The general way to see it fixed is the type system? I agree that's a rather complex task though, and a "completely separate bug" is actually another way to make this PR to look complete? |
Yeah fair, other places are definitely affected. Indeed when I add an artificial delay to the markdown parsing future, it shows that something similar happens when hovering over a symbol in the editor: Screen.Recording.2026-04-16.at.15.12.23.movIt's just less jarring because this one is actually empty, whereas a blame popover without markdown still contains a lot of other info 😄
Right. And then you'd probably also need a way to handle the case where a child element is not yet ready, either by propagating this state of not-readiness or by e.g. rendering a fallback when you don't want to propagate this, like a
I'd prefer keeping that separate from this PR because (as I understand it) it has nothing to do with the markdown rendering, and I'll first need to investigate which other UI elements might have the same behavior of being positioned partially outside the window. |
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
Great, looks like we're on the same page, thank you for looking at this.
Let's have the biggest offender fixed this way then, and see if any follow-up PRs can handle the issue structurally.
e8a1c89 to
9340e03
Compare
…n is parsed (zed-industries#52231) Fixes this single-frame glitch that sometimes occurs when the git blame popover is rendered before the markdown has been parsed. https://github.com/user-attachments/assets/d5a322c3-e46f-4597-a10f-a676da57daa7 ## Self-Review Checklist <!-- Check before requesting review: --> - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed a visual glitch where the git blame popover could briefly appear empty while its markdown content was being parsed



Fixes this single-frame glitch that sometimes occurs when the git blame popover is rendered before the markdown has been parsed.
Screen.Recording.2026-03-23.at.17.28.37.mov
Self-Review Checklist
Release Notes: