We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b9827eb commit e392013Copy full SHA for e392013
src/tools/rust-analyzer/crates/ide/src/folding_ranges.rs
@@ -73,11 +73,13 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
73
}
74
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());
81
res.push(Fold {
- range: TextRange::new(
- node.text_range().start(),
- node.text_range().end(),
- ),
82
+ range: TextRange::new(fn_start, node.text_range().end()),
83
kind: FoldKind::Function,
84
});
85
continue;
0 commit comments