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

Commit2715319

Browse files
authored
Compiler acquisition (microsoft#11286)
1 parent2cc55ea commit2715319

File tree

11 files changed

+348
-90
lines changed

11 files changed

+348
-90
lines changed

‎Extension/package.json‎

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,29 @@
8888
"id":"awaiting.activation.windows",
8989
"title":"%c_cpp.walkthrough.set.up.title%",
9090
"description":"%c_cpp.walkthrough.activating.description%",
91-
"when":"workspacePlatform == windows && cpptools.scanForCompilersDone == false",
91+
"when":"workspacePlatform == windows && cpptools.scanForCompilersDone == false && cpptools.windowsVersion != 10 && cpptools.windowsVersion != 11",
9292
"media": {
9393
"markdown":"dist/walkthrough/installcompiler/install-compiler-windows.md"
9494
}
9595
},
96+
{
97+
"id":"awaiting.activation.windows10",
98+
"title":"%c_cpp.walkthrough.set.up.title%",
99+
"description":"%c_cpp.walkthrough.activating.description%",
100+
"when":"workspacePlatform == windows && cpptools.scanForCompilersDone == false && cpptools.windowsVersion == 10",
101+
"media": {
102+
"markdown":"dist/walkthrough/installcompiler/install-compiler-windows10.md"
103+
}
104+
},
105+
{
106+
"id":"awaiting.activation.windows11",
107+
"title":"%c_cpp.walkthrough.set.up.title%",
108+
"description":"%c_cpp.walkthrough.activating.description%",
109+
"when":"workspacePlatform == windows && cpptools.scanForCompilersDone == false && cpptools.windowsVersion == 11",
110+
"media": {
111+
"markdown":"dist/walkthrough/installcompiler/install-compiler-windows11.md"
112+
}
113+
},
96114
{
97115
"id":"no.compilers.found.mac",
98116
"title":"%c_cpp.walkthrough.set.up.title%",
@@ -114,12 +132,30 @@
114132
{
115133
"id":"no.compilers.found.windows",
116134
"title":"%c_cpp.walkthrough.set.up.title%",
117-
"description":"%c_cpp.walkthrough.no.compilers.description%",
118-
"when":"workspacePlatform == windows && cpptools.scanForCompilersDone == true && cpptools.scanForCompilersEmpty == true",
135+
"description":"%c_cpp.walkthrough.no.compilers.windows.description%",
136+
"when":"workspacePlatform == windows && cpptools.scanForCompilersDone == true && cpptools.scanForCompilersEmpty == true && cpptools.windowsVersion != 10 && cpptools.windowsVersion != 11",
119137
"media": {
120138
"markdown":"dist/walkthrough/installcompiler/install-compiler-windows.md"
121139
}
122140
},
141+
{
142+
"id":"no.compilers.found.windows10",
143+
"title":"%c_cpp.walkthrough.set.up.title%",
144+
"description":"%c_cpp.walkthrough.no.compilers.windows.description%",
145+
"when":"workspacePlatform == windows && cpptools.scanForCompilersDone == true && cpptools.scanForCompilersEmpty == true && cpptools.windowsVersion == 10",
146+
"media": {
147+
"markdown":"dist/walkthrough/installcompiler/install-compiler-windows10.md"
148+
}
149+
},
150+
{
151+
"id":"no.compilers.found.windows11",
152+
"title":"%c_cpp.walkthrough.set.up.title%",
153+
"description":"%c_cpp.walkthrough.no.compilers.windows.description%",
154+
"when":"workspacePlatform == windows && cpptools.scanForCompilersDone == true && cpptools.scanForCompilersEmpty == true && cpptools.windowsVersion == 11",
155+
"media": {
156+
"markdown":"dist/walkthrough/installcompiler/install-compiler-windows11.md"
157+
}
158+
},
123159
{
124160
"id":"verify.compiler.mac",
125161
"title":"%c_cpp.walkthrough.set.up.title%",
@@ -148,14 +184,38 @@
148184
"id":"verify.compiler.windows",
149185
"title":"%c_cpp.walkthrough.set.up.title%",
150186
"description":"%c_cpp.walkthrough.compilers.found.description%",
151-
"when":"workspacePlatform == windows && cpptools.scanForCompilersDone == true && cpptools.scanForCompilersEmpty == false",
187+
"when":"workspacePlatform == windows && cpptools.scanForCompilersDone == true && cpptools.scanForCompilersEmpty == false && cpptools.windowsVersion != 10 && cpptools.windowsVersion != 11",
152188
"media": {
153189
"markdown":"dist/walkthrough/installcompiler/install-compiler-windows.md"
154190
},
155191
"completionEvents": [
156192
"onContext:cpptools.trustedCompilerFound"
157193
]
158194
},
195+
{
196+
"id":"verify.compiler.windows10",
197+
"title":"%c_cpp.walkthrough.set.up.title%",
198+
"description":"%c_cpp.walkthrough.compilers.found.description%",
199+
"when":"workspacePlatform == windows && cpptools.scanForCompilersDone == true && cpptools.scanForCompilersEmpty == false && cpptools.windowsVersion == 10",
200+
"media": {
201+
"markdown":"dist/walkthrough/installcompiler/install-compiler-windows10.md"
202+
},
203+
"completionEvents": [
204+
"onContext:cpptools.trustedCompilerFound"
205+
]
206+
},
207+
{
208+
"id":"verify.compiler.windows11",
209+
"title":"%c_cpp.walkthrough.set.up.title%",
210+
"description":"%c_cpp.walkthrough.compilers.found.description%",
211+
"when":"workspacePlatform == windows && cpptools.scanForCompilersDone == true && cpptools.scanForCompilersEmpty == false && cpptools.windowsVersion == 11",
212+
"media": {
213+
"markdown":"dist/walkthrough/installcompiler/install-compiler-windows11.md"
214+
},
215+
"completionEvents": [
216+
"onContext:cpptools.trustedCompilerFound"
217+
]
218+
},
159219
{
160220
"id":"create.cpp.file",
161221
"title":"%c_cpp.walkthrough.create.cpp.file.title%",
@@ -3025,6 +3085,11 @@
30253085
"title":"%c_cpp.command.selectIntelliSenseConfiguration.title%",
30263086
"category":"C/C++"
30273087
},
3088+
{
3089+
"command":"C_Cpp.InstallCompiler",
3090+
"title":"%c_cpp.command.installCompiler.title%",
3091+
"category":"C/C++"
3092+
},
30283093
{
30293094
"command":"C_Cpp.RescanCompilers",
30303095
"title":"%c_cpp.command.rescanCompilers.title%",
@@ -5646,6 +5711,10 @@
56465711
"command":"C_Cpp.SelectDefaultCompiler",
56475712
"when":"never"
56485713
},
5714+
{
5715+
"command":"C_Cpp.InstallCompiler",
5716+
"when":"never"
5717+
},
56495718
{
56505719
"command":"C_Cpp.RescanCompilers",
56515720
"when":"never"

‎Extension/package.nls.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"c_cpp.command.configurationEditUI.title":"Edit Configurations (UI)",
1414
"c_cpp.command.selectDefaultCompiler.title":"Select Default Compiler...",
1515
"c_cpp.command.selectIntelliSenseConfiguration.title":"Select IntelliSense Configuration...",
16+
"c_cpp.command.installCompiler.title":"Install a C++ Compiler",
1617
"c_cpp.command.rescanCompilers.title":"Rescan for Compilers",
1718
"c_cpp.command.switchHeaderSource.title":"Switch Header/Source",
1819
"c_cpp.command.enableErrorSquiggles.title":"Enable Error Squiggles",
@@ -976,7 +977,8 @@
976977
"c_cpp.walkthrough.description":"Dive into VS Code's rich C++ development experience.",
977978
"c_cpp.walkthrough.set.up.title":"Set up your C++ Environment",
978979
"c_cpp.walkthrough.activating.description":"Activating the C++ extension to determine whether your C++ Environment has been set up.\nActivating Extension...",
979-
"c_cpp.walkthrough.no.compilers.description":"We could not find a C++ compiler on your machine, which is required to use the C++ extension. Follow the instructions on the right to install one, then click “Find my new Compiler” below.\n[Find my new Compiler](command:C_Cpp.RescanCompilers?%7B%22sender%22%3A%22walkthrough%22%7D)",
980+
"c_cpp.walkthrough.no.compilers.windows.description":"We could not find a C++ compiler on your machine, which is required to use the C++ extension. Follow the instructions on the right to install one, then click “Find my new Compiler” below.\n[Find my new Compiler](command:C_Cpp.RescanCompilers?%7B%22sender%22%3A%22walkthrough%22%7D)",
981+
"c_cpp.walkthrough.no.compilers.description":"We could not find a C++ compiler on your machine, which is required to use the C++ extension. Either select “Install a C++ Compiler” to have a compiler installed for you or follow the instructions on the right to install one, then click “Find my new Compiler” below.\n[Install a C++ Compiler](command:C_Cpp.InstallCompiler?%7B%22sender%22%3A%22walkthrough%22%7D)\n[Find my new Compiler](command:C_Cpp.RescanCompilers?%7B%22sender%22%3A%22walkthrough%22%7D)",
980982
"c_cpp.walkthrough.compilers.found.description":"The C++ extension works with a C++ compiler. Select one from those already on your machine by clicking the button below.\n[Select my Default Compiler](command:C_Cpp.SelectDefaultCompiler?%7B%22sender%22%3A%22walkthrough%22%7D)",
981983
"c_cpp.walkthrough.compilers.found.altText":"Image showing the select a default compiler quickpick and the list of compilers found on the users machine, one of which is selected.",
982984
"c_cpp.walkthrough.create.cpp.file.title":"Create a C++ file",

‎Extension/src/LanguageServer/client.ts‎

Lines changed: 25 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ import { ManualSignal } from '../Utility/Async/manualSignal';
3737
import{logAndReturn,returns}from'../Utility/Async/returns';
3838
import{is}from'../Utility/System/guards';
3939
import*asutilfrom'../common';
40+
import{isWindows}from'../constants';
4041
import{DebugProtocolParams,Logger,ShowWarningParams,getDiagnosticsChannel,getOutputChannelLogger,logDebugProtocol,logLocalized,showWarning}from'../logger';
4142
import{localizedStringCount,lookupString}from'../nativeStrings';
43+
import{SessionState}from'../sessionState';
4244
import*astelemetryfrom'../telemetry';
4345
import{TestHook,getTestHook}from'../testHook';
4446
import{
@@ -97,7 +99,6 @@ interface ConfigStateReceived {
9799

98100
letdisplayedSelectCompiler:boolean=false;
99101
letsecondPromptCounter:number=0;
100-
letscanForCompilersDone:boolean=false;
101102
letworkspaceHash:string="";
102103

103104
letworkspaceDisposables:vscode.Disposable[]=[];
@@ -1035,7 +1036,14 @@ export class DefaultClient implements Client {
10351036
constcompilersIndex:number=paths.length;
10361037
constcompilerCount:number=compilersIndex===compileCommandsIndex ?0 :compilersIndex-compileCommandsIndex-1;
10371038
paths.push(localize("selectAnotherCompiler.string","Select another compiler on my machine..."));
1038-
paths.push(localize("installCompiler.string","Help me install a compiler"));
1039+
letinstallShown=true;
1040+
if(isWindows&&util.getSenderType(sender)!=='walkthrough'){
1041+
paths.push(localize("installCompiler.string","Help me install a compiler"));
1042+
}elseif(!isWindows){
1043+
paths.push(localize("installCompiler.string.nix","Install a compiler"));
1044+
}else{
1045+
installShown=false;
1046+
}
10391047
paths.push(localize("noConfig.string","Do not configure with a compiler (not recommended)"));
10401048
constindex:number=awaitthis.showSelectIntelliSenseConfiguration(paths,compilersOnly);
10411049
letaction:string="";
@@ -1059,44 +1067,13 @@ export class DefaultClient implements Client {
10591067
}
10601068
returnui.ShowConfigureIntelliSenseButton(false,this,ConfigurationType.CompilerPath,"disablePrompt");
10611069
}
1062-
if(index===paths.length-2){
1063-
action="help";
1064-
// Because we need to conditionally enable/disable steps to alter their contents,
1065-
// we need to determine which step is actually visible. If the steps change, this
1066-
// logic will need to change to reflect them.
1067-
letstep:string="ms-vscode.cpptools#";
1068-
if(!scanForCompilersDone){
1069-
step=step+"awaiting.activation.";
1070-
}elseif(compilerDefaults?.knownCompilers===undefined||!compilerDefaults.knownCompilers.length){
1071-
step=step+"no.compilers.found.";
1072-
}else{
1073-
step=step+"verify.compiler.";
1074-
}
1075-
switch(os.platform()){
1076-
case'win32':
1077-
step=step+"windows";
1078-
break;
1079-
case'darwin':
1080-
step=step+"mac";
1081-
break;
1082-
default:// Linux
1083-
step=step+"linux";
1084-
break;
1085-
}
1086-
voidvscode.commands.executeCommand(
1087-
"workbench.action.openWalkthrough",
1088-
{category:'ms-vscode.cpptools#cppWelcome', step},
1089-
false)
1090-
// Run it twice for now because of VS Code bug #187958
1091-
.then(()=>vscode.commands.executeCommand(
1092-
"workbench.action.openWalkthrough",
1093-
{category:'ms-vscode.cpptools#cppWelcome', step},
1094-
false)
1095-
);
1070+
if(installShown&&index===paths.length-2){
1071+
action="install";
1072+
voidvscode.commands.executeCommand('C_Cpp.InstallCompiler',sender);
10961073
return;
10971074
}
10981075
constshowButtonSender:string="quickPick";
1099-
if(index===paths.length-3){
1076+
if(index===paths.length-3||(!installShown&&index===paths.length-2)){
11001077
constresult:vscode.Uri[]|undefined=awaitvscode.window.showOpenDialog();
11011078
if(result===undefined||result.length===0){
11021079
action="browse dismissed";
@@ -1109,7 +1086,7 @@ export class DefaultClient implements Client {
11091086
action="compiler browsed";
11101087
settings.defaultCompilerPath=result[0].fsPath;
11111088
awaitthis.configuration.updateCompilerPathIfSet(settings.defaultCompilerPath);
1112-
voidvscode.commands.executeCommand('setContext','cpptools.trustedCompilerFound',true);
1089+
voidSessionState.trustedCompilerFound.set(true);
11131090
}else{
11141091
configurationSelected=true;
11151092
if(index<configProvidersIndex&&configProviders){
@@ -1128,7 +1105,7 @@ export class DefaultClient implements Client {
11281105
action="select compiler";
11291106
settings.defaultCompilerPath=util.isCl(paths[index]) ?"cl.exe" :paths[index];
11301107
awaitthis.configuration.updateCompilerPathIfSet(settings.defaultCompilerPath);
1131-
voidvscode.commands.executeCommand('setContext','cpptools.trustedCompilerFound',true);
1108+
voidSessionState.trustedCompilerFound.set(true);
11321109
}
11331110
}
11341111

@@ -1784,10 +1761,10 @@ export class DefaultClient implements Client {
17841761
if(document.uri.scheme==="file"){
17851762
consturi:string=document.uri.toString();
17861763
openFileVersions.set(uri,document.version);
1787-
voidvscode.commands.executeCommand('setContext','cpptools.buildAndDebug.isSourceFile',util.isCppOrCFile(document.uri));
1788-
voidvscode.commands.executeCommand('setContext','cpptools.buildAndDebug.isFolderOpen',util.isFolderOpen(document.uri));
1764+
voidSessionState.buildAndDebugIsSourceFile.set(util.isCppOrCFile(document.uri));
1765+
voidSessionState.buildAndDebugIsFolderOpen.set(util.isFolderOpen(document.uri));
17891766
}else{
1790-
voidvscode.commands.executeCommand('setContext','cpptools.buildAndDebug.isSourceFile',false);
1767+
voidSessionState.buildAndDebugIsSourceFile.set(false);
17911768
}
17921769
}
17931770

@@ -2841,18 +2818,17 @@ export class DefaultClient implements Client {
28412818
newTrustedCompilerPath:newCompilerPath??""
28422819
};
28432820
constresults:configs.CompilerDefaults=awaitthis.languageClient.sendRequest(QueryCompilerDefaultsRequest,params);
2844-
scanForCompilersDone=true;
2845-
voidvscode.commands.executeCommand('setContext','cpptools.scanForCompilersDone',true);
2846-
voidvscode.commands.executeCommand('setContext','cpptools.scanForCompilersEmpty',results.knownCompilers===undefined||!results.knownCompilers.length);
2847-
voidvscode.commands.executeCommand('setContext','cpptools.trustedCompilerFound',results.trustedCompilerFound);
2821+
voidSessionState.scanForCompilersDone.set(true);
2822+
voidSessionState.scanForCompilersEmpty.set(results.knownCompilers===undefined||!results.knownCompilers.length);
2823+
voidSessionState.trustedCompilerFound.set(results.trustedCompilerFound);
28482824
returnresults;
28492825
}
28502826

28512827
privateupdateActiveDocumentTextOptions():void{
28522828
consteditor:vscode.TextEditor|undefined=vscode.window.activeTextEditor;
28532829
if(editor&&util.isCpp(editor.document)){
2854-
voidvscode.commands.executeCommand('setContext','cpptools.buildAndDebug.isSourceFile',util.isCppOrCFile(editor.document.uri));
2855-
voidvscode.commands.executeCommand('setContext','cpptools.buildAndDebug.isFolderOpen',util.isFolderOpen(editor.document.uri));
2830+
voidSessionState.buildAndDebugIsSourceFile.set(util.isCppOrCFile(editor.document.uri));
2831+
voidSessionState.buildAndDebugIsFolderOpen.set(util.isFolderOpen(editor.document.uri));
28562832
// If using vcFormat, check for a ".editorconfig" file, and apply those text options to the active document.
28572833
constsettings:CppSettings=newCppSettings(this.RootUri);
28582834
if(settings.useVcFormat(editor.document)){
@@ -2874,7 +2850,7 @@ export class DefaultClient implements Client {
28742850
}
28752851
}
28762852
}else{
2877-
voidvscode.commands.executeCommand('setContext','cpptools.buildAndDebug.isSourceFile',false).then(undefined,logAndReturn.undefined);
2853+
voidSessionState.buildAndDebugIsSourceFile.set(false);
28782854
}
28792855
}
28802856

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp