Skip to content

Commit 2bdc8fd

Browse files
authored
add outlining spans for array destructuring elements (microsoft#38191)
1 parent 44c6cf7 commit 2bdc8fd

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

src/services/outliningElementsCollector.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ namespace ts.OutliningElementsCollector {
218218
case SyntaxKind.TemplateExpression:
219219
case SyntaxKind.NoSubstitutionTemplateLiteral:
220220
return spanForTemplateLiteral(<TemplateExpression | NoSubstitutionTemplateLiteral>n);
221+
case SyntaxKind.ArrayBindingPattern:
222+
return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !isBindingElement(n.parent), SyntaxKind.OpenBracketToken);
221223
}
222224

223225
function spanForJSXElement(node: JsxElement): OutliningSpan | undefined {
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
////const[| [
4+
//// a,
5+
//// b,
6+
//// c
7+
////]|] =[| [
8+
//// 1,
9+
//// 2,
10+
//// 3
11+
////]|];
12+
13+
////const[| [
14+
//// [|[
15+
//// [|[
16+
//// [|[
17+
//// a,
18+
//// b,
19+
//// c
20+
//// ]|]
21+
//// ]|]
22+
//// ]|],
23+
//// [|[
24+
//// a1,
25+
//// b1,
26+
//// c1
27+
//// ]|]
28+
////]|] =[| [
29+
//// [|[
30+
//// [|[
31+
//// [|[
32+
//// 1,
33+
//// 2,
34+
//// 3
35+
//// ]|]
36+
//// ]|]
37+
//// ]|],
38+
//// [|[
39+
//// 1,
40+
//// 2,
41+
//// 3
42+
//// ]|]
43+
////]|]
44+
45+
verify.outliningSpansInCurrentFile(test.ranges(), "code");

0 commit comments

Comments
 (0)