aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2020-08-11 07:54:33 +0100
committerLaurenČ›iu Nicola <[email protected]>2020-08-11 08:09:50 +0100
commitfc01c7846d5c6970e194dd223e49b863b3189432 (patch)
treefe3d4afc043b3b0608b58542b6d156cad774c631 /crates/ra_ide
parentb050937c1071e68a4ade69375f1f17b703cafb02 (diff)
Use Hygiene in completion
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index 6b03b30bb..4aa761148 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -27,7 +27,7 @@ pub(crate) struct CompletionContext<'a> {
27 pub(super) scope: SemanticsScope<'a>, 27 pub(super) scope: SemanticsScope<'a>,
28 pub(super) db: &'a RootDatabase, 28 pub(super) db: &'a RootDatabase,
29 pub(super) config: &'a CompletionConfig, 29 pub(super) config: &'a CompletionConfig,
30 pub(super) offset: TextSize, 30 pub(super) position: FilePosition,
31 /// The token before the cursor, in the original file. 31 /// The token before the cursor, in the original file.
32 pub(super) original_token: SyntaxToken, 32 pub(super) original_token: SyntaxToken,
33 /// The token before the cursor, in the macro-expanded file. 33 /// The token before the cursor, in the macro-expanded file.
@@ -117,7 +117,7 @@ impl<'a> CompletionContext<'a> {
117 config, 117 config,
118 original_token, 118 original_token,
119 token, 119 token,
120 offset: position.offset, 120 position,
121 krate, 121 krate,
122 expected_type: None, 122 expected_type: None,
123 name_ref_syntax: None, 123 name_ref_syntax: None,
@@ -209,7 +209,7 @@ impl<'a> CompletionContext<'a> {
209 mark::hit!(completes_if_prefix_is_keyword); 209 mark::hit!(completes_if_prefix_is_keyword);
210 self.original_token.text_range() 210 self.original_token.text_range()
211 } else { 211 } else {
212 TextRange::empty(self.offset) 212 TextRange::empty(self.position.offset)
213 } 213 }
214 } 214 }
215 215
@@ -379,8 +379,8 @@ impl<'a> CompletionContext<'a> {
379 self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some(); 379 self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some();
380 self.has_type_args = segment.generic_arg_list().is_some(); 380 self.has_type_args = segment.generic_arg_list().is_some();
381 381
382 #[allow(deprecated)] 382 let hygiene = hir::Hygiene::new(self.db, self.position.file_id.into());
383 if let Some(path) = hir::Path::from_ast(path.clone()) { 383 if let Some(path) = hir::Path::from_src(path.clone(), &hygiene) {
384 if let Some(path_prefix) = path.qualifier() { 384 if let Some(path_prefix) = path.qualifier() {
385 self.path_prefix = Some(path_prefix); 385 self.path_prefix = Some(path_prefix);
386 return; 386 return;