pub(super) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) {
    if !ctx.is_pat_binding_or_const {
        return;
    }
    if ctx.record_pat_syntax.is_some() {
        return;
    }

    // FIXME: ideally, we should look at the type we are matching against and
    // suggest variants + auto-imports
    ctx.scope().process_all_names(&mut |name, res| {
        match &res {
            hir::ScopeDef::ModuleDef(def) => match def {
                hir::ModuleDef::Adt(hir::Adt::Enum(..))
                | hir::ModuleDef::Adt(hir::Adt::Struct(..))
                | hir::ModuleDef::EnumVariant(..)
                | hir::ModuleDef::Const(..)
                | hir::ModuleDef::Module(..) => (),
                _ => return,
            },
            hir::ScopeDef::MacroDef(_) => (),
            _ => return,
        };

        acc.add_resolution(ctx, name.to_string(), &res)
    });
}
/// Completes constats and paths in patterns.
Completes constats and paths in patterns.
Completes constats and paths in patterns .
pub(super) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) {
    if !ctx.is_pat_binding_or_const {
        return;
    }
    if ctx.record_pat_syntax.is_some() {
        return;
    }
    // FIXME: ideally, we should look at the type we are matching against and
    // suggest variants + auto-imports
    ctx.scope().process_all_names(&mut |name, res| {
        match &res {
            hir::ScopeDef::ModuleDef(def) => match def {
                hir::ModuleDef::Adt(hir::Adt::Enum(..))
                | hir::ModuleDef::Adt(hir::Adt::Struct(..))
                | hir::ModuleDef::EnumVariant(..)
                | hir::ModuleDef::Const(..)
                | hir::ModuleDef::Module(..) => (),
                _ => return,
            },
            hir::ScopeDef::MacroDef(_) => (),
            _ => return,
        };
        acc.add_resolution(ctx, name.to_string(), &res)
    });
}
pub ( super ) fn complete_pattern ( acc : & mut Completions , ctx : & CompletionContext ) { if ! ctx . is_pat_binding_or_const { return ; } if ctx . record_pat_syntax . is_some ( ) { return ; } // FIXME: ideally, we should look at the type we are matching against and // suggest variants + auto-imports ctx . scope ( ) . process_all_names ( & mut | name , res | { match & res { hir :: ScopeDef :: ModuleDef ( def ) => match def { hir :: ModuleDef :: Adt ( hir :: Adt :: Enum ( .. ) ) | hir :: ModuleDef :: Adt ( hir :: Adt :: Struct ( .. ) ) | hir :: ModuleDef :: EnumVariant ( .. ) | hir :: ModuleDef :: Const ( .. ) | hir :: ModuleDef :: Module ( .. ) => ( ) , _ => return , } , hir :: ScopeDef :: MacroDef ( _ ) => ( ) , _ => return , } ; acc . add_resolution ( ctx , name . to_string ( ) , & res ) } ) ; }
Completes constats and paths in patterns.
Completes constats and paths in patterns .
acc
&mut Completions
ctx
&CompletionContext
acc
&mut Completions
ctx
&CompletionContext