Rename compound things to variant things

This commit is contained in:
Lukas Wirth 2022-03-16 13:41:35 +01:00
parent 46008d4cf4
commit 4fe5f03c7f
10 changed files with 101 additions and 36 deletions

View file

@ -378,3 +378,71 @@ fn foo() {
"#]],
)
}
#[test]
fn completes_no_delims_if_existing() {
check_empty(
r#"
struct Bar(u32);
fn foo() {
match Bar(0) {
B$0(b) => {}
}
}
"#,
expect![[r#"
kw self::
kw super::
kw crate::
"#]],
);
check_empty(
r#"
struct Foo { bar: u32 }
fn foo() {
match Foo { bar: 0 } {
F$0 { bar } => {}
}
}
"#,
expect![[r#"
kw return
kw self
kw super
kw crate
st Foo
fn foo() fn()
bt u32
"#]],
);
check_empty(
r#"
enum Enum {
TupleVariant(u32)
}
fn foo() {
match Enum::TupleVariant(0) {
Enum::T$0(b) => {}
}
}
"#,
expect![[r#"
ev TupleVariant() TupleVariant(u32)
"#]],
);
check_empty(
r#"
enum Enum {
RecordVariant { field: u32 }
}
fn foo() {
match (Enum::RecordVariant { field: 0 }) {
Enum::RecordV$0 { field } => {}
}
}
"#,
expect![[r#"
ev RecordVariant {} RecordVariant { field: u32 }
"#]],
);
}

View file

@ -166,7 +166,7 @@ fn main() {
kw true
kw false
kw return
sn Foo {} Foo { foo1: u32, foo2: u32 }
st Foo {} Foo { foo1: u32, foo2: u32 }
fd ..Default::default()
fd foo1 u32
fd foo2 u32