Skip to content

Commit 1924fe0

Browse files
committed
comments for suppressDelta and indentationOnLastIndentedLine
1 parent 0aa0e53 commit 1924fe0

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/services/formatting/formatting.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
///<reference path='..\services.ts' />
1+
///<reference path='..\services.ts' />
22
///<reference path='formattingScanner.ts' />
33
///<reference path='rulesProvider.ts' />
44
///<reference path='references.ts' />
@@ -542,6 +542,16 @@ namespace ts.formatting {
542542
}
543543
}
544544
if (suppressDelta) {
545+
// if list end token is LessThanToken '>' then its delta should be explicitly suppressed
546+
// so that LessThanToken as a binary operator can still be indented.
547+
// foo.then
548+
// <
549+
// number,
550+
// string,
551+
// >();
552+
// vs
553+
// var a = xValue
554+
// > yValue;
545555
return indentation;
546556
}
547557
else {
@@ -722,6 +732,10 @@ namespace ts.formatting {
722732
consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent);
723733

724734
if (indentationOnLastIndentedLine !== Constants.Unknown) {
735+
// scanner just processed list start token so consider last indentation as list indentation
736+
// function foo(): { // last indentation was 0, list item will be indented based on this value
737+
// foo: number;
738+
// }: {};
725739
indentationOnListStartToken = indentationOnLastIndentedLine;
726740
}
727741
else {

0 commit comments

Comments
 (0)