Update crates/ide/src/folding_ranges.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
@@ -55,10 +55,10 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
|
|||||||
if comment.text().trim().starts_with("// region:") {
|
if comment.text().trim().starts_with("// region:") {
|
||||||
regions_starts.push(comment.syntax().text_range().start());
|
regions_starts.push(comment.syntax().text_range().start());
|
||||||
} else if comment.text().trim().starts_with("// endregion") {
|
} else if comment.text().trim().starts_with("// endregion") {
|
||||||
if !regions_starts.is_empty() {
|
if let Some(region) = regions_starts.pop() {
|
||||||
res.push(Fold {
|
res.push(Fold {
|
||||||
range: TextRange::new(
|
range: TextRange::new(
|
||||||
regions_starts.pop().unwrap(),
|
region,
|
||||||
comment.syntax().text_range().end(),
|
comment.syntax().text_range().end(),
|
||||||
),
|
),
|
||||||
kind: FoldKind::Region,
|
kind: FoldKind::Region,
|
||||||
|
|||||||
Reference in New Issue
Block a user