@@ -187,25 +187,6 @@ export class CppProperties {
187
187
this . defaultIncludes = compilerDefaults . includes ;
188
188
this . defaultFrameworks = compilerDefaults . frameworks ;
189
189
190
- // Update the compilerPath, cStandard, and cppStandard with the default being used.
191
- let doUpdate : boolean = false ;
192
- let config : Configuration = this . configurationJson . configurations [ this . CurrentConfiguration ] ;
193
- if ( this . defaultCompilerPath && this . defaultCompilerPath . length > 0 && ( ! config . compilerPath || config . compilerPath . length === 0 ) ) {
194
- config . compilerPath = this . defaultCompilerPath ;
195
- doUpdate = true ;
196
- }
197
- if ( this . defaultCStandard && this . defaultCStandard . length > 0 && ( ! config . cStandard || config . cStandard . length === 0 ) ) {
198
- config . cStandard = this . defaultCStandard ;
199
- doUpdate = true ;
200
- }
201
- if ( this . defaultCppStandard && this . defaultCppStandard . length > 0 && ( ! config . cppStandard || config . cppStandard . length === 0 ) ) {
202
- config . cppStandard = this . defaultCppStandard ;
203
- doUpdate = true ;
204
- }
205
- if ( doUpdate && this . propertiesFile ) {
206
- fs . writeFileSync ( this . propertiesFile . fsPath , JSON . stringify ( this . configurationJson , null , 4 ) ) ;
207
- }
208
-
209
190
// defaultPaths is only used when there isn't a c_cpp_properties.json, but we don't send the configuration changed event
210
191
// to the language server until the default include paths and frameworks have been sent.
211
192
this . handleConfigurationChange ( ) ;
@@ -239,9 +220,7 @@ export class CppProperties {
239
220
if ( process . platform === 'darwin' ) {
240
221
this . configurationJson . configurations [ this . CurrentConfiguration ] . macFrameworkPath = this . defaultFrameworks ;
241
222
}
242
- if ( this . defaultCompilerPath ) {
243
- this . configurationJson . configurations [ this . CurrentConfiguration ] . compilerPath = this . defaultCompilerPath ;
244
- }
223
+ this . configurationJson . configurations [ this . CurrentConfiguration ] . compilerPath = this . defaultCompilerPath ;
245
224
if ( this . defaultCStandard ) {
246
225
this . configurationJson . configurations [ this . CurrentConfiguration ] . cStandard = this . defaultCStandard ;
247
226
}
@@ -482,6 +461,21 @@ export class CppProperties {
482
461
}
483
462
}
484
463
464
+ // Update the compilerPath, cStandard, and cppStandard with the default if they're missing.
465
+ let config : Configuration = this . configurationJson . configurations [ this . CurrentConfiguration ] ;
466
+ if ( ! config . compilerPath ) {
467
+ config . compilerPath = this . defaultCompilerPath ;
468
+ dirty = true ;
469
+ }
470
+ if ( ! config . cStandard ) {
471
+ config . cStandard = this . defaultCStandard ;
472
+ dirty = true ;
473
+ }
474
+ if ( ! config . cppStandard ) {
475
+ config . cppStandard = this . defaultCppStandard ;
476
+ dirty = true ;
477
+ }
478
+
485
479
if ( dirty ) {
486
480
fs . writeFileSync ( this . propertiesFile . fsPath , JSON . stringify ( this . configurationJson , null , 4 ) ) ;
487
481
}
0 commit comments