mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
WIP: This doesn't currently work but I also don't think it's the right abstraction
This commit is contained in:
parent
91312a9ff9
commit
1d4c767879
3 changed files with 25 additions and 3 deletions
|
@ -164,6 +164,14 @@ pub fn find_node_at_offset<'a, N: AstNode<'a>>(
|
|||
.next()
|
||||
}
|
||||
|
||||
pub fn resolve_local_name<'a>(file: &'a File, offset: TextUnit, name_ref: ast::NameRef) -> Option<ast::Name<'a>> {
|
||||
let fn_def = find_node_at_offset::<ast::FnDef>(file.syntax(), offset)?;
|
||||
let scopes = scope::FnScopes::new(fn_def);
|
||||
|
||||
// TODO: This doesn't work because of scopes lifetime
|
||||
scope::resolve_local_name(name_ref, &scopes)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue