From 65768feaff5fad91c5bded8b606de29ed7ef4b12 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 4 Jul 2020 09:08:51 +0200 Subject: Unify naming --- crates/ra_ide/src/completion/test_utils.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'crates/ra_ide/src/completion/test_utils.rs') diff --git a/crates/ra_ide/src/completion/test_utils.rs b/crates/ra_ide/src/completion/test_utils.rs index 145d36c98..329acdc8b 100644 --- a/crates/ra_ide/src/completion/test_utils.rs +++ b/crates/ra_ide/src/completion/test_utils.rs @@ -13,15 +13,15 @@ use crate::{ }; pub(crate) fn do_completion(code: &str, kind: CompletionKind) -> Vec { - do_completion_with_options(code, kind, &CompletionConfig::default()) + do_completion_with_config(code, kind, &CompletionConfig::default()) } -pub(crate) fn do_completion_with_options( +pub(crate) fn do_completion_with_config( code: &str, kind: CompletionKind, - options: &CompletionConfig, + config: &CompletionConfig, ) -> Vec { - let mut kind_completions: Vec = get_all_completion_items(code, options) + let mut kind_completions: Vec = get_all_completion_items(code, config) .into_iter() .filter(|c| c.completion_kind == kind) .collect(); @@ -30,15 +30,15 @@ pub(crate) fn do_completion_with_options( } pub(crate) fn completion_list(code: &str, kind: CompletionKind) -> String { - completion_list_with_options(code, kind, &CompletionConfig::default()) + completion_list_with_config(code, kind, &CompletionConfig::default()) } -pub(crate) fn completion_list_with_options( +pub(crate) fn completion_list_with_config( code: &str, kind: CompletionKind, - options: &CompletionConfig, + config: &CompletionConfig, ) -> String { - let mut kind_completions: Vec = get_all_completion_items(code, options) + let mut kind_completions: Vec = get_all_completion_items(code, config) .into_iter() .filter(|c| c.completion_kind == kind) .collect(); -- cgit v1.2.3 From 5c68dd6b59cd5006a96280217bc88a6e26f90f1f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 4 Jul 2020 09:53:54 +0200 Subject: Better tests for completion scoring --- crates/ra_ide/src/completion/test_utils.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'crates/ra_ide/src/completion/test_utils.rs') diff --git a/crates/ra_ide/src/completion/test_utils.rs b/crates/ra_ide/src/completion/test_utils.rs index 329acdc8b..cbae1da85 100644 --- a/crates/ra_ide/src/completion/test_utils.rs +++ b/crates/ra_ide/src/completion/test_utils.rs @@ -92,7 +92,10 @@ pub(crate) fn check_pattern_is_applicable(code: &str, check: fn(SyntaxElement) - .unwrap(); } -fn get_all_completion_items(code: &str, options: &CompletionConfig) -> Vec { +pub(crate) fn get_all_completion_items( + code: &str, + options: &CompletionConfig, +) -> Vec { let (analysis, position) = analysis_and_position(code); analysis.completions(options, position).unwrap().unwrap().into() } -- cgit v1.2.3