diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 5e3ab31c46a..35f44bb34c2 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -207,10 +207,10 @@ namespace ts.OutliningElementsCollector { } function spanForObjectOrArrayLiteral(node: Node, open: SyntaxKind.OpenBraceToken | SyntaxKind.OpenBracketToken = SyntaxKind.OpenBraceToken): OutliningSpan | undefined { - // If the block has no leading keywords and is inside an array literal, + // If the block has no leading keywords and is inside an array literal or call expression, // we only want to collapse the span of the block. // Otherwise, the collapsed section will include the end of the previous line. - return spanForNode(node, /*autoCollapse*/ false, /*useFullStart*/ !isArrayLiteralExpression(node.parent), open); + return spanForNode(node, /*autoCollapse*/ false, /*useFullStart*/ !isArrayLiteralExpression(node.parent) && !isCallExpression(node.parent), open); } function spanForNode(hintSpanNode: Node, autoCollapse = false, useFullStart = true, open: SyntaxKind.OpenBraceToken | SyntaxKind.OpenBracketToken = SyntaxKind.OpenBraceToken): OutliningSpan | undefined { diff --git a/tests/cases/fourslash/getOutliningSpans.ts b/tests/cases/fourslash/getOutliningSpans.ts index 5cc8ea1012c..01a4b5cf87e 100644 --- a/tests/cases/fourslash/getOutliningSpans.ts +++ b/tests/cases/fourslash/getOutliningSpans.ts @@ -102,5 +102,18 @@ //////outline after a deeply nested node ////class AfterNestedNodes[| { ////}|] +////// function arguments +////function f(x: number[], y: number[])[| { +//// return 3; +////}|] +////f( +////// single line array literal span won't render in VS +//// [|[0]|], +//// [|[ +//// 1, +//// 2 +//// ]|] +////); + verify.outliningSpansInCurrentFile(test.ranges(), "code");