@@ -23,7 +23,7 @@ use crate::{
23
23
//
24
24
// impl Person {
25
25
// /// Get a reference to the person's name.
26
- // fn name (&self) -> &String {
26
+ // fn $0name (&self) -> &String {
27
27
// &self.name
28
28
// }
29
29
// }
@@ -49,7 +49,7 @@ pub(crate) fn generate_getter(acc: &mut Assists, ctx: &AssistContext) -> Option<
49
49
//
50
50
// impl Person {
51
51
// /// Get a mutable reference to the person's name.
52
- // fn name_mut (&mut self) -> &mut String {
52
+ // fn $0name_mut (&mut self) -> &mut String {
53
53
// &mut self.name
54
54
// }
55
55
// }
@@ -119,7 +119,12 @@ pub(crate) fn generate_getter_impl(
119
119
strukt. syntax ( ) . text_range ( ) . end ( )
120
120
} ) ;
121
121
122
- builder. insert ( start_offset, buf) ;
122
+ match ctx. config . snippet_cap {
123
+ Some ( cap) => {
124
+ builder. insert_snippet ( cap, start_offset, buf. replacen ( "fn " , "fn $0" , 1 ) )
125
+ }
126
+ None => builder. insert ( start_offset, buf) ,
127
+ }
123
128
} ,
124
129
)
125
130
}
@@ -146,7 +151,7 @@ struct Context {
146
151
147
152
impl Context {
148
153
/// Get a reference to the context's data.
149
- fn data (&self) -> &Data {
154
+ fn $0data (&self) -> &Data {
150
155
&self.data
151
156
}
152
157
}
@@ -167,7 +172,7 @@ struct Context {
167
172
168
173
impl Context {
169
174
/// Get a mutable reference to the context's data.
170
- fn data_mut (&mut self) -> &mut Data {
175
+ fn $0data_mut (&mut self) -> &mut Data {
171
176
&mut self.data
172
177
}
173
178
}
@@ -224,7 +229,7 @@ pub(crate) struct Context {
224
229
225
230
impl Context {
226
231
/// Get a reference to the context's data.
227
- pub(crate) fn data (&self) -> &Data {
232
+ pub(crate) fn $0data (&self) -> &Data {
228
233
&self.data
229
234
}
230
235
}
@@ -262,7 +267,7 @@ impl Context {
262
267
}
263
268
264
269
/// Get a reference to the context's count.
265
- fn count (&self) -> &usize {
270
+ fn $0count (&self) -> &usize {
266
271
&self.count
267
272
}
268
273
}
0 commit comments