Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fallback to using tree-sitter when determining ranges for info popovers (#16062)

Stanislav Alekseevc2b254a67a1d
diff --git a/crates/editor/src/hover_popover.rs b/crates/editor/src/hover_popover.rs
index 678830ac392..4e018060817 100644
--- a/crates/editor/src/hover_popover.rs
+++ b/crates/editor/src/hover_popover.rs
@@ -398,6 +398,14 @@ fn show_hover(
Some(start..end)
})
+ .or_else(|| {
+ let snapshot = &snapshot.buffer_snapshot;
+ let offset_range = snapshot.range_for_syntax_ancestor(anchor..anchor)?;
+ Some(
+ snapshot.anchor_before(offset_range.start)
+ ..snapshot.anchor_after(offset_range.end),
+ )
+ })
.unwrap_or_else(|| anchor..anchor);
let blocks = hover_result.contents;