aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/completion.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/completion.rs')
-rw-r--r--crates/ra_analysis/src/completion.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/crates/ra_analysis/src/completion.rs b/crates/ra_analysis/src/completion.rs
index 340ae3f66..286b6c376 100644
--- a/crates/ra_analysis/src/completion.rs
+++ b/crates/ra_analysis/src/completion.rs
@@ -368,18 +368,15 @@ fn complete_fn(name_ref: ast::NameRef, scopes: &FnScopes, acc: &mut Vec<Completi
368 368
369#[cfg(test)] 369#[cfg(test)]
370mod tests { 370mod tests {
371 use test_utils::{assert_eq_dbg, extract_offset}; 371 use test_utils::{assert_eq_dbg};
372 372
373 use crate::FileId; 373 use crate::mock_analysis::{single_file_with_position};
374 use crate::mock_analysis::MockAnalysis;
375 374
376 use super::*; 375 use super::*;
377 376
378 fn check_scope_completion(code: &str, expected_completions: &str) { 377 fn check_scope_completion(code: &str, expected_completions: &str) {
379 let (off, code) = extract_offset(&code); 378 let (analysis, position) = single_file_with_position(code);
380 let analysis = MockAnalysis::with_files(&[("/main.rs", &code)]).analysis(); 379 let completions = scope_completion(&analysis.imp.db, position.file_id, position.offset)
381 let file_id = FileId(1);
382 let completions = scope_completion(&analysis.imp.db, file_id, off)
383 .unwrap() 380 .unwrap()
384 .into_iter() 381 .into_iter()
385 .filter(|c| c.snippet.is_none()) 382 .filter(|c| c.snippet.is_none())
@@ -388,10 +385,8 @@ mod tests {
388 } 385 }
389 386
390 fn check_snippet_completion(code: &str, expected_completions: &str) { 387 fn check_snippet_completion(code: &str, expected_completions: &str) {
391 let (off, code) = extract_offset(&code); 388 let (analysis, position) = single_file_with_position(code);
392 let analysis = MockAnalysis::with_files(&[("/main.rs", &code)]).analysis(); 389 let completions = scope_completion(&analysis.imp.db, position.file_id, position.offset)
393 let file_id = FileId(1);
394 let completions = scope_completion(&analysis.imp.db, file_id, off)
395 .unwrap() 390 .unwrap()
396 .into_iter() 391 .into_iter()
397 .filter(|c| c.snippet.is_some()) 392 .filter(|c| c.snippet.is_some())