aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-02-13 18:58:58 +0000
committerLukas Wirth <[email protected]>2021-02-13 18:58:58 +0000
commited1f2b58f7360e96c3b23e6759678b0a185d5ce5 (patch)
tree9f58b1f958cd01b9e5909c77d12f3479a3f5974f /crates
parent205e72f34d26898779c8ab11c8500e74fd8ce28b (diff)
Group generate getter/setter assist
Diffstat (limited to 'crates')
-rw-r--r--crates/assists/src/handlers/generate_getter.rs8
-rw-r--r--crates/assists/src/handlers/generate_getter_mut.rs8
-rw-r--r--crates/assists/src/handlers/generate_setter.rs8
3 files changed, 12 insertions, 12 deletions
diff --git a/crates/assists/src/handlers/generate_getter.rs b/crates/assists/src/handlers/generate_getter.rs
index fbcf8b069..df7d1bb95 100644
--- a/crates/assists/src/handlers/generate_getter.rs
+++ b/crates/assists/src/handlers/generate_getter.rs
@@ -1,10 +1,9 @@
1use stdx::{format_to, to_lower_snake_case}; 1use stdx::{format_to, to_lower_snake_case};
2use syntax::ast::VisibilityOwner; 2use syntax::ast::{self, AstNode, NameOwner, VisibilityOwner};
3use syntax::ast::{self, AstNode, NameOwner};
4 3
5use crate::{ 4use crate::{
6 utils::{find_impl_block_end, find_struct_impl, generate_impl_text}, 5 utils::{find_impl_block_end, find_struct_impl, generate_impl_text},
7 AssistContext, AssistId, AssistKind, Assists, 6 AssistContext, AssistId, AssistKind, Assists, GroupLabel,
8}; 7};
9 8
10// Assist: generate_getter 9// Assist: generate_getter
@@ -42,7 +41,8 @@ pub(crate) fn generate_getter(acc: &mut Assists, ctx: &AssistContext) -> Option<
42 let impl_def = find_struct_impl(&ctx, &ast::Adt::Struct(strukt.clone()), fn_name.as_str())?; 41 let impl_def = find_struct_impl(&ctx, &ast::Adt::Struct(strukt.clone()), fn_name.as_str())?;
43 42
44 let target = field.syntax().text_range(); 43 let target = field.syntax().text_range();
45 acc.add( 44 acc.add_group(
45 &GroupLabel("Generate getter/setter".to_owned()),
46 AssistId("generate_getter", AssistKind::Generate), 46 AssistId("generate_getter", AssistKind::Generate),
47 "Generate a getter method", 47 "Generate a getter method",
48 target, 48 target,
diff --git a/crates/assists/src/handlers/generate_getter_mut.rs b/crates/assists/src/handlers/generate_getter_mut.rs
index bf0d99881..821c2eed5 100644
--- a/crates/assists/src/handlers/generate_getter_mut.rs
+++ b/crates/assists/src/handlers/generate_getter_mut.rs
@@ -1,10 +1,9 @@
1use stdx::{format_to, to_lower_snake_case}; 1use stdx::{format_to, to_lower_snake_case};
2use syntax::ast::VisibilityOwner; 2use syntax::ast::{self, AstNode, NameOwner, VisibilityOwner};
3use syntax::ast::{self, AstNode, NameOwner};
4 3
5use crate::{ 4use crate::{
6 utils::{find_impl_block_end, find_struct_impl, generate_impl_text}, 5 utils::{find_impl_block_end, find_struct_impl, generate_impl_text},
7 AssistContext, AssistId, AssistKind, Assists, 6 AssistContext, AssistId, AssistKind, Assists, GroupLabel,
8}; 7};
9 8
10// Assist: generate_getter_mut 9// Assist: generate_getter_mut
@@ -46,7 +45,8 @@ pub(crate) fn generate_getter_mut(acc: &mut Assists, ctx: &AssistContext) -> Opt
46 )?; 45 )?;
47 46
48 let target = field.syntax().text_range(); 47 let target = field.syntax().text_range();
49 acc.add( 48 acc.add_group(
49 &GroupLabel("Generate getter/setter".to_owned()),
50 AssistId("generate_getter_mut", AssistKind::Generate), 50 AssistId("generate_getter_mut", AssistKind::Generate),
51 "Generate a mut getter method", 51 "Generate a mut getter method",
52 target, 52 target,
diff --git a/crates/assists/src/handlers/generate_setter.rs b/crates/assists/src/handlers/generate_setter.rs
index b655f9b9c..288cf745d 100644
--- a/crates/assists/src/handlers/generate_setter.rs
+++ b/crates/assists/src/handlers/generate_setter.rs
@@ -1,10 +1,9 @@
1use stdx::{format_to, to_lower_snake_case}; 1use stdx::{format_to, to_lower_snake_case};
2use syntax::ast::VisibilityOwner; 2use syntax::ast::{self, AstNode, NameOwner, VisibilityOwner};
3use syntax::ast::{self, AstNode, NameOwner};
4 3
5use crate::{ 4use crate::{
6 utils::{find_impl_block_end, find_struct_impl, generate_impl_text}, 5 utils::{find_impl_block_end, find_struct_impl, generate_impl_text},
7 AssistContext, AssistId, AssistKind, Assists, 6 AssistContext, AssistId, AssistKind, Assists, GroupLabel,
8}; 7};
9 8
10// Assist: generate_setter 9// Assist: generate_setter
@@ -46,7 +45,8 @@ pub(crate) fn generate_setter(acc: &mut Assists, ctx: &AssistContext) -> Option<
46 )?; 45 )?;
47 46
48 let target = field.syntax().text_range(); 47 let target = field.syntax().text_range();
49 acc.add( 48 acc.add_group(
49 &GroupLabel("Generate getter/setter".to_owned()),
50 AssistId("generate_setter", AssistKind::Generate), 50 AssistId("generate_setter", AssistKind::Generate),
51 "Generate a setter method", 51 "Generate a setter method",
52 target, 52 target,