@@ -119,6 +119,7 @@ const ChangeCompileCommandsNotification: NotificationType<FileChangedParams, voi
119119const ChangeSelectedSettingNotification : NotificationType < FolderSelectedSettingParams , void > = new NotificationType < FolderSelectedSettingParams , void > ( 'cpptools/didChangeSelectedSetting' ) ;
120120const IntervalTimerNotification : NotificationType < void , void > = new NotificationType < void , void > ( 'cpptools/onIntervalTimer' ) ;
121121const CustomConfigurationNotification : NotificationType < CustomConfigurationParams , void > = new NotificationType < CustomConfigurationParams , void > ( 'cpptools/didChangeCustomConfiguration' ) ;
122+ const ClearCustomConfigurationsNotification : NotificationType < void , void > = new NotificationType < void , void > ( 'cpptools/clearCustomConfigurations' ) ;
122123
123124// Notifications from the server
124125const ReloadWindowNotification : NotificationType < void , void > = new NotificationType < void , void > ( 'cpptools/reloadWindow' ) ;
@@ -175,6 +176,7 @@ export interface Client {
175176 pauseParsing ( ) : void ;
176177 resumeParsing ( ) : void ;
177178 handleConfigurationSelectCommand ( ) : void ;
179+ handleConfigurationProviderSelectCommand ( ) : void ;
178180 handleShowParsingCommands ( ) : void ;
179181 handleConfigurationEditCommand ( ) : void ;
180182 handleAddToIncludePathCommand ( path : string ) : void ;
@@ -433,7 +435,7 @@ class DefaultClient implements Client {
433435 vscode . window . showInformationMessage ( message , allow , notNow , dontAskAgain ) . then ( result => {
434436 switch ( result ) {
435437 case allow : {
436- this . configuration . addCustomConfigurationProvider ( provider . extensionId ) . then ( ( ) => {
438+ this . configuration . updateCustomConfigurationProvider ( provider . extensionId ) . then ( ( ) => {
437439 telemetry . logLanguageServerEvent ( "customConfigurationProvider" , { "providerId" : provider . extensionId } ) ;
438440 } ) ;
439441 break ;
@@ -451,7 +453,7 @@ class DefaultClient implements Client {
451453 } else if ( selectedProvider === provider . extensionId ) {
452454 telemetry . logLanguageServerEvent ( "customConfigurationProvider" , { "providerId" : provider . extensionId } ) ;
453455 } else if ( selectedProvider === provider . name ) {
454- this . configuration . addCustomConfigurationProvider ( provider . extensionId ) ; // update the configurationProvider in c_cpp_properties.json
456+ this . configuration . updateCustomConfigurationProvider ( provider . extensionId ) ; // v0 -> v1 upgrade. Update the configurationProvider in c_cpp_properties.json
455457 }
456458 } ) ;
457459 }
@@ -1031,6 +1033,10 @@ class DefaultClient implements Client {
10311033 this . notifyWhenReady ( ( ) => this . languageClient . sendNotification ( CustomConfigurationNotification , params ) ) ;
10321034 }
10331035
1036+ private clearCustomConfigurations ( ) : void {
1037+ this . notifyWhenReady ( ( ) => this . languageClient . sendNotification ( ClearCustomConfigurationsNotification ) ) ;
1038+ }
1039+
10341040 /*********************************************
10351041 * command handlers
10361042 *********************************************/
@@ -1046,6 +1052,27 @@ class DefaultClient implements Client {
10461052 } ) ;
10471053 }
10481054
1055+ public handleConfigurationProviderSelectCommand ( ) : void {
1056+ this . notifyWhenReady ( ( ) => {
1057+ ui . showConfigurationProviders ( )
1058+ . then ( extensionId => {
1059+ if ( extensionId === undefined ) {
1060+ // operation was cancelled.
1061+ return ;
1062+ }
1063+ this . configuration . updateCustomConfigurationProvider ( extensionId )
1064+ . then ( ( ) => {
1065+ if ( extensionId ) {
1066+ this . updateCustomConfigurations ( getCustomConfigProviders ( ) . get ( extensionId ) ) ;
1067+ telemetry . logLanguageServerEvent ( "customConfigurationProvider" , { "providerId" : extensionId } ) ;
1068+ } else {
1069+ this . clearCustomConfigurations ( ) ;
1070+ }
1071+ } ) ;
1072+ } ) ;
1073+ } ) ;
1074+ }
1075+
10491076 public handleShowParsingCommands ( ) : void {
10501077 this . notifyWhenReady ( ( ) => {
10511078 ui . showParsingCommands ( )
@@ -1143,6 +1170,7 @@ class NullClient implements Client {
11431170 pauseParsing ( ) : void { }
11441171 resumeParsing ( ) : void { }
11451172 handleConfigurationSelectCommand ( ) : void { }
1173+ handleConfigurationProviderSelectCommand ( ) : void { }
11461174 handleShowParsingCommands ( ) : void { }
11471175 handleConfigurationEditCommand ( ) : void { }
11481176 handleAddToIncludePathCommand ( path : string ) : void { }
0 commit comments