mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Folding range for return types
This commit is contained in:
parent
bca00ac340
commit
156d995423
2 changed files with 16 additions and 0 deletions
|
@ -19,6 +19,7 @@ pub enum FoldKind {
|
|||
Statics,
|
||||
Array,
|
||||
WhereClause,
|
||||
ReturnType,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -131,6 +132,7 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
|
|||
COMMENT => Some(FoldKind::Comment),
|
||||
ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList),
|
||||
ARRAY_EXPR => Some(FoldKind::Array),
|
||||
RET_TYPE => Some(FoldKind::ReturnType),
|
||||
ASSOC_ITEM_LIST
|
||||
| RECORD_FIELD_LIST
|
||||
| RECORD_PAT_FIELD_LIST
|
||||
|
@ -300,6 +302,7 @@ mod tests {
|
|||
FoldKind::Statics => "statics",
|
||||
FoldKind::Array => "array",
|
||||
FoldKind::WhereClause => "whereclause",
|
||||
FoldKind::ReturnType => "returntype",
|
||||
};
|
||||
assert_eq!(kind, &attr.unwrap());
|
||||
}
|
||||
|
@ -560,4 +563,16 @@ where
|
|||
"#,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fold_return_type() {
|
||||
check(
|
||||
r#"
|
||||
fn foo()<fold returntype>-> (
|
||||
bool,
|
||||
bool,
|
||||
)</fold> { (true, true) }
|
||||
"#,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue