Skip to content

Commit 98f430e

Browse files
committed
PR feedback
1 parent 9013124 commit 98f430e

File tree

6 files changed

+29
-24
lines changed

6 files changed

+29
-24
lines changed

Extension/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3377,10 +3377,10 @@
33773377
"markdownDescription": "%c_cpp.configuration.copilotHover.markdownDescription%",
33783378
"scope": "window"
33793379
},
3380-
"C_Cpp.persistVSDeveloperEnvironment": {
3380+
"C_Cpp.persistVsDeveloperEnvironment": {
33813381
"type": "boolean",
33823382
"default": true,
3383-
"markdownDescription": "%c_cpp.configuration.persistVSDeveloperEnvironment.markdownDescription%",
3383+
"markdownDescription": "%c_cpp.configuration.persistVsDeveloperEnvironment.markdownDescription%",
33843384
"scope": "window"
33853385
}
33863386
}
@@ -3548,13 +3548,13 @@
35483548
"icon": "$(run)"
35493549
},
35503550
{
3551-
"command": "C_Cpp.SetVSDevEnvironment",
3552-
"title": "%c_cpp.command.SetVSDevEnvironment.title%",
3551+
"command": "C_Cpp.SetVsDeveloperEnvironment",
3552+
"title": "%c_cpp.command.SetVsDeveloperEnvironment.title%",
35533553
"category": "C/C++"
35543554
},
35553555
{
3556-
"command": "C_Cpp.ClearVSDevEnvironment",
3557-
"title": "%c_cpp.command.ClearVSDevEnvironment.title%",
3556+
"command": "C_Cpp.ClearVsDeveloperEnvironment",
3557+
"title": "%c_cpp.command.ClearVsDeveloperEnvironment.title%",
35583558
"category": "C/C++"
35593559
},
35603560
{
@@ -6029,11 +6029,11 @@
60296029
"when": "editorLangId =~ /^(c|(cuda-)?cpp)$/ && config.C_Cpp.debugShortcut && cpptools.buildAndDebug.isSourceFile"
60306030
},
60316031
{
6032-
"command": "C_Cpp.SetVSDevEnvironment",
6032+
"command": "C_Cpp.SetVsDeveloperEnvironment",
60336033
"when": "workspacePlatform == windows"
60346034
},
60356035
{
6036-
"command": "C_Cpp.ClearVSDevEnvironment",
6036+
"command": "C_Cpp.ClearVsDeveloperEnvironment",
60376037
"when": "workspacePlatform == windows"
60386038
},
60396039
{
@@ -6677,4 +6677,4 @@
66776677
"postcss": "^8.4.31",
66786678
"gulp-typescript/**/glob-parent": "^5.1.2"
66796679
}
6680-
}
6680+
}

Extension/package.nls.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
"c_cpp.command.RemoveAllCodeAnalysisProblems.title": "Clear All Code Analysis Problems",
3838
"c_cpp.command.BuildAndDebugFile.title": "Debug C/C++ File",
3939
"c_cpp.command.BuildAndRunFile.title": "Run C/C++ File",
40-
"c_cpp.command.SetVSDevEnvironment.title": "Set Visual Studio Developer Environment",
41-
"c_cpp.command.ClearVSDevEnvironment.title": "Clear Visual Studio Developer Environment",
40+
"c_cpp.command.SetVsDeveloperEnvironment.title": "Set Visual Studio Developer Environment",
41+
"c_cpp.command.ClearVsDeveloperEnvironment.title": "Clear Visual Studio Developer Environment",
4242
"c_cpp.command.AddDebugConfiguration.title": "Add Debug Configuration",
4343
"c_cpp.command.GenerateDoxygenComment.title": "Generate Doxygen Comment",
4444
"c_cpp.command.addSshTarget.title": "Add SSH target",
@@ -845,7 +845,7 @@
845845
]
846846
},
847847
"c_cpp.configuration.debugShortcut.description": "Show the \"Run and Debug\" play button and \"Add Debug Configuration\" gear in the editor title bar for C++ files.",
848-
"c_cpp.configuration.persistVSDeveloperEnvironment.markdownDescription": "Remember the last used Visual Studio developer environment for the current workspace. This setting is only applicable for Windows.",
848+
"c_cpp.configuration.persistVsDeveloperEnvironment.markdownDescription": "Remember the last used Visual Studio developer environment for the current workspace. This setting is only applicable for Windows.",
849849
"c_cpp.debuggers.pipeTransport.description": "When present, this tells the debugger to connect to a remote computer using another executable as a pipe that will relay standard input/output between VS Code and the MI-enabled debugger backend executable (such as gdb).",
850850
"c_cpp.debuggers.pipeTransport.default.pipeProgram": "enter the fully qualified path for the pipe program name, for example '/usr/bin/ssh'.",
851851
"c_cpp.debuggers.pipeTransport.default.debuggerPath": "The full path to the debugger on the target machine, for example /usr/bin/gdb.",
@@ -1034,9 +1034,9 @@
10341034
]
10351035
},
10361036
"c_cpp.walkthrough.command.prompt.description": {
1037-
"message": "When using the Microsoft Visual Studio C++ compiler, the Visual Studio Developer Environment must be present.\n\nFollow the instructions on the right to relaunch or click the button below.\n[Set Developer Environment](command:C_Cpp.SetVSDevEnvironment?%22walkthrough%22)",
1037+
"message": "When using the Microsoft Visual Studio C++ compiler, the Visual Studio Developer Environment must be present.\n\nFollow the instructions on the right to relaunch or click the button below.\n[Set Developer Environment](command:C_Cpp.SetVsDeveloperEnvironment?%22walkthrough%22)",
10381038
"comment": [
1039-
"{Locked=\"Visual Studio\"} {Locked=\"C++\"} {Locked=\"\\\n[\"} {Locked=\"](C_Cpp.SetVSDevEnvironment?%22walkthrough%22)\"}"
1039+
"{Locked=\"Visual Studio\"} {Locked=\"C++\"} {Locked=\"\\\n[\"} {Locked=\"](C_Cpp.SetVsDeveloperEnvironment?%22walkthrough%22)\"}"
10401040
]
10411041
},
10421042
"c_cpp.walkthrough.run.debug.title": "Run and debug your C++ file",

Extension/src/Debugger/configurationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
604604
cancel);
605605
if (response === applyDevEnv) {
606606
try {
607-
await vscode.commands.executeCommand('C_Cpp.SetVSDevEnvironment', 'buildAndDebug');
607+
await vscode.commands.executeCommand('C_Cpp.SetVsDeveloperEnvironment', 'buildAndDebug');
608608
} catch (e: any) {
609609
// Ignore the error, the user will be prompted to apply the environment manually.
610610
}

Extension/src/LanguageServer/extension.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,8 @@ export async function registerCommands(enabled: boolean): Promise<void> {
431431
commandDisposables.push(vscode.commands.registerCommand('C_Cpp.ExtractToMemberFunction', enabled ? () => onExtractToFunction(false, true) : onDisabledCommand));
432432
commandDisposables.push(vscode.commands.registerCommand('C_Cpp.ExpandSelection', enabled ? (r: Range) => onExpandSelection(r) : onDisabledCommand));
433433
commandDisposables.push(vscode.commands.registerCommand('C_Cpp.ShowCopilotHover', enabled ? () => onCopilotHover() : onDisabledCommand));
434-
commandDisposables.push(vscode.commands.registerCommand('C_Cpp.SetVSDevEnvironment', enabled ? onSetVSDevEnvironment : onDisabledCommand));
435-
commandDisposables.push(vscode.commands.registerCommand('C_Cpp.ClearVSDevEnvironment', enabled ? onClearVSDevEnvironment : onDisabledCommand));
434+
commandDisposables.push(vscode.commands.registerCommand('C_Cpp.SetVsDeveloperEnvironment', enabled ? onSetVsDeveloperEnvironment : onDisabledCommand));
435+
commandDisposables.push(vscode.commands.registerCommand('C_Cpp.ClearVsDeveloperEnvironment', enabled ? onClearVsDeveloperEnvironment : onDisabledCommand));
436436
}
437437

438438
function onDisabledCommand() {
@@ -1562,7 +1562,7 @@ async function showCopilotContent(copilotHoverProvider: CopilotHoverProvider, ho
15621562
return true;
15631563
}
15641564

1565-
async function onSetVSDevEnvironment(sender?: any): Promise<void> {
1565+
async function onSetVsDeveloperEnvironment(sender?: any): Promise<void> {
15661566
let success: boolean = true;
15671567
try {
15681568
await setEnvironment(util.extensionContext);
@@ -1579,10 +1579,10 @@ async function onSetVSDevEnvironment(sender?: any): Promise<void> {
15791579
void vscode.window.showErrorMessage(`Failed to apply VS developer environment: ${error.message}`);
15801580
}
15811581
}
1582-
telemetry.logLanguageServerEvent("SetVSDevEnvironment", { "sender": util.getSenderType(sender), "resultcode": success.toString() });
1582+
telemetry.logLanguageServerEvent("SetVsDeveloperEnvironment", { "sender": util.getSenderType(sender), "resultcode": success.toString() });
15831583
}
15841584

1585-
async function onClearVSDevEnvironment(): Promise<void> {
1585+
async function onClearVsDeveloperEnvironment(): Promise<void> {
15861586
util.extensionContext?.environmentVariableCollection.clear();
15871587
await vscode.commands.executeCommand('setContext', 'cpptools.msvcEnvironmentFound', util.hasMsvcEnvironment());
15881588
}

Extension/src/LanguageServer/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ export class CppSettings extends Settings {
549549
&& this.intelliSenseEngine.toLowerCase() === "default" && vscode.workspace.getConfiguration("workbench").get<any>("colorTheme") !== "Default High Contrast";
550550
}
551551
public get sshTargetsView(): string { return this.getAsString("sshTargetsView"); }
552-
public get persistDevEnvironment(): boolean { return this.getAsBoolean("persistVSDeveloperEnvironment"); }
552+
public get persistDevEnvironment(): boolean { return this.getAsBoolean("persistVsDeveloperEnvironment"); }
553553

554554
// Returns the value of a setting as a string with proper type validation and checks for valid enum values while returning an undefined value if necessary.
555555
private getAsStringOrUndefined(settingName: string): string | undefined {

Extension/test/scenarios/SimpleCppProject/tests/devEnvironment.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,23 @@ import { errorOperationCancelled } from '../../../../src/LanguageServer/devcmd';
1212
suite("set developer environment", () => {
1313
if (isWindows) {
1414
test("set developer environment (Windows)", async () => {
15-
const promise = vscode.commands.executeCommand('C_Cpp.SetVSDevEnvironment', 'test');
15+
const promise = vscode.commands.executeCommand('C_Cpp.SetVsDeveloperEnvironment', 'test');
1616
const timer = setInterval(() => {
1717
void vscode.commands.executeCommand('workbench.action.acceptSelectedQuickOpenItem');
1818
}, 1000);
1919
await promise;
2020
clearInterval(timer);
2121
equal(util.hasMsvcEnvironment(), true, "MSVC environment not set correctly.");
2222
});
23+
24+
test("clear developer environment (Windows)", async () => {
25+
await vscode.commands.executeCommand('C_Cpp.ClearVsDeveloperEnvironment');
26+
equal(util.hasMsvcEnvironment(), false, "MSVC environment not cleared correctly.");
27+
});
2328
} else {
24-
test("set developer environment (Linux/macOS)", async () => {
29+
test("should not be able to set developer environment (Linux/macOS)", async () => {
2530
try {
26-
await vscode.commands.executeCommand('C_Cpp.SetVSDevEnvironment', 'test');
31+
await vscode.commands.executeCommand('C_Cpp.SetVsDeveloperEnvironment', 'test');
2732
equal(false, true, "Should not be able to set developer environment on non-Windows platform.");
2833
}
2934
catch (e) {

0 commit comments

Comments
 (0)