From 4092b8d0b58598d0b4b820fff37b1d8c741c47b9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 21 Dec 2018 15:19:46 +0300 Subject: make compleion item details private --- crates/ra_analysis/src/completion.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'crates/ra_analysis/src/completion.rs') diff --git a/crates/ra_analysis/src/completion.rs b/crates/ra_analysis/src/completion.rs index fd7b78c2a..222b6854c 100644 --- a/crates/ra_analysis/src/completion.rs +++ b/crates/ra_analysis/src/completion.rs @@ -18,7 +18,7 @@ use crate::{ Cancelable, FilePosition }; -pub use crate::completion::completion_item::CompletionItem; +pub use crate::completion::completion_item::{CompletionItem, InsertText}; pub(crate) fn completions( db: &db::RootDatabase, @@ -109,13 +109,20 @@ mod tests { use super::*; + fn is_snippet(completion_item: &CompletionItem) -> bool { + match completion_item.insert_text() { + InsertText::Snippet { .. } => true, + _ => false, + } + } + fn check_scope_completion(code: &str, expected_completions: &str) { let (analysis, position) = single_file_with_position(code); let completions = completions(&analysis.imp.db, position) .unwrap() .unwrap() .into_iter() - .filter(|c| c.snippet.is_none()) + .filter(|c| !is_snippet(c)) .collect::>(); assert_eq_dbg(expected_completions, &completions); } @@ -126,7 +133,7 @@ mod tests { .unwrap() .unwrap() .into_iter() - .filter(|c| c.snippet.is_some()) + .filter(is_snippet) .collect::>(); assert_eq_dbg(expected_completions, &completions); } -- cgit v1.2.3