diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-08-11 11:30:39 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-11 11:30:39 +0100 |
commit | e0de2475208765a171f335dfffde764f96243d41 (patch) | |
tree | 0d93bf6afa9934f92d5cc924c6943a08dd5d2f7b /crates | |
parent | ef20dfc78d2092f8b99db6716dde1928b15133a0 (diff) | |
parent | fc01c7846d5c6970e194dd223e49b863b3189432 (diff) |
Merge #5708
5708: Use Hygiene in completion r=jonas-schievink a=lnicola
Co-authored-by: Laurențiu Nicola <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide/src/completion/completion_context.rs | 10 |
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; |