@@ -975,28 +975,28 @@ namespace ts.formatting {
975
975
// split comment in lines
976
976
let startLine = sourceFile . getLineAndCharacterOfPosition ( commentRange . pos ) . line ;
977
977
const endLine = sourceFile . getLineAndCharacterOfPosition ( commentRange . end ) . line ;
978
- let parts : TextRange [ ] ;
979
978
if ( startLine === endLine ) {
980
979
if ( ! firstLineIsIndented ) {
981
980
// treat as single line comment
982
981
insertIndentation ( commentRange . pos , indentation , /*lineAdded*/ false ) ;
983
982
}
984
983
return ;
985
984
}
986
- else {
987
- parts = [ ] ;
988
- let startPos = commentRange . pos ;
989
- for ( let line = startLine ; line < endLine ; line ++ ) {
990
- const endOfLine = getEndLinePosition ( line , sourceFile ) ;
991
- parts . push ( { pos : startPos , end : endOfLine } ) ;
992
- startPos = getStartPositionOfLine ( line + 1 , sourceFile ) ;
993
- }
994
985
995
- if ( indentFinalLine ) {
996
- parts . push ( { pos : startPos , end : commentRange . end } ) ;
997
- }
986
+ const parts : TextRange [ ] = [ ] ;
987
+ let startPos = commentRange . pos ;
988
+ for ( let line = startLine ; line < endLine ; line ++ ) {
989
+ const endOfLine = getEndLinePosition ( line , sourceFile ) ;
990
+ parts . push ( { pos : startPos , end : endOfLine } ) ;
991
+ startPos = getStartPositionOfLine ( line + 1 , sourceFile ) ;
998
992
}
999
993
994
+ if ( indentFinalLine ) {
995
+ parts . push ( { pos : startPos , end : commentRange . end } ) ;
996
+ }
997
+
998
+ if ( parts . length === 0 ) return ;
999
+
1000
1000
const startLinePos = getStartPositionOfLine ( startLine , sourceFile ) ;
1001
1001
1002
1002
const nonWhitespaceColumnInFirstPart =
0 commit comments