Skip to content

Commit c367795

Browse files
committed
Add failing test for overlapping chunks and sections
1 parent 872c471 commit c367795

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

crates/ark/src/lsp/folding_range.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,24 @@ mod tests {
466466
);
467467
}
468468

469+
#[test]
470+
fn test_folding_section_chunks_with_section_in_middle() {
471+
// FIXME: First chunk overlaps section, and section overlaps second
472+
// chunk. Causes section folding to not appear in Positron.
473+
insta::assert_debug_snapshot!(test_folding_range(
474+
"
475+
#+ Cell
476+
a
477+
478+
# Section ----
479+
b
480+
481+
#+ Other cell
482+
c
483+
"
484+
));
485+
}
486+
469487
#[test]
470488
fn test_folding_section_comments_basic() {
471489
// Note the chunks are nested in comment sections
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
source: crates/ark/src/lsp/folding_range.rs
3+
expression: "test_folding_range(\"\n#+ Cell\na\n\n# Section ----\nb\n\n#+ Other cell\nc\n\")"
4+
---
5+
[
6+
FoldingRange {
7+
start_line: 1,
8+
start_character: None,
9+
end_line: 6,
10+
end_character: None,
11+
kind: Some(
12+
Region,
13+
),
14+
collapsed_text: None,
15+
},
16+
FoldingRange {
17+
start_line: 4,
18+
start_character: None,
19+
end_line: 8,
20+
end_character: None,
21+
kind: Some(
22+
Region,
23+
),
24+
collapsed_text: None,
25+
},
26+
FoldingRange {
27+
start_line: 7,
28+
start_character: None,
29+
end_line: 8,
30+
end_character: None,
31+
kind: Some(
32+
Region,
33+
),
34+
collapsed_text: None,
35+
},
36+
]

0 commit comments

Comments
 (0)