mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-12 12:57:11 -06:00
Merge pull request #29216 from uniqueiniquity/multilineArgumentSpans
Give appropriate outlining span for array and object literals as args in call expression
This commit is contained in:
commit
aebcb6df36
@ -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 {
|
||||
|
||||
@ -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");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user