File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -488,14 +488,16 @@ namespace ts.formatting {
488488 // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent
489489 case SyntaxKind . OpenBraceToken :
490490 case SyntaxKind . CloseBraceToken :
491- case SyntaxKind . OpenBracketToken :
492- case SyntaxKind . CloseBracketToken :
493491 case SyntaxKind . OpenParenToken :
494492 case SyntaxKind . CloseParenToken :
495493 case SyntaxKind . ElseKeyword :
496494 case SyntaxKind . WhileKeyword :
497495 case SyntaxKind . AtToken :
498496 return indentation ;
497+ case SyntaxKind . OpenBracketToken :
498+ case SyntaxKind . CloseBracketToken :
499+ return ( container . kind === SyntaxKind . MappedType ) ?
500+ indentation + getEffectiveDelta ( delta , container ) : indentation ;
499501 default :
500502 // if token line equals to the line of containing node (this is a first token in the node) - use node indentation
501503 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 {
438438 case SyntaxKind . ModuleBlock :
439439 case SyntaxKind . ObjectLiteralExpression :
440440 case SyntaxKind . TypeLiteral :
441+ case SyntaxKind . MappedType :
441442 case SyntaxKind . TupleType :
442443 case SyntaxKind . CaseBlock :
443444 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