@@ -15,8 +15,7 @@ import { app } from 'electron';
1515import { basename , join } from 'vs/base/common/path' ;
1616import { URI } from 'vs/base/common/uri' ;
1717import { createDecorator } from 'vs/platform/instantiation/common/instantiation' ;
18- import { readdir , stat , exists , readFile } from 'fs' ;
19- import { parse , ParseError } from 'vs/base/common/json' ;
18+ import { readdir , stat } from 'fs' ;
2019
2120export const ID = 'diagnosticsService' ;
2221export const IDiagnosticsService = createDecorator < IDiagnosticsService > ( ID ) ;
@@ -248,14 +247,14 @@ export class DiagnosticsService implements IDiagnosticsService {
248247 output . push ( line ) ;
249248 }
250249
251- if ( workspaceStats . launchConfigFiles . length > 0 ) {
252- let line = '| Launch Configs:' ;
253- workspaceStats . launchConfigFiles . forEach ( each => {
254- const item = each . count > 1 ? ` ${ each . name } (${ each . count } )` : ` ${ each . name } ` ;
255- line += item ;
256- } ) ;
257- output . push ( line ) ;
258- }
250+ // if (workspaceStats.launchConfigFiles.length > 0) {
251+ // let line = '| Launch Configs:';
252+ // workspaceStats.launchConfigFiles.forEach(each => {
253+ // const item = each.count > 1 ? ` ${each.name}(${each.count})` : ` ${each.name}`;
254+ // line += item;
255+ // });
256+ // output.push(line);
257+ // }
259258 return output . join ( '\n' ) ;
260259 }
261260
@@ -307,17 +306,17 @@ export class DiagnosticsService implements IDiagnosticsService {
307306 }
308307}
309308
310- export interface WorkspaceStatItem {
309+ interface WorkspaceStatItem {
311310 name : string ;
312311 count : number ;
313312}
314313
315- export interface WorkspaceStats {
314+ interface WorkspaceStats {
316315 fileTypes : WorkspaceStatItem [ ] ;
317316 configFiles : WorkspaceStatItem [ ] ;
318317 fileCount : number ;
319318 maxFilesReached : boolean ;
320- launchConfigFiles : WorkspaceStatItem [ ] ;
319+ // launchConfigFiles: WorkspaceStatItem[];
321320}
322321
323322function asSortedItems ( map : Map < string , number > ) : WorkspaceStatItem [ ] {
@@ -326,48 +325,48 @@ function asSortedItems(map: Map<string, number>): WorkspaceStatItem[] {
326325 return a . sort ( ( a , b ) => b . count - a . count ) ;
327326}
328327
329- export function collectLaunchConfigs ( folder : string ) : Promise < WorkspaceStatItem [ ] > {
330- const launchConfigs = new Map < string , number > ( ) ;
331-
332- const launchConfig = join ( folder , '.vscode' , 'launch.json' ) ;
333- return new Promise ( ( resolve , reject ) => {
334- exists ( launchConfig , ( doesExist ) => {
335- if ( doesExist ) {
336- readFile ( launchConfig , ( err , contents ) => {
337- if ( err ) {
338- return resolve ( [ ] ) ;
339- }
340-
341- const errors : ParseError [ ] = [ ] ;
342- const json = parse ( contents . toString ( ) , errors ) ;
343- if ( errors . length ) {
344- console . log ( `Unable to parse ${ launchConfig } ` ) ;
345- return resolve ( [ ] ) ;
346- }
347-
348- if ( json [ 'configurations' ] ) {
349- for ( const each of json [ 'configurations' ] ) {
350- const type = each [ 'type' ] ;
351- if ( type ) {
352- if ( launchConfigs . has ( type ) ) {
353- launchConfigs . set ( type , launchConfigs . get ( type ) ! + 1 ) ;
354- } else {
355- launchConfigs . set ( type , 1 ) ;
356- }
357- }
358- }
359- }
360-
361- return resolve ( asSortedItems ( launchConfigs ) ) ;
362- } ) ;
363- } else {
364- return resolve ( [ ] ) ;
365- }
366- } ) ;
367- } ) ;
368- }
369-
370- export function collectWorkspaceStats ( folder : string , filter : string [ ] ) : Promise < WorkspaceStats > {
328+ // function collectLaunchConfigs(folder: string): Promise<WorkspaceStatItem[]> {
329+ // const launchConfigs = new Map<string, number>();
330+
331+ // const launchConfig = join(folder, '.vscode', 'launch.json');
332+ // return new Promise((resolve, reject) => {
333+ // exists(launchConfig, (doesExist) => {
334+ // if (doesExist) {
335+ // readFile(launchConfig, (err, contents) => {
336+ // if (err) {
337+ // return resolve([]);
338+ // }
339+
340+ // const errors: ParseError[] = [];
341+ // const json = parse(contents.toString(), errors);
342+ // if (errors.length) {
343+ // console.log(`Unable to parse ${launchConfig}`);
344+ // return resolve([]);
345+ // }
346+
347+ // if (json['configurations']) {
348+ // for (const each of json['configurations']) {
349+ // const type = each['type'];
350+ // if (type) {
351+ // if (launchConfigs.has(type)) {
352+ // launchConfigs.set(type, launchConfigs.get(type)! + 1);
353+ // } else {
354+ // launchConfigs.set(type, 1);
355+ // }
356+ // }
357+ // }
358+ // }
359+
360+ // return resolve(asSortedItems(launchConfigs));
361+ // });
362+ // } else {
363+ // return resolve([]);
364+ // }
365+ // });
366+ // });
367+ // }
368+
369+ function collectWorkspaceStats ( folder : string , filter : string [ ] ) : Promise < WorkspaceStats > {
371370 const configFilePatterns = [
372371 { 'tag' : 'grunt.js' , 'pattern' : / ^ g r u n t f i l e \. j s $ / i } ,
373372 { 'tag' : 'gulp.js' , 'pattern' : / ^ g u l p f i l e \. j s $ / i } ,
@@ -486,14 +485,16 @@ export function collectWorkspaceStats(folder: string, filter: string[]): Promise
486485 walk ( folder , filter , token , async ( files ) => {
487486 files . forEach ( acceptFile ) ;
488487
489- const launchConfigs = await collectLaunchConfigs ( folder ) ;
488+ // TODO@rachel commented out due to severe performance issues
489+ // see https://github.com/Microsoft/vscode/issues/70563
490+ // const launchConfigs = await collectLaunchConfigs(folder);
490491
491492 resolve ( {
492493 configFiles : asSortedItems ( configFiles ) ,
493494 fileTypes : asSortedItems ( fileTypes ) ,
494495 fileCount : token . count ,
495496 maxFilesReached : token . maxReached ,
496- launchConfigFiles : launchConfigs
497+ // launchConfigFiles: launchConfigs
497498 } ) ;
498499 } ) ;
499500 } ) ;
0 commit comments