File tree Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -73,11 +73,13 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
73
73
}
74
74
75
75
if fn_node. body ( ) . is_some ( ) {
76
+ // Get the actual start of the function (excluding doc comments)
77
+ let fn_start = fn_node
78
+ . fn_token ( )
79
+ . map ( |token| token. text_range ( ) . start ( ) )
80
+ . unwrap_or ( node. text_range ( ) . start ( ) ) ;
76
81
res. push ( Fold {
77
- range : TextRange :: new (
78
- node. text_range ( ) . start ( ) ,
79
- node. text_range ( ) . end ( ) ,
80
- ) ,
82
+ range : TextRange :: new ( fn_start, node. text_range ( ) . end ( ) ) ,
81
83
kind : FoldKind :: Function ,
82
84
} ) ;
83
85
continue ;
@@ -688,4 +690,21 @@ type Foo<T, U> = foo<fold arglist><
688
690
"# ,
689
691
)
690
692
}
693
+
694
+ #[ test]
695
+ fn test_fold_doc_comments_with_multiline_paramlist_function ( ) {
696
+ check (
697
+ r#"
698
+ <fold comment>/// A very very very very very very very very very very very very very very very
699
+ /// very very very long description</fold>
700
+ <fold function>fn foo<fold arglist>(
701
+ very_long_parameter_name: u32,
702
+ another_very_long_parameter_name: u32,
703
+ third_very_long_param: u32,
704
+ )</fold> <fold block>{
705
+ todo!()
706
+ }</fold></fold>
707
+ "# ,
708
+ ) ;
709
+ }
691
710
}
You can’t perform that action at this time.
0 commit comments