aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/context.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion/src/context.rs')
-rw-r--r--crates/ide_completion/src/context.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs
index 1ec59ff80..2f3fb1710 100644
--- a/crates/ide_completion/src/context.rs
+++ b/crates/ide_completion/src/context.rs
@@ -196,46 +196,46 @@ impl<'a> CompletionContext<'a> {
196 }; 196 };
197 197
198 let mut original_file = original_file.syntax().clone(); 198 let mut original_file = original_file.syntax().clone();
199 let mut hypothetical_file = file_with_fake_ident.syntax().clone(); 199 let mut speculative_file = file_with_fake_ident.syntax().clone();
200 let mut offset = position.offset; 200 let mut offset = position.offset;
201 let mut fake_ident_token = fake_ident_token; 201 let mut fake_ident_token = fake_ident_token;
202 202
203 // Are we inside a macro call? 203 // Are we inside a macro call?
204 while let (Some(actual_macro_call), Some(macro_call_with_fake_ident)) = ( 204 while let (Some(actual_macro_call), Some(macro_call_with_fake_ident)) = (
205 find_node_at_offset::<ast::MacroCall>(&original_file, offset), 205 find_node_at_offset::<ast::MacroCall>(&original_file, offset),
206 find_node_at_offset::<ast::MacroCall>(&hypothetical_file, offset), 206 find_node_at_offset::<ast::MacroCall>(&speculative_file, offset),
207 ) { 207 ) {
208 if actual_macro_call.path().as_ref().map(|s| s.syntax().text()) 208 if actual_macro_call.path().as_ref().map(|s| s.syntax().text())
209 != macro_call_with_fake_ident.path().as_ref().map(|s| s.syntax().text()) 209 != macro_call_with_fake_ident.path().as_ref().map(|s| s.syntax().text())
210 { 210 {
211 break; 211 break;
212 } 212 }
213 let hypothetical_args = match macro_call_with_fake_ident.token_tree() { 213 let speculative_args = match macro_call_with_fake_ident.token_tree() {
214 Some(tt) => tt, 214 Some(tt) => tt,
215 None => break, 215 None => break,
216 }; 216 };
217 if let (Some(actual_expansion), Some(hypothetical_expansion)) = ( 217 if let (Some(actual_expansion), Some(speculative_expansion)) = (
218 ctx.sema.expand(&actual_macro_call), 218 ctx.sema.expand(&actual_macro_call),
219 ctx.sema.speculative_expand( 219 ctx.sema.speculative_expand(
220 &actual_macro_call, 220 &actual_macro_call,
221 &hypothetical_args, 221 &speculative_args,
222 fake_ident_token, 222 fake_ident_token,
223 ), 223 ),
224 ) { 224 ) {
225 let new_offset = hypothetical_expansion.1.text_range().start(); 225 let new_offset = speculative_expansion.1.text_range().start();
226 if new_offset > actual_expansion.text_range().end() { 226 if new_offset > actual_expansion.text_range().end() {
227 break; 227 break;
228 } 228 }
229 original_file = actual_expansion; 229 original_file = actual_expansion;
230 hypothetical_file = hypothetical_expansion.0; 230 speculative_file = speculative_expansion.0;
231 fake_ident_token = hypothetical_expansion.1; 231 fake_ident_token = speculative_expansion.1;
232 offset = new_offset; 232 offset = new_offset;
233 } else { 233 } else {
234 break; 234 break;
235 } 235 }
236 } 236 }
237 ctx.fill_keyword_patterns(&hypothetical_file, offset); 237 ctx.fill_keyword_patterns(&speculative_file, offset);
238 ctx.fill(&original_file, hypothetical_file, offset); 238 ctx.fill(&original_file, speculative_file, offset);
239 Some(ctx) 239 Some(ctx)
240 } 240 }
241 241