editor: Move blame popover from hover_tooltip to editor prepaint (#29320)

WIP!

In light of having more control over blame popover from editor.

This fixes: https://github.com/zed-industries/zed/issues/28645,
https://github.com/zed-industries/zed/issues/26304

- [x] Initial rendering
- [x] Handle smart positioning (edge detection, etc)
- [x] Delayed hovering, release, etc
- [x] Test blame message selection
- [x] Fix tagged issues

Release Notes:

- Git inline blame popover now dismisses when the cursor is moved, the
editor is scrolled, or the command palette is opened.
This commit is contained in:
Smit Barmase
2025-04-25 01:52:24 +05:30
committed by GitHub
parent 87f85f1863
commit d3911e34de
6 changed files with 501 additions and 83 deletions
+23 -4
View File
@@ -7,10 +7,11 @@ use git::{
parse_git_remote_url,
};
use gpui::{
AnyElement, App, AppContext as _, Context, Entity, Hsla, Subscription, Task, TextStyle,
WeakEntity, Window,
AnyElement, App, AppContext as _, Context, Entity, Hsla, ScrollHandle, Subscription, Task,
TextStyle, WeakEntity, Window,
};
use language::{Bias, Buffer, BufferSnapshot, Edit};
use markdown::Markdown;
use multi_buffer::RowInfo;
use project::{
Project, ProjectItem,
@@ -98,10 +99,18 @@ pub trait BlameRenderer {
&self,
_: &TextStyle,
_: BlameEntry,
_: &mut App,
) -> Option<AnyElement>;
fn render_blame_entry_popover(
&self,
_: BlameEntry,
_: ScrollHandle,
_: Option<ParsedCommitMessage>,
_: Entity<Markdown>,
_: Entity<Repository>,
_: WeakEntity<Workspace>,
_: Entity<Editor>,
_: &mut Window,
_: &mut App,
) -> Option<AnyElement>;
@@ -139,10 +148,20 @@ impl BlameRenderer for () {
&self,
_: &TextStyle,
_: BlameEntry,
_: &mut App,
) -> Option<AnyElement> {
None
}
fn render_blame_entry_popover(
&self,
_: BlameEntry,
_: ScrollHandle,
_: Option<ParsedCommitMessage>,
_: Entity<Markdown>,
_: Entity<Repository>,
_: WeakEntity<Workspace>,
_: Entity<Editor>,
_: &mut Window,
_: &mut App,
) -> Option<AnyElement> {
None