diff options
Diffstat (limited to 'crates/ra_editor/src')
-rw-r--r-- | crates/ra_editor/src/lib.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs index 417080d90..94e9a18e4 100644 --- a/crates/ra_editor/src/lib.rs +++ b/crates/ra_editor/src/lib.rs | |||
@@ -152,11 +152,9 @@ pub fn find_node_at_offset<'a, N: AstNode<'a>>( | |||
152 | } | 152 | } |
153 | 153 | ||
154 | pub fn resolve_local_name( | 154 | pub fn resolve_local_name( |
155 | file: &File, | ||
156 | offset: TextUnit, | ||
157 | name_ref: ast::NameRef, | 155 | name_ref: ast::NameRef, |
158 | ) -> Option<(SmolStr, TextRange)> { | 156 | ) -> Option<(SmolStr, TextRange)> { |
159 | let fn_def = find_node_at_offset::<ast::FnDef>(file.syntax(), offset)?; | 157 | let fn_def = name_ref.syntax().ancestors().find_map(ast::FnDef::cast)?; |
160 | let scopes = scope::FnScopes::new(fn_def); | 158 | let scopes = scope::FnScopes::new(fn_def); |
161 | let scope_entry = scope::resolve_local_name(name_ref, &scopes)?; | 159 | let scope_entry = scope::resolve_local_name(name_ref, &scopes)?; |
162 | let name = scope_entry.ast().name()?; | 160 | let name = scope_entry.ast().name()?; |