diff options
author | Lukas Wirth <[email protected]> | 2021-03-21 10:05:04 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-03-21 10:05:04 +0000 |
commit | f3c7499be58941827ac8f500083b32ca74e0e8c4 (patch) | |
tree | e205e4608fe91eca4149c8a30cb6897489203243 /crates/ide_completion/src/completions | |
parent | 2280f62a40f31d83fd79b62c46dd3d610354d78c (diff) |
Add `'` to trigger_characters, allowing more direct lifetime completions
Diffstat (limited to 'crates/ide_completion/src/completions')
-rw-r--r-- | crates/ide_completion/src/completions/lifetime.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/crates/ide_completion/src/completions/lifetime.rs b/crates/ide_completion/src/completions/lifetime.rs index 628c1fb9b..5eeddf7a4 100644 --- a/crates/ide_completion/src/completions/lifetime.rs +++ b/crates/ide_completion/src/completions/lifetime.rs | |||
@@ -70,6 +70,16 @@ fn func<'lifetime>(foo: &'li$0) {} | |||
70 | fn func<'lifetime>(foo: &'lifetime) {} | 70 | fn func<'lifetime>(foo: &'lifetime) {} |
71 | "#, | 71 | "#, |
72 | ); | 72 | ); |
73 | cov_mark::check!(completes_if_lifetime_without_idents); | ||
74 | check_edit( | ||
75 | "'lifetime", | ||
76 | r#" | ||
77 | fn func<'lifetime>(foo: &'$0) {} | ||
78 | "#, | ||
79 | r#" | ||
80 | fn func<'lifetime>(foo: &'lifetime) {} | ||
81 | "#, | ||
82 | ); | ||
73 | } | 83 | } |
74 | 84 | ||
75 | #[test] | 85 | #[test] |
@@ -192,6 +202,27 @@ fn foo<'footime, 'lifetime: 'a$0>() {} | |||
192 | } | 202 | } |
193 | 203 | ||
194 | #[test] | 204 | #[test] |
205 | fn check_label_edit() { | ||
206 | check_edit( | ||
207 | "'label", | ||
208 | r#" | ||
209 | fn foo() { | ||
210 | 'label: loop { | ||
211 | break '$0 | ||
212 | } | ||
213 | } | ||
214 | "#, | ||
215 | r#" | ||
216 | fn foo() { | ||
217 | 'label: loop { | ||
218 | break 'label | ||
219 | } | ||
220 | } | ||
221 | "#, | ||
222 | ); | ||
223 | } | ||
224 | |||
225 | #[test] | ||
195 | fn complete_label_in_loop() { | 226 | fn complete_label_in_loop() { |
196 | check( | 227 | check( |
197 | r#" | 228 | r#" |