Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dfc97db

Browse filesBrowse files
committed
Don't add extra indentation for objects inside function parameters
1 parent fbdbb14 commit dfc97db
Copy full SHA for dfc97db

3 files changed

+29-2Lines changed: 29 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/services/formatting/smartIndenter.ts‎

Copy file name to clipboardExpand all lines: src/services/formatting/smartIndenter.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ namespace ts.formatting {
482482
case SyntaxKind.ArrayLiteralExpression:
483483
case SyntaxKind.Block:
484484
case SyntaxKind.ModuleBlock:
485-
case SyntaxKind.ObjectLiteralExpression:
486485
case SyntaxKind.TypeLiteral:
487486
case SyntaxKind.MappedType:
488487
case SyntaxKind.TupleType:
@@ -524,6 +523,8 @@ namespace ts.formatting {
524523
return rangeIsOnOneLine(sourceFile, child!);
525524
}
526525
return true;
526+
case SyntaxKind.CallExpression:
527+
return childKind !== SyntaxKind.ObjectLiteralExpression
527528
case SyntaxKind.DoStatement:
528529
case SyntaxKind.WhileStatement:
529530
case SyntaxKind.ForInStatement:
Collapse file

‎tests/cases/fourslash/consistenceOnIndentionsOfObjectsInAListAfterFormatting.ts‎

Copy file name to clipboardExpand all lines: tests/cases/fourslash/consistenceOnIndentionsOfObjectsInAListAfterFormatting.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ format.document();
88
goTo.marker("1");
99
verify.currentLineContentIs("}, {");
1010
goTo.marker("2");
11-
verify.currentLineContentIs(" });");
11+
verify.currentLineContentIs("});");
Collapse file
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
////
4+
//// someRandomFunction({
5+
//// prop1: 1,
6+
//// prop2: 2
7+
//// }, {
8+
//// prop3: 3,
9+
//// prop4: 4
10+
//// }, {
11+
//// prop5: 5,
12+
//// prop6: 6
13+
//// });
14+
15+
format.document();
16+
verify.currentFileContentIs(`
17+
someRandomFunction({
18+
prop1: 1,
19+
prop2: 2
20+
}, {
21+
prop3: 3,
22+
prop4: 4
23+
}, {
24+
prop5: 5,
25+
prop6: 6
26+
});`);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.