Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaa4c864

Browse files
authored
Remove redundant cl.exe instances from build list (microsoft#8517)
1 parent6f39f3b commitaa4c864

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎Extension/src/LanguageServer/cppBuildTaskProvider.ts‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,23 @@ export class CppBuildTaskProvider implements TaskProvider {
117117
}
118118

119119
constisCompilerValid:boolean=userCompilerPath ?awaitutil.checkFileExists(userCompilerPath) :false;
120+
constuserCompilerIsCl:boolean=isCompilerValid&&!!userCompilerPathAndArgs&&userCompilerPathAndArgs.compilerName==="cl.exe";
120121

121122
// Get known compiler paths. Do not include the known compiler path that is the same as user compiler path.
122123
// Filter them based on the file type to get a reduced list appropriate for the active file.
124+
// Only allow one instance of cl.exe to be included, as the user must launch VS Code using a VS command
125+
// prompt in order to build with cl.exe, so only one can apply.
123126
constknownCompilerPathsSet:Set<string>=newSet();
124127
letknownCompilers:configs.KnownCompiler[]|undefined=awaitactiveClient.getKnownCompilers();
125128
if(knownCompilers){
126-
knownCompilers=knownCompilers.filter(info=>
127-
((fileIsCpp&&!info.isC)||(fileIsC&&info.isC))&&
128-
(!isCompilerValid||(userCompilerPathAndArgs&&
129+
constcompiler_condition:(info:configs.KnownCompiler)=>boolean=info=>((fileIsCpp&&!info.isC)||(fileIsC&&info.isC))&&
130+
(!isCompilerValid||(!!userCompilerPathAndArgs&&
129131
(path.basename(info.path)!==userCompilerPathAndArgs.compilerName)))&&
130-
(!isWindows||!info.path.startsWith("/")));// TODO: Add WSL compiler support.
132+
(!isWindows||!info.path.startsWith("/"));// TODO: Add WSL compiler support.
133+
constcl_to_add:configs.KnownCompiler|undefined=userCompilerIsCl ?undefined :knownCompilers.find(info=>
134+
((path.basename(info.path)==="cl.exe")&&compiler_condition(info)));
135+
knownCompilers=knownCompilers.filter(info=>
136+
((info===cl_to_add)||(path.basename(info.path)!=="cl.exe"&&compiler_condition(info))));
131137
knownCompilers.map<void>(info=>{
132138
knownCompilerPathsSet.add(info.path);
133139
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp