Skip to content

Commit

Permalink
add machine scope (#2039)
Browse files Browse the repository at this point in the history
* add machine scope

* use a different setting for test and add user setting test

* remove isExecutable and remove powershell.developer.powerShellExePath
  • Loading branch information
TylerLeonhardt authored Jul 17, 2019
1 parent 83970e3 commit ddbf324
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
12 changes: 3 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"publisher": "ms-vscode",
"description": "(Preview) Develop PowerShell scripts in Visual Studio Code!",
"engines": {
"vscode": "^1.31.0"
"vscode": "^1.34.0"
},
"license": "SEE LICENSE IN LICENSE.txt",
"homepage": "https://github.com/PowerShell/vscode-powershell/blob/master/README.md",
Expand Down Expand Up @@ -545,13 +545,13 @@
"powershell.powerShellExePath": {
"type": "string",
"default": "",
"isExecutable": true,
"scope": "machine",
"description": "Specifies the full path to a PowerShell executable. Changes the installation of PowerShell used for language and debugging services."
},
"powershell.powerShellAdditionalExePaths": {
"type": "array",
"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.",
"isExecutable": true,
"scope": "machine",
"uniqueItems": true,
"items": {
"type": "object",
Expand Down Expand Up @@ -751,12 +751,6 @@
"type": "boolean",
"default": false,
"description": "Indicates that the powerShellExePath points to a developer build of Windows PowerShell and configures it for development."
},
"powershell.developer.powerShellExePath": {
"type": "string",
"default": "",
"isExecutable": true,
"description": "Deprecated. Please use the 'powershell.powerShellExePath' setting instead"
}
}
},
Expand Down
17 changes: 13 additions & 4 deletions test/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,20 @@ suite("Settings module", () => {

test("Settings update correctly", async () => {
// then syntax
Settings.change("powerShellExePath", "dummypath1", false).then(() =>
assert.strictEqual(Settings.load().powerShellExePath, "dummypath1"));
Settings.change("helpCompletion", "BlockComment", false).then(() =>
assert.strictEqual(Settings.load().helpCompletion, "BlockComment"));

// async/await syntax
await Settings.change("powerShellExePath", "dummypath2", false);
assert.strictEqual(Settings.load().powerShellExePath, "dummypath2");
await Settings.change("helpCompletion", "LineComment", false);
assert.strictEqual(Settings.load().helpCompletion, "LineComment");
});

test("Settings that can only be user settings update correctly", async () => {
// set to false means it's set as a workspace-level setting so this should throw.
assert.rejects(async () => await Settings.change("powerShellExePath", "dummyPath", false));

// set to true means it's a user-level setting so this should not throw.
await Settings.change("powerShellExePath", "dummyPath", true);
assert.strictEqual(Settings.load().powerShellExePath, "dummyPath");
});
});

0 comments on commit ddbf324

Please sign in to comment.