mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-05 18:25:57 +00:00
Fallback to using tree-sitter when determining ranges for info popovers (#16062)
Closes #15382 Release Notes: - Added fallback to a smallest tree sitter node when hovering over a symbol
This commit is contained in:
parent
af36d4934c
commit
c2b254a67a
1 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue