File tree 5 files changed +16
-9
lines changed
tests/baselines/reference/api
5 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -428,6 +428,7 @@ namespace ts {
428
428
newLine : string ;
429
429
useCaseSensitiveFileNames : boolean ;
430
430
write ( s : string ) : void ;
431
+ writeOutputIsTTY ?( ) : boolean ;
431
432
readFile ( path : string , encoding ?: string ) : string | undefined ;
432
433
getFileSize ?( path : string ) : number ;
433
434
writeFile ( path : string , data : string , writeByteOrderMark ?: boolean ) : void ;
@@ -561,6 +562,9 @@ namespace ts {
561
562
write ( s : string ) : void {
562
563
process . stdout . write ( s ) ;
563
564
} ,
565
+ writeOutputIsTTY ( ) {
566
+ return process . stdout . isTTY ;
567
+ } ,
564
568
readFile,
565
569
writeFile,
566
570
watchFile : getWatchFile ( ) ,
Original file line number Diff line number Diff line change @@ -19,11 +19,18 @@ namespace ts {
19
19
20
20
let reportDiagnostic = createDiagnosticReporter ( sys ) ;
21
21
function updateReportDiagnostic ( options : CompilerOptions ) {
22
- if ( options . pretty ) {
22
+ if ( shouldBePretty ( options ) ) {
23
23
reportDiagnostic = createDiagnosticReporter ( sys , /*pretty*/ true ) ;
24
24
}
25
25
}
26
26
27
+ function shouldBePretty ( options : CompilerOptions ) {
28
+ if ( typeof options . pretty === "undefined" ) {
29
+ return ! ! sys . writeOutputIsTTY && sys . writeOutputIsTTY ( ) ;
30
+ }
31
+ return options . pretty ;
32
+ }
33
+
27
34
function padLeft ( s : string , length : number ) {
28
35
while ( s . length < length ) {
29
36
s = " " + s ;
@@ -159,7 +166,7 @@ namespace ts {
159
166
}
160
167
161
168
function createWatchStatusReporter ( options : CompilerOptions ) {
162
- return ts . createWatchStatusReporter ( sys , ! ! options . pretty ) ;
169
+ return ts . createWatchStatusReporter ( sys , shouldBePretty ( options ) ) ;
163
170
}
164
171
165
172
function createWatchOfConfigFile ( configParseResult : ParsedCommandLine , optionsToExtend : CompilerOptions ) {
Original file line number Diff line number Diff line change @@ -4195,7 +4195,7 @@ namespace ts {
4195
4195
preserveSymlinks ?: boolean ;
4196
4196
/* @internal */ preserveWatchOutput ?: boolean ;
4197
4197
project ?: string ;
4198
- /* @internal */ pretty ?: DiagnosticStyle ;
4198
+ /* @internal */ pretty ?: boolean ;
4199
4199
reactNamespace ?: string ;
4200
4200
jsxFactory ?: string ;
4201
4201
removeComments ?: boolean ;
@@ -4293,12 +4293,6 @@ namespace ts {
4293
4293
JSX ,
4294
4294
}
4295
4295
4296
- /* @internal */
4297
- export const enum DiagnosticStyle {
4298
- Simple ,
4299
- Pretty ,
4300
- }
4301
-
4302
4296
/** Either a parsed command line or a parsed tsconfig.json */
4303
4297
export interface ParsedCommandLine {
4304
4298
options : CompilerOptions ;
Original file line number Diff line number Diff line change @@ -2889,6 +2889,7 @@ declare namespace ts {
2889
2889
newLine : string ;
2890
2890
useCaseSensitiveFileNames : boolean ;
2891
2891
write ( s : string ) : void ;
2892
+ writeOutputIsTTY ?( ) : boolean ;
2892
2893
readFile ( path : string , encoding ?: string ) : string | undefined ;
2893
2894
getFileSize ?( path : string ) : number ;
2894
2895
writeFile ( path : string , data : string , writeByteOrderMark ?: boolean ) : void ;
Original file line number Diff line number Diff line change @@ -2889,6 +2889,7 @@ declare namespace ts {
2889
2889
newLine : string ;
2890
2890
useCaseSensitiveFileNames : boolean ;
2891
2891
write ( s : string ) : void ;
2892
+ writeOutputIsTTY ?( ) : boolean ;
2892
2893
readFile ( path : string , encoding ?: string ) : string | undefined ;
2893
2894
getFileSize ?( path : string ) : number ;
2894
2895
writeFile ( path : string , data : string , writeByteOrderMark ?: boolean ) : void ;
You can’t perform that action at this time.
0 commit comments