From a8b5400cc65d7e3d2531a6ab0e1eaf31e68a2c18 Mon Sep 17 00:00:00 2001 From: Chetan Khilosiya Date: Fri, 9 Apr 2021 00:31:07 +0530 Subject: [PATCH] 8425: Added documentation for on enter covering //! doc comments. Also added passing test case. --- crates/ide/src/typing/on_enter.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/crates/ide/src/typing/on_enter.rs b/crates/ide/src/typing/on_enter.rs index 9144681bfc7..6f1ce36896f 100644 --- a/crates/ide/src/typing/on_enter.rs +++ b/crates/ide/src/typing/on_enter.rs @@ -18,6 +18,7 @@ // // - kbd:[Enter] inside triple-slash comments automatically inserts `///` // - kbd:[Enter] in the middle or after a trailing space in `//` inserts `//` +// - kbd:[Enter] inside `//!` doc comments automatically inserts `//!` // // This action needs to be assigned to shortcut explicitly. // @@ -186,6 +187,25 @@ fn does_not_continue_before_doc_comment() { do_check_noop(r"$0//! docz"); } + #[test] + fn continues_another_doc_comment() { + do_check( + r#" +fn main() { + //! Documentation for$0 on enter + let x = 1 + 1; +} +"#, + r#" +fn main() { + //! Documentation for + //! $0 on enter + let x = 1 + 1; +} +"#, + ); + } + #[test] fn continues_code_comment_in_the_middle_of_line() { do_check( -- 2.44.0