diff options
author | Aleksey Kladov <[email protected]> | 2018-08-16 10:51:40 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-16 10:51:40 +0100 |
commit | 7094291573dc819e3115950ec3b2316bd5e9ea33 (patch) | |
tree | be18ef6c5baab68acac484d00277125484d15820 /crates/libanalysis/src | |
parent | 1193c5f829dc96683132c12d5395d7805787af2a (diff) |
tt-attrs
Diffstat (limited to 'crates/libanalysis/src')
-rw-r--r-- | crates/libanalysis/src/lib.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/crates/libanalysis/src/lib.rs b/crates/libanalysis/src/lib.rs index 983029587..85c23e4d9 100644 --- a/crates/libanalysis/src/lib.rs +++ b/crates/libanalysis/src/lib.rs | |||
@@ -26,9 +26,8 @@ use std::{ | |||
26 | use libsyntax2::{ | 26 | use libsyntax2::{ |
27 | TextUnit, | 27 | TextUnit, |
28 | ast::{self, AstNode}, | 28 | ast::{self, AstNode}, |
29 | algo::{find_leaf_at_offset, ancestors}, | ||
30 | }; | 29 | }; |
31 | use libeditor::{LineIndex, FileSymbol}; | 30 | use libeditor::{LineIndex, FileSymbol, find_node}; |
32 | 31 | ||
33 | use self::symbol_index::FileSymbols; | 32 | use self::symbol_index::FileSymbols; |
34 | pub use self::symbol_index::Query; | 33 | pub use self::symbol_index::Query; |
@@ -123,13 +122,7 @@ impl World { | |||
123 | let file = self.file_syntax(id)?; | 122 | let file = self.file_syntax(id)?; |
124 | let syntax = file.syntax(); | 123 | let syntax = file.syntax(); |
125 | let syntax = syntax.as_ref(); | 124 | let syntax = syntax.as_ref(); |
126 | let name_ref = | 125 | let name_ref = find_node::<ast::NameRef<_>>(syntax, offset); |
127 | find_leaf_at_offset(syntax, offset) | ||
128 | .left_biased() | ||
129 | .into_iter() | ||
130 | .flat_map(|node| ancestors(node)) | ||
131 | .flat_map(ast::NameRef::cast) | ||
132 | .next(); | ||
133 | let name = match name_ref { | 126 | let name = match name_ref { |
134 | None => return Ok(vec![]), | 127 | None => return Ok(vec![]), |
135 | Some(name_ref) => name_ref.text(), | 128 | Some(name_ref) => name_ref.text(), |