Skip to content

Commit ff5d363

Browse files
authored
Don't set the compilerPath if the default is empty. (#1741)
* Don't set the compilerPath if the default is empty or compile commands is set. * Guard against empty std.
1 parent e0bb796 commit ff5d363

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Extension/src/LanguageServer/configurations.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ export class CppProperties {
220220
if (process.platform === 'darwin') {
221221
this.configurationJson.configurations[this.CurrentConfiguration].macFrameworkPath = this.defaultFrameworks;
222222
}
223-
this.configurationJson.configurations[this.CurrentConfiguration].compilerPath = this.defaultCompilerPath;
223+
if (this.defaultCompilerPath) {
224+
this.configurationJson.configurations[this.CurrentConfiguration].compilerPath = this.defaultCompilerPath;
225+
}
224226
if (this.defaultCStandard) {
225227
this.configurationJson.configurations[this.CurrentConfiguration].cStandard = this.defaultCStandard;
226228
}
@@ -475,15 +477,16 @@ export class CppProperties {
475477

476478
// Update the compilerPath, cStandard, and cppStandard with the default if they're missing.
477479
let config: Configuration = this.configurationJson.configurations[this.CurrentConfiguration];
478-
if (config.compilerPath === undefined) {
480+
// Don't set the default if compileCommands exist, until it is fixed to have the correct value.
481+
if (config.compilerPath === undefined && this.defaultCompilerPath && !config.compileCommands) {
479482
config.compilerPath = this.defaultCompilerPath;
480483
dirty = true;
481484
}
482-
if (!config.cStandard) {
485+
if (!config.cStandard && this.defaultCStandard) {
483486
config.cStandard = this.defaultCStandard;
484487
dirty = true;
485488
}
486-
if (!config.cppStandard) {
489+
if (!config.cppStandard && this.defaultCppStandard) {
487490
config.cppStandard = this.defaultCppStandard;
488491
dirty = true;
489492
}

0 commit comments

Comments
 (0)