From bbc4dc995612916a4c0a99396b5259a5fb1dda80 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 29 Jun 2020 17:22:47 +0200 Subject: Update the rest of the tests --- crates/ra_syntax/src/algo.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/ra_syntax') diff --git a/crates/ra_syntax/src/algo.rs b/crates/ra_syntax/src/algo.rs index f7a885eb3..26b3c813a 100644 --- a/crates/ra_syntax/src/algo.rs +++ b/crates/ra_syntax/src/algo.rs @@ -41,6 +41,10 @@ pub fn find_node_at_offset(syntax: &SyntaxNode, offset: TextSize) -> ancestors_at_offset(syntax, offset).find_map(N::cast) } +pub fn find_node_at_range(syntax: &SyntaxNode, range: TextRange) -> Option { + find_covering_element(syntax, range).ancestors().find_map(N::cast) +} + /// Skip to next non `trivia` token pub fn skip_trivia_token(mut token: SyntaxToken, direction: Direction) -> Option { while token.kind().is_trivia() { -- cgit v1.2.3