diff --git a/Extension/src/LanguageServer/cppBuildTaskProvider.ts b/Extension/src/LanguageServer/cppBuildTaskProvider.ts index 992c6e4d6b..de8a86b04c 100644 --- a/Extension/src/LanguageServer/cppBuildTaskProvider.ts +++ b/Extension/src/LanguageServer/cppBuildTaskProvider.ts @@ -148,15 +148,18 @@ export class CppBuildTaskProvider implements TaskProvider { } // Create a build task per compiler path - let result: CppBuildTask[] = []; - // Tasks for known compiler paths - if (knownCompilerPaths) { - result = knownCompilerPaths.map(compilerPath => this.getTask(compilerPath, appendSourceToName, undefined)); - } + const result: CppBuildTask[] = []; + // Task for valid user compiler path setting if (isCompilerValid && userCompilerPath) { result.push(this.getTask(userCompilerPath, appendSourceToName, userCompilerPathAndArgs?.allCompilerArgs)); } + + // Tasks for known compiler paths + if (knownCompilerPaths) { + result.push(...knownCompilerPaths.map(compilerPath => this.getTask(compilerPath, appendSourceToName, undefined))); + } + return result; }