File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Extension/src/LanguageServer Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1057,6 +1057,7 @@ export class DefaultClient implements Client {
1057
1057
if ( index === paths . length - 1 ) {
1058
1058
action = "disable" ;
1059
1059
settings . defaultCompilerPath = "" ;
1060
+ await this . configuration . updateCompilerPathIfSet ( settings . defaultCompilerPath ) ;
1060
1061
configurationSelected = true ;
1061
1062
if ( showSecondPrompt ) {
1062
1063
void this . showPrompt ( selectIntelliSenseConfig , true , sender ) ;
@@ -1112,6 +1113,7 @@ export class DefaultClient implements Client {
1112
1113
configurationSelected = true ;
1113
1114
action = "compiler browsed" ;
1114
1115
settings . defaultCompilerPath = result [ 0 ] . fsPath ;
1116
+ await this . configuration . updateCompilerPathIfSet ( settings . defaultCompilerPath ) ;
1115
1117
void vscode . commands . executeCommand ( 'setContext' , 'cpptools.trustedCompilerFound' , true ) ;
1116
1118
} else {
1117
1119
configurationSelected = true ;
@@ -1130,6 +1132,7 @@ export class DefaultClient implements Client {
1130
1132
} else {
1131
1133
action = "select compiler" ;
1132
1134
settings . defaultCompilerPath = util . isCl ( paths [ index ] ) ? "cl.exe" : paths [ index ] ;
1135
+ await this . configuration . updateCompilerPathIfSet ( settings . defaultCompilerPath ) ;
1133
1136
void vscode . commands . executeCommand ( 'setContext' , 'cpptools.trustedCompilerFound' , true ) ;
1134
1137
}
1135
1138
}
Original file line number Diff line number Diff line change @@ -624,6 +624,21 @@ export class CppProperties {
624
624
} , ( ) => { } ) . catch ( logAndReturn . undefined ) ;
625
625
}
626
626
627
+ public async updateCompilerPathIfSet ( path : string ) : Promise < void > {
628
+ return this . handleConfigurationEditJSONCommand ( ( ) => {
629
+ this . parsePropertiesFile ( ) ; // Clear out any modifications we may have made internally.
630
+ const config : Configuration | undefined = this . CurrentConfiguration ;
631
+ // Update compiler path if it's already set.
632
+ if ( config && config . compilerPath !== undefined ) {
633
+ config . compilerPath = path ;
634
+ this . writeToJson ( ) ;
635
+ }
636
+ // Any time parsePropertiesFile is called, configurationJson gets
637
+ // reverted to an unprocessed state and needs to be reprocessed.
638
+ this . handleConfigurationChange ( ) ;
639
+ } , returns . undefined ) ;
640
+ }
641
+
627
642
public async updateCustomConfigurationProvider ( providerId : string ) : Promise < void > {
628
643
if ( ! this . propertiesFile ) {
629
644
const settings : CppSettings = new CppSettings ( this . rootUri ) ;
You can’t perform that action at this time.
0 commit comments