File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -363,7 +363,6 @@ namespace ts.formatting {
363
363
364
364
// formatting context is used by rules provider
365
365
const formattingContext = new FormattingContext ( sourceFile , requestKind , options ) ;
366
- let previousRangeHasError : boolean ;
367
366
let previousRange : TextRangeWithKind ;
368
367
let previousParent : Node ;
369
368
let previousRangeStartLine : number ;
@@ -848,7 +847,7 @@ namespace ts.formatting {
848
847
849
848
const rangeHasError = rangeContainsError ( range ) ;
850
849
let lineAdded : boolean ;
851
- if ( ! rangeHasError && ! previousRangeHasError ) {
850
+ if ( ! rangeHasError ) {
852
851
if ( ! previousRange ) {
853
852
// trim whitespaces starting from the beginning of the span up to the current line
854
853
const originalStart = sourceFile . getLineAndCharacterOfPosition ( originalRange . pos ) ;
@@ -863,7 +862,6 @@ namespace ts.formatting {
863
862
previousRange = range ;
864
863
previousParent = parent ;
865
864
previousRangeStartLine = rangeStart . line ;
866
- previousRangeHasError = rangeHasError ;
867
865
868
866
return lineAdded ;
869
867
}
Original file line number Diff line number Diff line change
1
+ /// <reference path="fourslash.ts"/>
2
+
3
+ //// if (true) {
4
+ //// }
5
+ //// if () {
6
+ //// }
7
+
8
+ format . setOption ( "PlaceOpenBraceOnNewLineForControlBlocks" , true ) ;
9
+ format . document ( ) ;
10
+ verify . currentFileContentIs (
11
+ `if (true)
12
+ {
13
+ }
14
+ if ()
15
+ {
16
+ }` ) ;
Original file line number Diff line number Diff line change @@ -329,7 +329,7 @@ declare namespace FourSlashInterface {
329
329
setFormatOptions ( options : FormatCodeOptions ) : any ;
330
330
selection ( startMarker : string , endMarker : string ) : void ;
331
331
onType ( posMarker : string , key : string ) : void ;
332
- setOption ( name : string , value : number | string | boolean ) : void ;
332
+ setOption ( name : keyof FormatCodeOptions , value : number | string | boolean ) : void ;
333
333
}
334
334
class cancellation {
335
335
resetCancelled ( ) : void ;
You can’t perform that action at this time.
0 commit comments