Skip to content

Commit d55d3b6

Browse files
author
Côme ALLART
committed
fix: format assist doc for sourcegen_assists_docs
1 parent 998b91a commit d55d3b6

File tree

2 files changed

+58
-29
lines changed

2 files changed

+58
-29
lines changed

crates/ide_assists/src/handlers/generate_documentation_template.rs

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,34 @@ use syntax::{
77

88
use crate::assist_context::{AssistContext, Assists};
99

10-
/// Assist: generate_documentation_template
11-
///
12-
/// Adds a documentation template above a function definition / declaration
13-
///
14-
/// ```
15-
/// fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
16-
/// unimplemented!()
17-
/// }
18-
/// ```
19-
/// ->
20-
/// ```
21-
/// /// .
22-
/// ///
23-
/// /// # Examples
24-
/// ///
25-
/// /// ```rust
26-
/// /// use my_crate::my_func;
27-
/// ///
28-
/// /// let result = my_func(a, b);
29-
/// /// assert_eq!(result, );
30-
/// /// ```
31-
/// ///
32-
/// /// # Errors
33-
/// ///
34-
/// /// This function will return an error if .
35-
/// fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
36-
/// unimplemented!()
37-
/// }
38-
/// ```
10+
// Assist: generate_documentation_template
11+
//
12+
// Adds a documentation template above a function definition / declaration.
13+
//
14+
// ```
15+
// fn my_$0func(a: i32, b: i32) -> Result<(), std::io::Error> {
16+
// unimplemented!()
17+
// }
18+
// ```
19+
// ->
20+
// ```
21+
// /// .
22+
// ///
23+
// /// # Examples
24+
// ///
25+
// /// ```
26+
// /// use test::my_func;
27+
// ///
28+
// /// assert_eq!(my_func(a, b), );
29+
// /// ```
30+
// ///
31+
// /// # Errors
32+
// ///
33+
// /// This function will return an error if .
34+
// fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
35+
// unimplemented!()
36+
// }
37+
// ```
3938
pub(crate) fn generate_documentation_template(
4039
acc: &mut Assists,
4140
ctx: &AssistContext,

crates/ide_assists/src/tests/generated.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,36 @@ struct Point {
839839
)
840840
}
841841

842+
#[test]
843+
fn doctest_generate_documentation_template() {
844+
check_doc_test(
845+
"generate_documentation_template",
846+
r#####"
847+
fn my_$0func(a: i32, b: i32) -> Result<(), std::io::Error> {
848+
unimplemented!()
849+
}
850+
"#####,
851+
r#####"
852+
/// .
853+
///
854+
/// # Examples
855+
///
856+
/// ```
857+
/// use test::my_func;
858+
///
859+
/// assert_eq!(my_func(a, b), );
860+
/// ```
861+
///
862+
/// # Errors
863+
///
864+
/// This function will return an error if .
865+
fn my_func(a: i32, b: i32) -> Result<(), std::io::Error> {
866+
unimplemented!()
867+
}
868+
"#####,
869+
)
870+
}
871+
842872
#[test]
843873
fn doctest_generate_enum_as_method() {
844874
check_doc_test(

0 commit comments

Comments
 (0)