Markdown region folding (#55399)

* Add foldin g of regions to markdown

* Add test for region folding

* Tweak region identification regex
This commit is contained in:
Jackson Kearl
2018-08-07 13:47:29 -07:00
committed by Matt Bierner
parent 868140430d
commit 6a1515671f
2 changed files with 59 additions and 5 deletions

View File

@@ -78,6 +78,31 @@ y`);
assert.strictEqual(firstFold.end, 2);
});
test('Should fold nested <!-- #region --> markers', async () => {
const folds = await getFoldsForDocument(`a
<!-- #region -->
b
<!-- #region hello!-->
b.a
<!-- #endregion -->
b
<!-- #region: foo! -->
b.b
<!-- #endregion: foo -->
b
<!-- #endregion -->
a`);
assert.strictEqual(folds.length, 3);
const [outer, first, second] = folds.sort((a, b) => a.start - b.start);
assert.strictEqual(outer.start, 1);
assert.strictEqual(outer.end, 11);
assert.strictEqual(first.start, 3);
assert.strictEqual(first.end, 5);
assert.strictEqual(second.start, 7);
assert.strictEqual(second.end, 9);
});
});