aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/typing
diff options
context:
space:
mode:
authorChetan Khilosiya <[email protected]>2021-04-08 20:01:07 +0100
committerChetan Khilosiya <[email protected]>2021-04-08 20:01:07 +0100
commita8b5400cc65d7e3d2531a6ab0e1eaf31e68a2c18 (patch)
tree2bd52853a529ee994f38520307a6edd1b6305f19 /crates/ide/src/typing
parent5f279d57f0cba600eae8c550654a00b4268812ac (diff)
8425: Added documentation for on enter covering //! doc comments.
Also added passing test case.
Diffstat (limited to 'crates/ide/src/typing')
-rw-r--r--crates/ide/src/typing/on_enter.rs20
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#"
194fn main() {
195 //! Documentation for$0 on enter
196 let x = 1 + 1;
197}
198"#,
199 r#"
200fn 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"