aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-27 15:55:47 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-27 15:55:47 +0000
commit3f4f50baaa21cb2d0f6c102f1ca521946071a8dc (patch)
tree2de93a338992d963f265ef35b53e55f8d3f1ec66 /crates/ra_syntax/src
parentb2b62b9579e9eefbce27b8a9b799fbd59438ce36 (diff)
parentb775fa285c985821f38f09c25507d80ee793ecfd (diff)
Merge #690
690: Fix module resolution for non standard filenames r=matklad a=regiontog fixes #668 Co-authored-by: Erlend Tobiassen <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/algo.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/algo.rs b/crates/ra_syntax/src/algo.rs
index 45747e21d..99b0983b0 100644
--- a/crates/ra_syntax/src/algo.rs
+++ b/crates/ra_syntax/src/algo.rs
@@ -17,14 +17,14 @@ pub fn find_leaf_at_offset(node: &SyntaxNode, offset: TextUnit) -> LeafAtOffset<
17} 17}
18 18
19/// Finds a node of specific Ast type at offset. Note that this is slightly 19/// Finds a node of specific Ast type at offset. Note that this is slightly
20/// impercise: if the cursor is strictly betwen two nodes of the desired type, 20/// imprecise: if the cursor is strictly between two nodes of the desired type,
21/// as in 21/// as in
22/// 22///
23/// ```no-run 23/// ```no-run
24/// struct Foo {}|struct Bar; 24/// struct Foo {}|struct Bar;
25/// ``` 25/// ```
26/// 26///
27/// then the left node will be silently prefered. 27/// then the left node will be silently preferred.
28pub fn find_node_at_offset<N: AstNode>(syntax: &SyntaxNode, offset: TextUnit) -> Option<&N> { 28pub fn find_node_at_offset<N: AstNode>(syntax: &SyntaxNode, offset: TextUnit) -> Option<&N> {
29 find_leaf_at_offset(syntax, offset).find_map(|leaf| leaf.ancestors().find_map(N::cast)) 29 find_leaf_at_offset(syntax, offset).find_map(|leaf| leaf.ancestors().find_map(N::cast))
30} 30}