aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/source_binder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r--crates/ra_hir/src/source_binder.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 430dbc522..182ed4c91 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -9,7 +9,7 @@ use ra_db::{FileId, FilePosition};
9use ra_syntax::{ 9use ra_syntax::{
10 SyntaxNode, 10 SyntaxNode,
11 ast::{self, AstNode, NameOwner}, 11 ast::{self, AstNode, NameOwner},
12 algo::{find_node_at_offset, find_leaf_at_offset}, 12 algo::{find_node_at_offset, find_token_at_offset},
13}; 13};
14 14
15use crate::{ 15use crate::{
@@ -197,9 +197,9 @@ pub fn trait_from_module(
197pub fn resolver_for_position(db: &impl HirDatabase, position: FilePosition) -> Resolver { 197pub fn resolver_for_position(db: &impl HirDatabase, position: FilePosition) -> Resolver {
198 let file_id = position.file_id; 198 let file_id = position.file_id;
199 let file = db.parse(file_id); 199 let file = db.parse(file_id);
200 find_leaf_at_offset(file.syntax(), position.offset) 200 find_token_at_offset(file.syntax(), position.offset)
201 .find_map(|node| { 201 .find_map(|token| {
202 node.ancestors().find_map(|node| { 202 token.parent().ancestors().find_map(|node| {
203 if ast::Expr::cast(node).is_some() || ast::Block::cast(node).is_some() { 203 if ast::Expr::cast(node).is_some() || ast::Block::cast(node).is_some() {
204 if let Some(func) = function_from_child_node(db, file_id, node) { 204 if let Some(func) = function_from_child_node(db, file_id, node) {
205 let scopes = func.scopes(db); 205 let scopes = func.scopes(db);