File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -488,14 +488,16 @@ namespace ts.formatting {
488
488
// open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent
489
489
case SyntaxKind . OpenBraceToken :
490
490
case SyntaxKind . CloseBraceToken :
491
- case SyntaxKind . OpenBracketToken :
492
- case SyntaxKind . CloseBracketToken :
493
491
case SyntaxKind . OpenParenToken :
494
492
case SyntaxKind . CloseParenToken :
495
493
case SyntaxKind . ElseKeyword :
496
494
case SyntaxKind . WhileKeyword :
497
495
case SyntaxKind . AtToken :
498
496
return indentation ;
497
+ case SyntaxKind . OpenBracketToken :
498
+ case SyntaxKind . CloseBracketToken :
499
+ return ( container . kind === SyntaxKind . MappedType ) ?
500
+ indentation + getEffectiveDelta ( delta , container ) : indentation ;
499
501
default :
500
502
// if token line equals to the line of containing node (this is a first token in the node) - use node indentation
501
503
return nodeStartLine !== line ? indentation + getEffectiveDelta ( delta , container ) : indentation ;
Original file line number Diff line number Diff line change @@ -438,6 +438,7 @@ namespace ts.formatting {
438
438
case SyntaxKind . ModuleBlock :
439
439
case SyntaxKind . ObjectLiteralExpression :
440
440
case SyntaxKind . TypeLiteral :
441
+ case SyntaxKind . MappedType :
441
442
case SyntaxKind . TupleType :
442
443
case SyntaxKind . CaseBlock :
443
444
case SyntaxKind . DefaultClause :
Original file line number Diff line number Diff line change
1
+ /// <reference path='fourslash.ts' />
2
+
3
+ /////*generic*/type t < T > = {
4
+ /////*map*/ [ P in keyof T ] : T [ P ]
5
+ //// };
6
+
7
+
8
+ format . document ( ) ;
9
+ goTo . marker ( "generic" ) ;
10
+ verify . currentLineContentIs ( "type t<T> = {" ) ;
11
+ goTo . marker ( "map" ) ;
12
+ verify . currentLineContentIs ( " [P in keyof T]: T[P]" ) ;
You can’t perform that action at this time.
0 commit comments