add outlining spans for array destructuring elements (#38191)

This commit is contained in:
Alexander T 2020-05-05 19:29:24 +03:00 committed by GitHub
parent 44c6cf74cb
commit 2bdc8fdc94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 0 deletions

View file

@ -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 {

View 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");