diff options
author | Aleksey Kladov <[email protected]> | 2020-06-29 16:22:47 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-29 16:23:01 +0100 |
commit | bbc4dc995612916a4c0a99396b5259a5fb1dda80 (patch) | |
tree | fac101a18e111a2a05bce14fbb68981c5bef3bfd /crates/ra_syntax | |
parent | e805e8c1d5bf26e9716fb855f97d950395129c20 (diff) |
Update the rest of the tests
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/algo.rs | 4 |
1 files changed, 4 insertions, 0 deletions
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<N: AstNode>(syntax: &SyntaxNode, offset: TextSize) -> | |||
41 | ancestors_at_offset(syntax, offset).find_map(N::cast) | 41 | ancestors_at_offset(syntax, offset).find_map(N::cast) |
42 | } | 42 | } |
43 | 43 | ||
44 | pub fn find_node_at_range<N: AstNode>(syntax: &SyntaxNode, range: TextRange) -> Option<N> { | ||
45 | find_covering_element(syntax, range).ancestors().find_map(N::cast) | ||
46 | } | ||
47 | |||
44 | /// Skip to next non `trivia` token | 48 | /// Skip to next non `trivia` token |
45 | pub fn skip_trivia_token(mut token: SyntaxToken, direction: Direction) -> Option<SyntaxToken> { | 49 | pub fn skip_trivia_token(mut token: SyntaxToken, direction: Direction) -> Option<SyntaxToken> { |
46 | while token.kind().is_trivia() { | 50 | while token.kind().is_trivia() { |