add outlining spans for array destructuring elements (#38191)
This commit is contained in:
parent
44c6cf74cb
commit
2bdc8fdc94
|
@ -218,6 +218,8 @@ namespace ts.OutliningElementsCollector {
|
|||
case SyntaxKind.TemplateExpression:
|
||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||
return spanForTemplateLiteral(<TemplateExpression | NoSubstitutionTemplateLiteral>n);
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !isBindingElement(n.parent), SyntaxKind.OpenBracketToken);
|
||||
}
|
||||
|
||||
function spanForJSXElement(node: JsxElement): OutliningSpan | undefined {
|
||||
|
|
45
tests/cases/fourslash/getOutliningForArrayDestructuring.ts
Normal file
45
tests/cases/fourslash/getOutliningForArrayDestructuring.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////const[| [
|
||||
//// a,
|
||||
//// b,
|
||||
//// c
|
||||
////]|] =[| [
|
||||
//// 1,
|
||||
//// 2,
|
||||
//// 3
|
||||
////]|];
|
||||
|
||||
////const[| [
|
||||
//// [|[
|
||||
//// [|[
|
||||
//// [|[
|
||||
//// a,
|
||||
//// b,
|
||||
//// c
|
||||
//// ]|]
|
||||
//// ]|]
|
||||
//// ]|],
|
||||
//// [|[
|
||||
//// a1,
|
||||
//// b1,
|
||||
//// c1
|
||||
//// ]|]
|
||||
////]|] =[| [
|
||||
//// [|[
|
||||
//// [|[
|
||||
//// [|[
|
||||
//// 1,
|
||||
//// 2,
|
||||
//// 3
|
||||
//// ]|]
|
||||
//// ]|]
|
||||
//// ]|],
|
||||
//// [|[
|
||||
//// 1,
|
||||
//// 2,
|
||||
//// 3
|
||||
//// ]|]
|
||||
////]|]
|
||||
|
||||
verify.outliningSpansInCurrentFile(test.ranges(), "code");
|
Loading…
Reference in a new issue