Skip to content

Commit e392013

Browse files
committed
fix fold doc comment for multiline param list fn
1 parent b9827eb commit e392013

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/tools/rust-analyzer/crates/ide/src/folding_ranges.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
7373
}
7474

7575
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());
7681
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()),
8183
kind: FoldKind::Function,
8284
});
8385
continue;

0 commit comments

Comments
 (0)