From e39979aa91c8c08219e35a74ae5aa7aa5d8bc4d6 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 26 Mar 2021 19:39:20 +0100 Subject: Implement "Extract type alias" assist --- crates/ide_assists/src/tests/generated.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'crates/ide_assists/src/tests/generated.rs') diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs index 736027ff0..6bb65e6bc 100644 --- a/crates/ide_assists/src/tests/generated.rs +++ b/crates/ide_assists/src/tests/generated.rs @@ -328,6 +328,25 @@ enum A { One(One) } ) } +#[test] +fn doctest_extract_type_alias() { + check_doc_test( + "extract_type_alias", + r#####" +struct S { + field: $0(u8, u8, u8)$0, +} +"#####, + r#####" +type Type = (u8, u8, u8); + +struct S { + field: Type, +} +"#####, + ) +} + #[test] fn doctest_extract_variable() { check_doc_test( -- cgit v1.2.3 From b494e479202ae3da2745ef4ff05db9da0c8427a0 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sat, 27 Mar 2021 18:51:06 +0100 Subject: Snippet support in extract_type_alias --- crates/ide_assists/src/tests/generated.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ide_assists/src/tests/generated.rs') diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs index 6bb65e6bc..becd640b1 100644 --- a/crates/ide_assists/src/tests/generated.rs +++ b/crates/ide_assists/src/tests/generated.rs @@ -338,10 +338,10 @@ struct S { } "#####, r#####" -type Type = (u8, u8, u8); +type ${0:Type} = (u8, u8, u8); struct S { - field: Type, + field: ${0:Type}, } "#####, ) -- cgit v1.2.3 From 3c6c1c99b41e2a3c9a31b0d4c73d660399255cba Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 29 Mar 2021 13:23:07 +0200 Subject: Don't use snippets --- crates/ide_assists/src/tests/generated.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ide_assists/src/tests/generated.rs') diff --git a/crates/ide_assists/src/tests/generated.rs b/crates/ide_assists/src/tests/generated.rs index becd640b1..03b7fb366 100644 --- a/crates/ide_assists/src/tests/generated.rs +++ b/crates/ide_assists/src/tests/generated.rs @@ -338,10 +338,10 @@ struct S { } "#####, r#####" -type ${0:Type} = (u8, u8, u8); +type $0Type = (u8, u8, u8); struct S { - field: ${0:Type}, + field: Type, } "#####, ) -- cgit v1.2.3