diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-09 00:33:36 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-09 00:33:36 +0100 |
commit | 354151df3556c5e2989746aa01a5aeb620ee9baa (patch) | |
tree | cd39c8e1e2b14255d06e05053546accfcc7b6b28 /crates/ide | |
parent | a75763cd57ac6d9cd08846770b8c5f5ba27122df (diff) | |
parent | a8b5400cc65d7e3d2531a6ab0e1eaf31e68a2c18 (diff) |
Merge #8429
8429: 8425: Added documentation for on enter covering //! doc comments. r=jonas-schievink a=chetankhilosiya
Also added passing test case.
Co-authored-by: Chetan Khilosiya <[email protected]>
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/typing/on_enter.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/ide/src/typing/on_enter.rs b/crates/ide/src/typing/on_enter.rs index 9144681bf..6f1ce3689 100644 --- a/crates/ide/src/typing/on_enter.rs +++ b/crates/ide/src/typing/on_enter.rs | |||
@@ -18,6 +18,7 @@ use text_edit::TextEdit; | |||
18 | // | 18 | // |
19 | // - kbd:[Enter] inside triple-slash comments automatically inserts `///` | 19 | // - kbd:[Enter] inside triple-slash comments automatically inserts `///` |
20 | // - kbd:[Enter] in the middle or after a trailing space in `//` inserts `//` | 20 | // - kbd:[Enter] in the middle or after a trailing space in `//` inserts `//` |
21 | // - kbd:[Enter] inside `//!` doc comments automatically inserts `//!` | ||
21 | // | 22 | // |
22 | // This action needs to be assigned to shortcut explicitly. | 23 | // This action needs to be assigned to shortcut explicitly. |
23 | // | 24 | // |
@@ -187,6 +188,25 @@ fn foo() { | |||
187 | } | 188 | } |
188 | 189 | ||
189 | #[test] | 190 | #[test] |
191 | fn continues_another_doc_comment() { | ||
192 | do_check( | ||
193 | r#" | ||
194 | fn main() { | ||
195 | //! Documentation for$0 on enter | ||
196 | let x = 1 + 1; | ||
197 | } | ||
198 | "#, | ||
199 | r#" | ||
200 | fn main() { | ||
201 | //! Documentation for | ||
202 | //! $0 on enter | ||
203 | let x = 1 + 1; | ||
204 | } | ||
205 | "#, | ||
206 | ); | ||
207 | } | ||
208 | |||
209 | #[test] | ||
190 | fn continues_code_comment_in_the_middle_of_line() { | 210 | fn continues_code_comment_in_the_middle_of_line() { |
191 | do_check( | 211 | do_check( |
192 | r" | 212 | r" |