Skip to content

Commit

Permalink
Fallback to using tree-sitter when determining ranges for info popove…
Browse files Browse the repository at this point in the history
…rs (zed-industries#16062)

Closes zed-industries#15382

Release Notes:

- Added fallback to a smallest tree sitter node when hovering over a
symbol
  • Loading branch information
WeetHet authored Aug 13, 2024
1 parent af36d49 commit c2b254a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/editor/src/hover_popover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c2b254a

Please sign in to comment.