@@ -59,7 +59,7 @@ import { CopilotCompletionContextFeatures, CopilotCompletionContextProvider } fr
5959import { CustomConfigurationProvider1 , getCustomConfigProviders , isSameProviderExtensionId } from './customProviders' ;
6060import { DataBinding } from './dataBinding' ;
6161import { cachedEditorConfigSettings , getEditorConfigSettings } from './editorConfig' ;
62- import { CppSourceStr , clients , configPrefix , initializeIntervalTimer , updateLanguageConfigurations , usesCrashHandler , watchForCrashes } from './extension' ;
62+ import { CppSourceStr , clients , configPrefix , initializeIntervalTimer , isWritingCrashCallStack , updateLanguageConfigurations , usesCrashHandler , watchForCrashes } from './extension' ;
6363import { LocalizeStringParams , getLocaleId , getLocalizedString } from './localization' ;
6464import { PersistentFolderState , PersistentState , PersistentWorkspaceState } from './persistentState' ;
6565import { RequestCancelled , ServerCancelled , createProtocolFilter } from './protocolFilter' ;
@@ -942,6 +942,8 @@ export class DefaultClient implements Client {
942942 public getShowConfigureIntelliSenseButton ( ) : boolean { return this . showConfigureIntelliSenseButton ; }
943943 public setShowConfigureIntelliSenseButton ( show : boolean ) : void { this . showConfigureIntelliSenseButton = show ; }
944944
945+ private lastInvokedLspMessage : string = "" ; // e.g. cpptools/hover
946+
945947 /**
946948 * don't use this.rootFolder directly since it can be undefined
947949 */
@@ -1677,7 +1679,6 @@ export class DefaultClient implements Client {
16771679 closed : ( ) => {
16781680 languageClientCrashTimes . push ( Date . now ( ) ) ;
16791681 languageClientCrashedNeedsRestart = true ;
1680- telemetry . logLanguageServerEvent ( "languageClientCrash" ) ;
16811682 let restart : boolean = true ;
16821683 if ( languageClientCrashTimes . length < 5 ) {
16831684 void clients . recreateClients ( ) ;
@@ -1691,6 +1692,27 @@ export class DefaultClient implements Client {
16911692 void clients . recreateClients ( ) ;
16921693 }
16931694 }
1695+
1696+ // Wait 1 second to allow time for the file watcher to signal a crash call stack write has occurred.
1697+ setTimeout ( ( ) => {
1698+ const sanitizedLspMessage = this . lastInvokedLspMessage . replace ( '/' , '.' ) ;
1699+ telemetry . logLanguageServerEvent ( "languageClientCrash" ,
1700+ {
1701+ lastInvokedLspMessage : sanitizedLspMessage
1702+ } ,
1703+ {
1704+ restarting : Number ( restart ) ,
1705+ writingCrashCallStack : Number ( isWritingCrashCallStack ) ,
1706+ initializingWorkspace : Number ( this . model . isInitializingWorkspace . Value ) ,
1707+ indexingWorkspace : Number ( this . model . isIndexingWorkspace . Value ) ,
1708+ parsingWorkspace : Number ( this . model . isParsingWorkspace . Value ) ,
1709+ parsingFiles : Number ( this . model . isParsingFiles . Value ) ,
1710+ updatingIntelliSense : Number ( this . model . isUpdatingIntelliSense . Value ) ,
1711+ runningCodeAnalysis : Number ( this . model . isRunningCodeAnalysis . Value )
1712+ }
1713+ ) ;
1714+ } , 1000 ) ;
1715+
16941716 const message : string = restart ? localize ( 'server.crashed.restart' , 'The language server crashed. Restarting...' )
16951717 : localize ( 'server.crashed2' , 'The language server crashed 5 times in the last 3 minutes. It will not be restarted.' ) ;
16961718
@@ -2747,55 +2769,59 @@ export class DefaultClient implements Client {
27472769 const message : string = notificationBody . status ;
27482770 util . setProgress ( util . getProgressExecutableSuccess ( ) ) ;
27492771 const testHook : TestHook = getTestHook ( ) ;
2750- if ( message . endsWith ( "Idle" ) ) {
2751- const status : IntelliSenseStatus = { status : Status . Idle } ;
2752- testHook . updateStatus ( status ) ;
2753- } else if ( message . endsWith ( "Parsing" ) ) {
2754- this . model . isParsingWorkspace . Value = true ;
2755- this . model . isInitializingWorkspace . Value = false ;
2756- this . model . isIndexingWorkspace . Value = false ;
2757- const status : IntelliSenseStatus = { status : Status . TagParsingBegun } ;
2758- testHook . updateStatus ( status ) ;
2759- } else if ( message . endsWith ( "Initializing" ) ) {
2760- this . model . isInitializingWorkspace . Value = true ;
2761- this . model . isIndexingWorkspace . Value = false ;
2762- this . model . isParsingWorkspace . Value = false ;
2763- } else if ( message . endsWith ( "Indexing" ) ) {
2764- this . model . isIndexingWorkspace . Value = true ;
2765- this . model . isInitializingWorkspace . Value = false ;
2766- this . model . isParsingWorkspace . Value = false ;
2767- } else if ( message . endsWith ( "files" ) ) {
2768- this . model . isParsingFiles . Value = true ;
2769- } else if ( message . endsWith ( "IntelliSense" ) ) {
2770- timeStamp = Date . now ( ) ;
2771- this . model . isUpdatingIntelliSense . Value = true ;
2772- const status : IntelliSenseStatus = { status : Status . IntelliSenseCompiling } ;
2773- testHook . updateStatus ( status ) ;
2774- } else if ( message . endsWith ( "IntelliSense done" ) ) {
2775- getOutputChannelLogger ( ) . appendLineAtLevel ( 6 , localize ( "update.intellisense.time" , "Update IntelliSense time (sec): {0}" , ( Date . now ( ) - timeStamp ) / 1000 ) ) ;
2776- this . model . isUpdatingIntelliSense . Value = false ;
2777- const status : IntelliSenseStatus = { status : Status . IntelliSenseReady } ;
2778- testHook . updateStatus ( status ) ;
2779- } else if ( message . endsWith ( "Parsing done" ) ) { // Tag Parser Ready
2780- this . model . isParsingWorkspace . Value = false ;
2781- const status : IntelliSenseStatus = { status : Status . TagParsingDone } ;
2782- testHook . updateStatus ( status ) ;
2783- util . setProgress ( util . getProgressParseRootSuccess ( ) ) ;
2784- } else if ( message . endsWith ( "files done" ) ) {
2785- this . model . isParsingFiles . Value = false ;
2786- } else if ( message . endsWith ( "Analysis" ) ) {
2787- this . model . isRunningCodeAnalysis . Value = true ;
2788- this . model . codeAnalysisTotal . Value = 1 ;
2789- this . model . codeAnalysisProcessed . Value = 0 ;
2790- } else if ( message . endsWith ( "Analysis done" ) ) {
2791- this . model . isRunningCodeAnalysis . Value = false ;
2792- } else if ( message . includes ( "Squiggles Finished - File name:" ) ) {
2793- const index : number = message . lastIndexOf ( ":" ) ;
2794- const name : string = message . substring ( index + 2 ) ;
2795- const status : IntelliSenseStatus = { status : Status . IntelliSenseReady , filename : name } ;
2796- testHook . updateStatus ( status ) ;
2797- } else if ( message . endsWith ( "No Squiggles" ) ) {
2798- util . setIntelliSenseProgress ( util . getProgressIntelliSenseNoSquiggles ( ) ) ;
2772+ if ( message . startsWith ( "C_Cpp: " ) ) {
2773+ if ( message . endsWith ( "Idle" ) ) {
2774+ const status : IntelliSenseStatus = { status : Status . Idle } ;
2775+ testHook . updateStatus ( status ) ;
2776+ } else if ( message . endsWith ( "Parsing" ) ) {
2777+ this . model . isParsingWorkspace . Value = true ;
2778+ this . model . isInitializingWorkspace . Value = false ;
2779+ this . model . isIndexingWorkspace . Value = false ;
2780+ const status : IntelliSenseStatus = { status : Status . TagParsingBegun } ;
2781+ testHook . updateStatus ( status ) ;
2782+ } else if ( message . endsWith ( "Initializing" ) ) {
2783+ this . model . isInitializingWorkspace . Value = true ;
2784+ this . model . isIndexingWorkspace . Value = false ;
2785+ this . model . isParsingWorkspace . Value = false ;
2786+ } else if ( message . endsWith ( "Indexing" ) ) {
2787+ this . model . isIndexingWorkspace . Value = true ;
2788+ this . model . isInitializingWorkspace . Value = false ;
2789+ this . model . isParsingWorkspace . Value = false ;
2790+ } else if ( message . endsWith ( "files" ) ) {
2791+ this . model . isParsingFiles . Value = true ;
2792+ } else if ( message . endsWith ( "IntelliSense" ) ) {
2793+ timeStamp = Date . now ( ) ;
2794+ this . model . isUpdatingIntelliSense . Value = true ;
2795+ const status : IntelliSenseStatus = { status : Status . IntelliSenseCompiling } ;
2796+ testHook . updateStatus ( status ) ;
2797+ } else if ( message . endsWith ( "IntelliSense done" ) ) {
2798+ getOutputChannelLogger ( ) . appendLineAtLevel ( 6 , localize ( "update.intellisense.time" , "Update IntelliSense time (sec): {0}" , ( Date . now ( ) - timeStamp ) / 1000 ) ) ;
2799+ this . model . isUpdatingIntelliSense . Value = false ;
2800+ const status : IntelliSenseStatus = { status : Status . IntelliSenseReady } ;
2801+ testHook . updateStatus ( status ) ;
2802+ } else if ( message . endsWith ( "Parsing done" ) ) { // Tag Parser Ready
2803+ this . model . isParsingWorkspace . Value = false ;
2804+ const status : IntelliSenseStatus = { status : Status . TagParsingDone } ;
2805+ testHook . updateStatus ( status ) ;
2806+ util . setProgress ( util . getProgressParseRootSuccess ( ) ) ;
2807+ } else if ( message . endsWith ( "files done" ) ) {
2808+ this . model . isParsingFiles . Value = false ;
2809+ } else if ( message . endsWith ( "Analysis" ) ) {
2810+ this . model . isRunningCodeAnalysis . Value = true ;
2811+ this . model . codeAnalysisTotal . Value = 1 ;
2812+ this . model . codeAnalysisProcessed . Value = 0 ;
2813+ } else if ( message . endsWith ( "Analysis done" ) ) {
2814+ this . model . isRunningCodeAnalysis . Value = false ;
2815+ } else if ( message . includes ( "Squiggles Finished - File name:" ) ) {
2816+ const index : number = message . lastIndexOf ( ":" ) ;
2817+ const name : string = message . substring ( index + 2 ) ;
2818+ const status : IntelliSenseStatus = { status : Status . IntelliSenseReady , filename : name } ;
2819+ testHook . updateStatus ( status ) ;
2820+ } else if ( message . endsWith ( "No Squiggles" ) ) {
2821+ util . setIntelliSenseProgress ( util . getProgressIntelliSenseNoSquiggles ( ) ) ;
2822+ }
2823+ } else if ( message . includes ( "/" ) ) {
2824+ this . lastInvokedLspMessage = message ;
27992825 }
28002826 }
28012827
0 commit comments