Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/context.rs')
-rw-r--r--crates/ide-completion/src/context.rs35
1 files changed, 22 insertions, 13 deletions
diff --git a/crates/ide-completion/src/context.rs b/crates/ide-completion/src/context.rs
index 0c7c6ab5af..c212b5b9b9 100644
--- a/crates/ide-completion/src/context.rs
+++ b/crates/ide-completion/src/context.rs
@@ -88,24 +88,13 @@ impl PathCompletionCtx {
#[derive(Debug, PartialEq, Eq)]
pub(super) enum PathKind {
Expr {
- in_block_expr: bool,
- in_loop_body: bool,
- after_if_expr: bool,
- /// Whether this expression is the direct condition of an if or while expression
- in_condition: bool,
- incomplete_let: bool,
- ref_expr_parent: Option<ast::RefExpr>,
- is_func_update: Option<ast::RecordExpr>,
- self_param: Option<hir::SelfParam>,
- innermost_ret_ty: Option<hir::Type>,
- impl_: Option<ast::Impl>,
+ expr_ctx: ExprCtx,
},
Type {
location: TypeLocation,
},
Attr {
- kind: AttrKind,
- annotated_item_kind: Option<SyntaxKind>,
+ attr_ctx: AttrCtx,
},
Derive {
existing_derives: FxHashSet<hir::Macro>,
@@ -122,6 +111,26 @@ pub(super) enum PathKind {
},
Use,
}
+#[derive(Debug, PartialEq, Eq)]
+pub(crate) struct AttrCtx {
+ pub(crate) kind: AttrKind,
+ pub(crate) annotated_item_kind: Option<SyntaxKind>,
+}
+
+#[derive(Debug, PartialEq, Eq)]
+pub(crate) struct ExprCtx {
+ pub(crate) in_block_expr: bool,
+ pub(crate) in_loop_body: bool,
+ pub(crate) after_if_expr: bool,
+ /// Whether this expression is the direct condition of an if or while expression
+ pub(crate) in_condition: bool,
+ pub(crate) incomplete_let: bool,
+ pub(crate) ref_expr_parent: Option<ast::RefExpr>,
+ pub(crate) is_func_update: Option<ast::RecordExpr>,
+ pub(crate) self_param: Option<hir::SelfParam>,
+ pub(crate) innermost_ret_ty: Option<hir::Type>,
+ pub(crate) impl_: Option<ast::Impl>,
+}
/// Original file ast nodes
#[derive(Clone, Debug, PartialEq, Eq)]