aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_editor/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_editor/src/lib.rs')
-rw-r--r--crates/ra_editor/src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs
index a93924e00..fcb3e12e6 100644
--- a/crates/ra_editor/src/lib.rs
+++ b/crates/ra_editor/src/lib.rs
@@ -164,6 +164,14 @@ pub fn find_node_at_offset<'a, N: AstNode<'a>>(
164 .next() 164 .next()
165} 165}
166 166
167pub fn resolve_local_name<'a>(file: &'a File, offset: TextUnit, name_ref: ast::NameRef) -> Option<ast::Name<'a>> {
168 let fn_def = find_node_at_offset::<ast::FnDef>(file.syntax(), offset)?;
169 let scopes = scope::FnScopes::new(fn_def);
170
171 // TODO: This doesn't work because of scopes lifetime
172 scope::resolve_local_name(name_ref, &scopes)
173}
174
167#[cfg(test)] 175#[cfg(test)]
168mod tests { 176mod tests {
169 use super::*; 177 use super::*;