mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Update crates/ide/src/folding_ranges.rs
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
parent
084b21bc36
commit
75015b6eaa
1 changed files with 2 additions and 2 deletions
|
@ -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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue