@@ -1744,7 +1744,7 @@ export class DefaultClient implements Client {
1744
1744
languageClient = new LanguageClient ( `cpptools` , serverOptions , clientOptions ) ;
1745
1745
languageClient . onNotification ( DebugProtocolNotification , logDebugProtocol ) ;
1746
1746
languageClient . onNotification ( DebugLogNotification , logLocalized ) ;
1747
- languageClient . onNotification ( LogTelemetryNotification , ( e ) => this . logTelemetry ( e ) ) ;
1747
+ languageClient . onNotification ( LogTelemetryNotification , ( e ) => void this . logTelemetry ( e ) ) ;
1748
1748
languageClient . onNotification ( ShowMessageWindowNotification , showMessageWindow ) ;
1749
1749
languageClient . registerProposedFeatures ( ) ;
1750
1750
await languageClient . start ( ) ;
@@ -2778,10 +2778,38 @@ export class DefaultClient implements Client {
2778
2778
}
2779
2779
}
2780
2780
2781
- private logTelemetry ( notificationBody : TelemetryPayload ) : void {
2781
+ private excessiveFilesWarningShown : boolean = false ;
2782
+ private async logTelemetry ( notificationBody : TelemetryPayload ) : Promise < void > {
2782
2783
if ( notificationBody . event === "includeSquiggles" && this . configurationProvider && notificationBody . properties ) {
2783
2784
notificationBody . properties [ "providerId" ] = this . configurationProvider ;
2784
2785
}
2786
+
2787
+ const showExcessiveFilesWarning = new PersistentWorkspaceState < boolean > ( 'CPP.showExcessiveFilesWarning' , true ) ;
2788
+ if ( ! this . excessiveFilesWarningShown && showExcessiveFilesWarning . Value && notificationBody . event === 'ParsingStats' ) {
2789
+ const filesDiscovered = notificationBody . metrics ?. filesDiscovered ?? 0 ;
2790
+ const parsableFiles = notificationBody . metrics ?. parsableFiles ?? 0 ;
2791
+ if ( filesDiscovered > 250000 || parsableFiles > 100000 ) {
2792
+ // According to telemetry, less than 3% of workspaces have this many files so it seems like a reasonable threshold.
2793
+
2794
+ const message = localize (
2795
+ "parsing.stats.large.project" ,
2796
+ 'Enumerated {0} files with {1} C/C++ source files detected. You may want to consider excluding some files for better performance.' ,
2797
+ filesDiscovered ,
2798
+ parsableFiles ) ;
2799
+ const learnMore = localize ( 'learn.more' , 'Learn More' ) ;
2800
+ const dontShowAgain = localize ( 'dont.show.again' , 'Don\'t Show Again' ) ;
2801
+
2802
+ // We only want to show this once per session.
2803
+ this . excessiveFilesWarningShown = true ;
2804
+ const response = await vscode . window . showInformationMessage ( message , learnMore , dontShowAgain ) ;
2805
+
2806
+ if ( response === dontShowAgain ) {
2807
+ showExcessiveFilesWarning . Value = false ;
2808
+ } else if ( response === learnMore ) {
2809
+ void vscode . commands . executeCommand ( 'vscode.open' , vscode . Uri . parse ( 'https://go.microsoft.com/fwlink/?linkid=2333292' ) ) ;
2810
+ }
2811
+ }
2812
+ }
2785
2813
telemetry . logLanguageServerEvent ( notificationBody . event , notificationBody . properties , notificationBody . metrics ) ;
2786
2814
}
2787
2815
0 commit comments