fix fold doc comment for multiline param list fn

This commit is contained in:
Young-Flash 2025-07-26 11:57:48 +08:00
parent 51e77c9d7b
commit a0c7a4ab83

View File

@ -73,11 +73,13 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
} }
if fn_node.body().is_some() { if fn_node.body().is_some() {
// Get the actual start of the function (excluding doc comments)
let fn_start = fn_node
.fn_token()
.map(|token| token.text_range().start())
.unwrap_or(node.text_range().start());
res.push(Fold { res.push(Fold {
range: TextRange::new( range: TextRange::new(fn_start, node.text_range().end()),
node.text_range().start(),
node.text_range().end(),
),
kind: FoldKind::Function, kind: FoldKind::Function,
}); });
continue; continue;