From 757e593b253b4df7e6fc8bf15a4d4f34c9d484c5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 27 Nov 2019 21:32:33 +0300 Subject: rename ra_ide_api -> ra_ide --- crates/ra_ide_api/src/completion.rs | 77 ------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 crates/ra_ide_api/src/completion.rs (limited to 'crates/ra_ide_api/src/completion.rs') diff --git a/crates/ra_ide_api/src/completion.rs b/crates/ra_ide_api/src/completion.rs deleted file mode 100644 index abe1f36ce..000000000 --- a/crates/ra_ide_api/src/completion.rs +++ /dev/null @@ -1,77 +0,0 @@ -//! FIXME: write short doc here - -mod completion_item; -mod completion_context; -mod presentation; - -mod complete_dot; -mod complete_record_literal; -mod complete_record_pattern; -mod complete_pattern; -mod complete_fn_param; -mod complete_keyword; -mod complete_snippet; -mod complete_path; -mod complete_scope; -mod complete_postfix; -mod complete_macro_in_item_position; - -use ra_db::SourceDatabase; - -#[cfg(test)] -use crate::completion::completion_item::do_completion; -use crate::{ - completion::{ - completion_context::CompletionContext, - completion_item::{CompletionKind, Completions}, - }, - db, FilePosition, -}; - -pub use crate::completion::completion_item::{ - CompletionItem, CompletionItemKind, InsertTextFormat, -}; - -/// Main entry point for completion. We run completion as a two-phase process. -/// -/// First, we look at the position and collect a so-called `CompletionContext. -/// This is a somewhat messy process, because, during completion, syntax tree is -/// incomplete and can look really weird. -/// -/// Once the context is collected, we run a series of completion routines which -/// look at the context and produce completion items. One subtlety about this -/// phase is that completion engine should not filter by the substring which is -/// already present, it should give all possible variants for the identifier at -/// the caret. In other words, for -/// -/// ```no-run -/// fn f() { -/// let foo = 92; -/// let _ = bar<|> -/// } -/// ``` -/// -/// `foo` *should* be present among the completion variants. Filtering by -/// identifier prefix/fuzzy match should be done higher in the stack, together -/// with ordering of completions (currently this is done by the client). -pub(crate) fn completions(db: &db::RootDatabase, position: FilePosition) -> Option { - let original_parse = db.parse(position.file_id); - let ctx = CompletionContext::new(db, &original_parse, position)?; - - let mut acc = Completions::default(); - - complete_fn_param::complete_fn_param(&mut acc, &ctx); - complete_keyword::complete_expr_keyword(&mut acc, &ctx); - complete_keyword::complete_use_tree_keyword(&mut acc, &ctx); - complete_snippet::complete_expr_snippet(&mut acc, &ctx); - complete_snippet::complete_item_snippet(&mut acc, &ctx); - complete_path::complete_path(&mut acc, &ctx); - complete_scope::complete_scope(&mut acc, &ctx); - complete_dot::complete_dot(&mut acc, &ctx); - complete_record_literal::complete_record_literal(&mut acc, &ctx); - complete_record_pattern::complete_record_pattern(&mut acc, &ctx); - complete_pattern::complete_pattern(&mut acc, &ctx); - complete_postfix::complete_postfix(&mut acc, &ctx); - complete_macro_in_item_position::complete_macro_in_item_position(&mut acc, &ctx); - Some(acc) -} -- cgit v1.2.3