diff options
author | Aleksey Kladov <[email protected]> | 2019-12-21 11:15:56 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-21 11:18:20 +0000 |
commit | 67ba9072fad8698af4e96b38b8b4acfdd801f7f7 (patch) | |
tree | 9361203d1e02192e6b5bc9c2391a2d1ca96954a4 /crates/ra_ide/src/completion/completion_context.rs | |
parent | 3ebf15c9b29b1fed6319d04f540ad48cd4bd6995 (diff) |
Remove hir for imports
Diffstat (limited to 'crates/ra_ide/src/completion/completion_context.rs')
-rw-r--r-- | crates/ra_ide/src/completion/completion_context.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index 4894ea2f6..8f56ce706 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -18,6 +18,7 @@ pub(crate) struct CompletionContext<'a> { | |||
18 | pub(super) analyzer: hir::SourceAnalyzer, | 18 | pub(super) analyzer: hir::SourceAnalyzer, |
19 | pub(super) offset: TextUnit, | 19 | pub(super) offset: TextUnit, |
20 | pub(super) token: SyntaxToken, | 20 | pub(super) token: SyntaxToken, |
21 | pub(super) name_ref: Option<ast::NameRef>, | ||
21 | pub(super) module: Option<hir::Module>, | 22 | pub(super) module: Option<hir::Module>, |
22 | pub(super) function_syntax: Option<ast::FnDef>, | 23 | pub(super) function_syntax: Option<ast::FnDef>, |
23 | pub(super) use_item_syntax: Option<ast::UseItem>, | 24 | pub(super) use_item_syntax: Option<ast::UseItem>, |
@@ -68,6 +69,7 @@ impl<'a> CompletionContext<'a> { | |||
68 | analyzer, | 69 | analyzer, |
69 | token, | 70 | token, |
70 | offset: position.offset, | 71 | offset: position.offset, |
72 | name_ref: None, | ||
71 | module, | 73 | module, |
72 | function_syntax: None, | 74 | function_syntax: None, |
73 | use_item_syntax: None, | 75 | use_item_syntax: None, |
@@ -142,6 +144,8 @@ impl<'a> CompletionContext<'a> { | |||
142 | } | 144 | } |
143 | 145 | ||
144 | fn classify_name_ref(&mut self, original_file: SourceFile, name_ref: ast::NameRef) { | 146 | fn classify_name_ref(&mut self, original_file: SourceFile, name_ref: ast::NameRef) { |
147 | self.name_ref = | ||
148 | find_node_at_offset(original_file.syntax(), name_ref.syntax().text_range().start()); | ||
145 | let name_range = name_ref.syntax().text_range(); | 149 | let name_range = name_ref.syntax().text_range(); |
146 | if name_ref.syntax().parent().and_then(ast::RecordField::cast).is_some() { | 150 | if name_ref.syntax().parent().and_then(ast::RecordField::cast).is_some() { |
147 | self.record_lit_syntax = find_node_at_offset(original_file.syntax(), self.offset); | 151 | self.record_lit_syntax = find_node_at_offset(original_file.syntax(), self.offset); |