Don't add extra indentation for objects inside function parameters
This commit is contained in:
parent
fbdbb141a2
commit
dfc97db323
3 changed files with 29 additions and 2 deletions
|
@ -482,7 +482,6 @@ namespace ts.formatting {
|
||||||
case SyntaxKind.ArrayLiteralExpression:
|
case SyntaxKind.ArrayLiteralExpression:
|
||||||
case SyntaxKind.Block:
|
case SyntaxKind.Block:
|
||||||
case SyntaxKind.ModuleBlock:
|
case SyntaxKind.ModuleBlock:
|
||||||
case SyntaxKind.ObjectLiteralExpression:
|
|
||||||
case SyntaxKind.TypeLiteral:
|
case SyntaxKind.TypeLiteral:
|
||||||
case SyntaxKind.MappedType:
|
case SyntaxKind.MappedType:
|
||||||
case SyntaxKind.TupleType:
|
case SyntaxKind.TupleType:
|
||||||
|
@ -524,6 +523,8 @@ namespace ts.formatting {
|
||||||
return rangeIsOnOneLine(sourceFile, child!);
|
return rangeIsOnOneLine(sourceFile, child!);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
case SyntaxKind.CallExpression:
|
||||||
|
return childKind !== SyntaxKind.ObjectLiteralExpression
|
||||||
case SyntaxKind.DoStatement:
|
case SyntaxKind.DoStatement:
|
||||||
case SyntaxKind.WhileStatement:
|
case SyntaxKind.WhileStatement:
|
||||||
case SyntaxKind.ForInStatement:
|
case SyntaxKind.ForInStatement:
|
||||||
|
|
|
@ -8,4 +8,4 @@ format.document();
|
||||||
goTo.marker("1");
|
goTo.marker("1");
|
||||||
verify.currentLineContentIs("}, {");
|
verify.currentLineContentIs("}, {");
|
||||||
goTo.marker("2");
|
goTo.marker("2");
|
||||||
verify.currentLineContentIs(" });");
|
verify.currentLineContentIs("});");
|
||||||
|
|
26
tests/cases/fourslash/formatMultipleFunctionArguments.ts
Normal file
26
tests/cases/fourslash/formatMultipleFunctionArguments.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/// <reference path="fourslash.ts"/>
|
||||||
|
|
||||||
|
////
|
||||||
|
//// someRandomFunction({
|
||||||
|
//// prop1: 1,
|
||||||
|
//// prop2: 2
|
||||||
|
//// }, {
|
||||||
|
//// prop3: 3,
|
||||||
|
//// prop4: 4
|
||||||
|
//// }, {
|
||||||
|
//// prop5: 5,
|
||||||
|
//// prop6: 6
|
||||||
|
//// });
|
||||||
|
|
||||||
|
format.document();
|
||||||
|
verify.currentFileContentIs(`
|
||||||
|
someRandomFunction({
|
||||||
|
prop1: 1,
|
||||||
|
prop2: 2
|
||||||
|
}, {
|
||||||
|
prop3: 3,
|
||||||
|
prop4: 4
|
||||||
|
}, {
|
||||||
|
prop5: 5,
|
||||||
|
prop6: 6
|
||||||
|
});`);
|
Loading…
Reference in a new issue