@@ -88,14 +88,8 @@ export class ApplyTreeDataProvider implements vscode.TreeDataProvider<vscode.Tre
8888 }
8989
9090 try {
91- const result = await axios . get ( apply . logReadUrl , {
92- headers : { Accept : 'text/plain' } ,
93- responseType : 'stream' ,
94- } ) ;
95- const lineStream = readline . createInterface ( {
96- input : result . data ,
97- output : new Writable ( ) ,
98- } ) ;
91+ const result = await axios . get ( apply . logReadUrl , { headers : { Accept : 'text/plain' } , responseType : 'stream' } ) ;
92+ const lineStream = readline . createInterface ( { input : result . data , output : new Writable ( ) } ) ;
9993
10094 const applyLog : ApplyLog = { } ;
10195
@@ -104,9 +98,7 @@ export class ApplyTreeDataProvider implements vscode.TreeDataProvider<vscode.Tre
10498 const logLine : LogLine = JSON . parse ( line ) ;
10599
106100 if ( logLine . type === 'apply_complete' && logLine . hook ) {
107- if ( ! applyLog . appliedChanges ) {
108- applyLog . appliedChanges = [ ] ;
109- }
101+ applyLog . appliedChanges ??= [ ] ;
110102 applyLog . appliedChanges . push ( logLine . hook ) ;
111103 continue ;
112104 }
@@ -119,15 +111,9 @@ export class ApplyTreeDataProvider implements vscode.TreeDataProvider<vscode.Tre
119111 continue ;
120112 }
121113 if ( logLine . type === 'diagnostic' && logLine . diagnostic ) {
122- if ( ! applyLog . diagnostics ) {
123- applyLog . diagnostics = [ ] ;
124- }
125- if ( ! applyLog . diagnosticSummary ) {
126- applyLog . diagnosticSummary = {
127- errorCount : 0 ,
128- warningCount : 0 ,
129- } ;
130- }
114+ applyLog . diagnostics ??= [ ] ;
115+ applyLog . diagnosticSummary ??= { errorCount : 0 , warningCount : 0 } ;
116+
131117 applyLog . diagnostics . push ( logLine . diagnostic ) ;
132118 if ( logLine . diagnostic . severity === 'warning' ) {
133119 applyLog . diagnosticSummary . warningCount += 1 ;
@@ -164,10 +150,7 @@ export class ApplyTreeDataProvider implements vscode.TreeDataProvider<vscode.Tre
164150 if ( error instanceof Error ) {
165151 message += error . message ;
166152 vscode . window . showErrorMessage ( message ) ;
167- this . reporter . sendTelemetryErrorEvent ( 'applyLogError' , {
168- message : message ,
169- stack : error . stack ,
170- } ) ;
153+ this . reporter . sendTelemetryErrorEvent ( 'applyLogError' , { message : message , stack : error . stack } ) ;
171154 return ;
172155 }
173156
0 commit comments