From 730a927c5e6b382690e88f482a03701636242a2c Mon Sep 17 00:00:00 2001 From: Geoffrey Copin Date: Fri, 10 Apr 2020 00:35:43 +0200 Subject: Implement assist "Reorder field names" --- crates/ra_syntax/src/ast/generated/nodes.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 20f663046..79b225622 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -3256,6 +3256,7 @@ pub enum Pat { RangePat(RangePat), LiteralPat(LiteralPat), MacroPat(MacroPat), + RecordFieldPat(RecordFieldPat), } impl From for Pat { fn from(node: OrPat) -> Pat { Pat::OrPat(node) } @@ -3302,12 +3303,15 @@ impl From for Pat { impl From for Pat { fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) } } +impl From for Pat { + fn from(node: RecordFieldPat) -> Pat { Pat::RecordFieldPat(node) } +} impl AstNode for Pat { fn can_cast(kind: SyntaxKind) -> bool { match kind { OR_PAT | PAREN_PAT | REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT | PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT - | LITERAL_PAT | MACRO_PAT => true, + | LITERAL_PAT | MACRO_PAT | RECORD_FIELD_PAT => true, _ => false, } } @@ -3328,6 +3332,7 @@ impl AstNode for Pat { RANGE_PAT => Pat::RangePat(RangePat { syntax }), LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }), MACRO_PAT => Pat::MacroPat(MacroPat { syntax }), + RECORD_FIELD_PAT => Pat::RecordFieldPat(RecordFieldPat { syntax }), _ => return None, }; Some(res) @@ -3349,6 +3354,7 @@ impl AstNode for Pat { Pat::RangePat(it) => &it.syntax, Pat::LiteralPat(it) => &it.syntax, Pat::MacroPat(it) => &it.syntax, + Pat::RecordFieldPat(it) => &it.syntax, } } } -- cgit v1.2.3