mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Complete paths after ::
This commit is contained in:
parent
7ffc7d3308
commit
edeec6a414
5 changed files with 5 additions and 9 deletions
|
@ -148,12 +148,7 @@ pub fn find_node_at_offset<'a, N: AstNode<'a>>(
|
|||
syntax: SyntaxNodeRef<'a>,
|
||||
offset: TextUnit,
|
||||
) -> Option<N> {
|
||||
let leaves = find_leaf_at_offset(syntax, offset);
|
||||
let leaf = leaves
|
||||
.clone()
|
||||
.find(|leaf| !leaf.kind().is_trivia())
|
||||
.or_else(|| leaves.right_biased())?;
|
||||
leaf.ancestors().filter_map(N::cast).next()
|
||||
find_leaf_at_offset(syntax, offset).find_map(|leaf| leaf.ancestors().find_map(N::cast))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue