Skip to content

Commit f978719

Browse files
authored
Merge pull request #3113 from Microsoft/bobbrow/cc
#3102 - fix compilerPath/compileCommands policy
2 parents af516b9 + 2713e70 commit f978719

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Extension/src/LanguageServer/configurations.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,10 @@ export class CppProperties {
242242
if (isUnset(settings.defaultWindowsSdkVersion) && this.defaultWindowsSdkVersion && process.platform === 'win32') {
243243
configuration.windowsSdkVersion = this.defaultWindowsSdkVersion;
244244
}
245-
if (isUnset(settings.defaultCompilerPath) && this.defaultCompilerPath) {
245+
if (isUnset(settings.defaultCompilerPath) && this.defaultCompilerPath &&
246+
isUnset(settings.defaultCompileCommands) && !configuration.compileCommands) {
247+
// compile_commands.json already specifies a compiler. compilerPath overrides the compile_commands.json compiler so
248+
// don't set a default when compileCommands is in use.
246249
configuration.compilerPath = this.defaultCompilerPath;
247250
}
248251
if (isUnset(settings.defaultCStandard) && this.defaultCStandard) {

0 commit comments

Comments
 (0)