Prevent writing settings to global scope for environment and package managers#1489
Merged
eleanorjboyd merged 3 commits intomicrosoft:mainfrom Apr 28, 2026
Merged
Prevent writing settings to global scope for environment and package managers#1489eleanorjboyd merged 3 commits intomicrosoft:mainfrom
eleanorjboyd merged 3 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents the extension from persisting environment/package manager defaults into User (global) settings, reducing cross-project interference (addresses issue #1468).
Changes:
- Removed
ConfigurationTarget.Globalwrites fordefaultEnvManageranddefaultPackageManagerin settings helpers. - Updated unit tests to assert no global-scope writes occur for these settings.
- Documented that the extension avoids writing settings to User scope (with a note referencing #1468).
Show a summary per file
| File | Description |
|---|---|
| src/features/settings/settingHelpers.ts | Removes global-scope persistence for default manager settings. |
| src/test/features/settings/settingHelpers.unit.test.ts | Updates tests to ensure default manager settings aren’t written to global scope. |
| docs/managing-python-projects.md | Adds guidance about settings scope behavior and rationale. |
Copilot's findings
Comments suppressed due to low confidence (5)
src/test/features/settings/settingHelpers.unit.test.ts:171
- Same issue as above: this test can miss user/global writes if the boolean form (
true) is used instead ofConfigurationTarget.Global. Consider asserting that there are zero updates fordefaultEnvManagerregardless of the third argument shape.
const envManagerUpdates = updateCalls.filter(
(c) => c.key === 'defaultEnvManager' && c.target === ConfigurationTarget.Global,
);
assert.strictEqual(envManagerUpdates.length, 0, 'Should never write to user/global settings');
});
src/test/features/settings/settingHelpers.unit.test.ts:192
- Same issue as above: restricting the check to
ConfigurationTarget.Globalcan miss global writes using the boolean form. Consider asserting thatdefaultPackageManageris never updated when invoked withproject: undefined, regardless of target representation.
const pkgManagerUpdates = updateCalls.filter(
(c) => c.key === 'defaultPackageManager' && c.target === ConfigurationTarget.Global,
);
assert.strictEqual(pkgManagerUpdates.length, 0, 'Should never write to user/global settings');
});
src/features/settings/settingHelpers.ts:261
- Same as
setAllManagerSettings:editswithprojectunset are filtered out and now become a no-op. To avoid callers accidentally passing “global” edits and thinking they were saved, consider either rejecting/logging those edits or updating the type/docs to remove the “undefined means global” expectation.
}
});
await Promise.all(promises);
}
src/features/settings/settingHelpers.ts:326
- Same concern here:
project: undefinededits are filtered out, so callers trying to persist a global package manager selection will get a silent no-op. Consider surfacing that (trace/log/return) or tightening the type contract so it’s clear only workspace(-folder) scoped edits are supported.
}
});
await Promise.all(promises);
}
src/test/features/settings/settingHelpers.unit.test.ts:150
- Same issue as above: checking only for
ConfigurationTarget.Globalcan miss user/global writes if the boolean form (true) is used for the update target. Track the raw target and assert nodefaultPackageManagerupdate is attempted in any global form.
const pkgManagerUpdates = updateCalls.filter(
(c) => c.key === 'defaultPackageManager' && c.target === ConfigurationTarget.Global,
);
assert.strictEqual(pkgManagerUpdates.length, 0, 'Should never write to user/global settings');
});
- Files reviewed: 3/3 changed files
- Comments generated: 4
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
benvillalobos
approved these changes
Apr 28, 2026
StellaHuang95
pushed a commit
to StellaHuang95/vscode-python-environments
that referenced
this pull request
Apr 30, 2026
…managers (microsoft#1489) prevents microsoft#1468. Now we no longer save env manager or package manage default values to user settings. If a user wants to save these they can but the extension should not as it could very easily cause disruption across a users projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
prevents #1468. Now we no longer save env manager or package manage default values to user settings. If a user wants to save these they can but the extension should not as it could very easily cause disruption across a users projects