diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-11-21 15:35:51 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-11-21 15:35:51 +0000 |
commit | ac874b64550c103249e2b951d92e2f1a8c9a5828 (patch) | |
tree | 50fdd5d9681ff57a5cd15de3c401cd478e6f3ab5 /crates/ra_editor/src | |
parent | 031bc868293539714157e3d93cc338b011f5661d (diff) | |
parent | edeec6a41487e6458a9d96b328c9b784525d8f06 (diff) |
Merge #237
237: This moves parts of completion from ad-hockery to descriptors-based resolve r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_editor/src')
-rw-r--r-- | crates/ra_editor/src/lib.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs index ff4e8303d..c6b116159 100644 --- a/crates/ra_editor/src/lib.rs +++ b/crates/ra_editor/src/lib.rs | |||
@@ -148,12 +148,7 @@ pub fn find_node_at_offset<'a, N: AstNode<'a>>( | |||
148 | syntax: SyntaxNodeRef<'a>, | 148 | syntax: SyntaxNodeRef<'a>, |
149 | offset: TextUnit, | 149 | offset: TextUnit, |
150 | ) -> Option<N> { | 150 | ) -> Option<N> { |
151 | let leaves = find_leaf_at_offset(syntax, offset); | 151 | find_leaf_at_offset(syntax, offset).find_map(|leaf| leaf.ancestors().find_map(N::cast)) |
152 | let leaf = leaves | ||
153 | .clone() | ||
154 | .find(|leaf| !leaf.kind().is_trivia()) | ||
155 | .or_else(|| leaves.right_biased())?; | ||
156 | leaf.ancestors().filter_map(N::cast).next() | ||
157 | } | 152 | } |
158 | 153 | ||
159 | #[cfg(test)] | 154 | #[cfg(test)] |