Skip to content

Commit 21645ff

Browse files
TylerLeonhardtrjmholt
authored andcommitted
add machine scope (PowerShell#2039)
* add machine scope * use a different setting for test and add user setting test * remove isExecutable and remove powershell.developer.powerShellExePath
1 parent db8e7d1 commit 21645ff

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

package.json

+3-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"publisher": "ms-vscode",
77
"description": "Develop PowerShell scripts in Visual Studio Code!",
88
"engines": {
9-
"vscode": "^1.31.0"
9+
"vscode": "^1.34.0"
1010
},
1111
"license": "SEE LICENSE IN LICENSE.txt",
1212
"homepage": "https://github.com/PowerShell/vscode-powershell/blob/master/README.md",
@@ -545,13 +545,13 @@
545545
"powershell.powerShellExePath": {
546546
"type": "string",
547547
"default": "",
548-
"isExecutable": true,
548+
"scope": "machine",
549549
"description": "Specifies the full path to a PowerShell executable. Changes the installation of PowerShell used for language and debugging services."
550550
},
551551
"powershell.powerShellAdditionalExePaths": {
552552
"type": "array",
553553
"description": "Specifies an array of versionName / exePath pairs where exePath points to a non-standard install location for PowerShell and versionName can be used to reference this path with the powershell.powerShellDefaultVersion setting.",
554-
"isExecutable": true,
554+
"scope": "machine",
555555
"uniqueItems": true,
556556
"items": {
557557
"type": "object",
@@ -751,12 +751,6 @@
751751
"type": "boolean",
752752
"default": false,
753753
"description": "Indicates that the powerShellExePath points to a developer build of Windows PowerShell and configures it for development."
754-
},
755-
"powershell.developer.powerShellExePath": {
756-
"type": "string",
757-
"default": "",
758-
"isExecutable": true,
759-
"description": "Deprecated. Please use the 'powershell.powerShellExePath' setting instead"
760754
}
761755
}
762756
},

test/settings.test.ts

+13-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,20 @@ suite("Settings module", () => {
1212

1313
test("Settings update correctly", async () => {
1414
// then syntax
15-
Settings.change("powerShellExePath", "dummypath1", false).then(() =>
16-
assert.strictEqual(Settings.load().powerShellExePath, "dummypath1"));
15+
Settings.change("helpCompletion", "BlockComment", false).then(() =>
16+
assert.strictEqual(Settings.load().helpCompletion, "BlockComment"));
1717

1818
// async/await syntax
19-
await Settings.change("powerShellExePath", "dummypath2", false);
20-
assert.strictEqual(Settings.load().powerShellExePath, "dummypath2");
19+
await Settings.change("helpCompletion", "LineComment", false);
20+
assert.strictEqual(Settings.load().helpCompletion, "LineComment");
21+
});
22+
23+
test("Settings that can only be user settings update correctly", async () => {
24+
// set to false means it's set as a workspace-level setting so this should throw.
25+
assert.rejects(async () => await Settings.change("powerShellExePath", "dummyPath", false));
26+
27+
// set to true means it's a user-level setting so this should not throw.
28+
await Settings.change("powerShellExePath", "dummyPath", true);
29+
assert.strictEqual(Settings.load().powerShellExePath, "dummyPath");
2130
});
2231
});

0 commit comments

Comments
 (0)