@@ -67,6 +67,7 @@ import {
6767 rangeContainsStartEnd ,
6868 rangeOverlapsWithStartEnd ,
6969 repeatString ,
70+ SemicolonPreference ,
7071 SourceFile ,
7172 SourceFileLike ,
7273 startEndContainsRange ,
@@ -980,7 +981,7 @@ function formatSpanWorker(
980981
981982 const lastTriviaWasNewLine = formattingScanner . lastTrailingTriviaWasNewLine ( ) ;
982983 let indentToken = false ;
983- let isNewlineSemicolon = false ;
984+ let unindentToken = false ;
984985
985986 if ( currentTokenInfo . leadingTrivia ) {
986987 processTrivia ( currentTokenInfo . leadingTrivia , parent , childContextNode , dynamicIndentation ) ;
@@ -1002,7 +1003,7 @@ function formatSpanWorker(
10021003 const prevEndLine = savePreviousRange && sourceFile . getLineAndCharacterOfPosition ( savePreviousRange . end ) . line ;
10031004 indentToken = lastTriviaWasNewLine && tokenStart . line !== prevEndLine ;
10041005
1005- isNewlineSemicolon = currentTokenInfo . token . kind === SyntaxKind . SemicolonToken ;
1006+ unindentToken = currentTokenInfo . token . kind === SyntaxKind . SemicolonToken && formattingContext . options . semicolons === SemicolonPreference . Remove ;
10061007 }
10071008 else {
10081009 indentToken = lineAction === LineAction . LineAdded ;
@@ -1017,7 +1018,7 @@ function formatSpanWorker(
10171018
10181019 if ( indentToken ) {
10191020 const tokenIndentation = ( isTokenInRange && ! rangeContainsError ( currentTokenInfo . token ) ) ?
1020- dynamicIndentation . getIndentationForToken ( tokenStart . line , currentTokenInfo . token . kind , container , ! ! isListEndToken || isNewlineSemicolon ) :
1021+ dynamicIndentation . getIndentationForToken ( tokenStart . line , currentTokenInfo . token . kind , container , ! ! isListEndToken || unindentToken ) :
10211022 Constants . Unknown ;
10221023
10231024 let indentNextTokenOrTrivia = true ;
0 commit comments