Skip to content

Commit a8b5400

Browse files
8425: Added documentation for on enter covering //! doc comments.
Also added passing test case.
1 parent 5f279d5 commit a8b5400

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

crates/ide/src/typing/on_enter.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use text_edit::TextEdit;
1818
//
1919
// - kbd:[Enter] inside triple-slash comments automatically inserts `///`
2020
// - kbd:[Enter] in the middle or after a trailing space in `//` inserts `//`
21+
// - kbd:[Enter] inside `//!` doc comments automatically inserts `//!`
2122
//
2223
// This action needs to be assigned to shortcut explicitly.
2324
//
@@ -186,6 +187,25 @@ fn foo() {
186187
do_check_noop(r"$0//! docz");
187188
}
188189

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+
189209
#[test]
190210
fn continues_code_comment_in_the_middle_of_line() {
191211
do_check(

0 commit comments

Comments
 (0)