pub fn completions(
    db: &RootDatabase,
    config: &CompletionConfig,
    position: FilePosition,
) -> Option<Completions> {
    let ctx = CompletionContext::new(db, position, config)?;

    if ctx.no_completion_required() {
        // No work required here.
        return None;
    }

    let mut acc = Completions::default();
    completions::attribute::complete_attribute(&mut acc, &ctx);
    completions::fn_param::complete_fn_param(&mut acc, &ctx);
    completions::keyword::complete_expr_keyword(&mut acc, &ctx);
    completions::keyword::complete_use_tree_keyword(&mut acc, &ctx);
    completions::snippet::complete_expr_snippet(&mut acc, &ctx);
    completions::snippet::complete_item_snippet(&mut acc, &ctx);
    completions::qualified_path::complete_qualified_path(&mut acc, &ctx);
    completions::unqualified_path::complete_unqualified_path(&mut acc, &ctx);
    completions::dot::complete_dot(&mut acc, &ctx);
    completions::record::complete_record(&mut acc, &ctx);
    completions::pattern::complete_pattern(&mut acc, &ctx);
    completions::postfix::complete_postfix(&mut acc, &ctx);
    completions::macro_in_item_position::complete_macro_in_item_position(&mut acc, &ctx);
    completions::trait_impl::complete_trait_impl(&mut acc, &ctx);
    completions::mod_::complete_mod(&mut acc, &ctx);
    completions::flyimport::import_on_the_fly(&mut acc, &ctx);

    Some(acc)
}
/// 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$0
/// }
/// ```
///
/// `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).
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



`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).
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 ` 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 fn completions(
    db: &RootDatabase,
    config: &CompletionConfig,
    position: FilePosition,
) -> Option<Completions> {
    let ctx = CompletionContext::new(db, position, config)?;
    if ctx.no_completion_required() {
        // No work required here.
        return None;
    }
    let mut acc = Completions::default();
    completions::attribute::complete_attribute(&mut acc, &ctx);
    completions::fn_param::complete_fn_param(&mut acc, &ctx);
    completions::keyword::complete_expr_keyword(&mut acc, &ctx);
    completions::keyword::complete_use_tree_keyword(&mut acc, &ctx);
    completions::snippet::complete_expr_snippet(&mut acc, &ctx);
    completions::snippet::complete_item_snippet(&mut acc, &ctx);
    completions::qualified_path::complete_qualified_path(&mut acc, &ctx);
    completions::unqualified_path::complete_unqualified_path(&mut acc, &ctx);
    completions::dot::complete_dot(&mut acc, &ctx);
    completions::record::complete_record(&mut acc, &ctx);
    completions::pattern::complete_pattern(&mut acc, &ctx);
    completions::postfix::complete_postfix(&mut acc, &ctx);
    completions::macro_in_item_position::complete_macro_in_item_position(&mut acc, &ctx);
    completions::trait_impl::complete_trait_impl(&mut acc, &ctx);
    completions::mod_::complete_mod(&mut acc, &ctx);
    completions::flyimport::import_on_the_fly(&mut acc, &ctx);
    Some(acc)
}
pub fn completions ( db : & RootDatabase , config : & CompletionConfig , position : FilePosition , ) -> Option < Completions > { let ctx = CompletionContext :: new ( db , position , config ) ? ; if ctx . no_completion_required ( ) { // No work required here. return None ; } let mut acc = Completions :: default ( ) ; completions :: attribute :: complete_attribute ( & mut acc , & ctx ) ; completions :: fn_param :: complete_fn_param ( & mut acc , & ctx ) ; completions :: keyword :: complete_expr_keyword ( & mut acc , & ctx ) ; completions :: keyword :: complete_use_tree_keyword ( & mut acc , & ctx ) ; completions :: snippet :: complete_expr_snippet ( & mut acc , & ctx ) ; completions :: snippet :: complete_item_snippet ( & mut acc , & ctx ) ; completions :: qualified_path :: complete_qualified_path ( & mut acc , & ctx ) ; completions :: unqualified_path :: complete_unqualified_path ( & mut acc , & ctx ) ; completions :: dot :: complete_dot ( & mut acc , & ctx ) ; completions :: record :: complete_record ( & mut acc , & ctx ) ; completions :: pattern :: complete_pattern ( & mut acc , & ctx ) ; completions :: postfix :: complete_postfix ( & mut acc , & ctx ) ; completions :: macro_in_item_position :: complete_macro_in_item_position ( & mut acc , & ctx ) ; completions :: trait_impl :: complete_trait_impl ( & mut acc , & ctx ) ; completions :: mod_ :: complete_mod ( & mut acc , & ctx ) ; completions :: flyimport :: import_on_the_fly ( & mut acc , & ctx ) ; Some ( acc ) }
Main entry point for completion.
Main entry point for completion .
db
&RootDatabase
config
&CompletionConfig
position
FilePosition