Repository navigation
Add support for local settings in configuration editing - #269623
Yordis Prieto (yordis) wants to merge 1 commit into
Conversation
c34fbe9 to
4b09188
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for local settings files (settings.local.json) in VS Code's configuration system. Local settings take precedence over workspace and user settings, providing developers with a way to override configurations without affecting shared workspace settings.
Key changes include:
- Added support for
settings.local.jsonfiles in workspace folders - Implemented proper precedence where local settings override workspace and user settings
- Added comprehensive test coverage for local settings functionality
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/services/configuration/common/configuration.ts |
Defines constants for local settings file names and schema identifiers |
src/vs/workbench/services/configuration/browser/configurationService.ts |
Registers JSON schema for local settings validation |
src/vs/workbench/services/configuration/browser/configuration.ts |
Core implementation for loading, parsing, and merging local settings with other configuration sources |
src/vs/workbench/services/configuration/test/browser/configurationService.test.ts |
Comprehensive test suite covering local settings loading, precedence, and file operations |
extensions/configuration-editing/package.json |
Adds JSON schema association for settings.local.json files |
|
|
||
| private consolidate(settingsConfiguration?: ConfigurationModel): void { | ||
| this._cache = (settingsConfiguration ?? this._folderSettingsModelParser.configurationModel).merge(...this._standAloneConfigurations); | ||
| this._cache = (settingsConfiguration ?? this._folderSettingsModelParser.configurationModel).merge(...this._standAloneConfigurations, this._folderLocalSettingsModelParser.configurationModel); |
There was a problem hiding this comment.
The local settings should be merged after standalone configurations to ensure proper precedence. Currently, local settings might be overridden by standalone configurations. Consider moving this._folderLocalSettingsModelParser.configurationModel to be the last parameter in the merge operation.
There was a problem hiding this comment.
The merge order is actually correct. Looking at the ConfigurationModel.merge() implementation and tests (specifically the "recursive merge" test at line 533 in src/vs/platform/configuration/test/common/configurationModels.test.ts), the merge method gives precedence to LATER parameters.
In base.merge(add), the add values override base values.
Since localSettings is the last parameter merged, it has the HIGHEST precedence, which is the desired behavior. Local settings will override both standalone configurations and base settings.
The test confirms this:
const base = new ConfigurationModel({ 'a': { 'b': 1 } }, ...);
const add = new ConfigurationModel({ 'a': { 'b': 2 } }, ...);
const result = base.merge(add);
// result.contents = { 'a': { 'b': 2 } } // add wins!|
|
||
| private consolidate(): void { | ||
| this.configurationModel = this._folderSettingsModelParser.configurationModel.merge(...this._standAloneConfigurations); | ||
| this.configurationModel = this._folderSettingsModelParser.configurationModel.merge(...this._standAloneConfigurations, this._folderLocalSettingsModelParser.configurationModel); |
There was a problem hiding this comment.
Same precedence issue as in the FileServiceBasedConfiguration class. Local settings should be merged last to ensure they have the highest precedence over standalone configurations.
There was a problem hiding this comment.
Same explanation applies here. The merge order is correct because ConfigurationModel.merge() gives precedence to LATER parameters.
In our implementation:
baseModel.merge(...standAloneConfigs, localSettings)The localSettings parameter is merged last, giving it the highest precedence over both base settings and standalone configurations. This is the desired behavior as confirmed by the test suite in src/vs/platform/configuration/test/common/configurationModels.test.ts.
Screen.Recording.2025-10-03.at.1.26.54.PM.mov |
Fixes microsoft#40233 Signed-off-by: Yordis Prieto <[email protected]>
4b09188 to
738a07e
Compare
|
Thanks for the PR. This is a big feature which involves quite number of design and UX decisions and planning. Therefore we would not take contributions for such big features. Thanks for understanding. |
|
Sandeep Somavarapu (@sandy081) Is there a way to help? I guess one of the main things missing here is that it requires some update to the settings UI (+ sync)? This is one of the most requested features. The fact that it is missing leads to numerous clunky workarounds in extensions at the moment. (example: https://github.com/microsoft/vscode-python/wiki/Setting-descriptions) Meanwhile, it would be nice if the VS Code documentation could indicate that sharing
|
Sandeep Somavarapu (@sandy081) why let the perfect be the enemy of the good? This at least goes partway to solving one of the most requested features on the entire repo and would be a huge improvement for a lot of users. Certainly more than whatever has been in the last 10 or so major versions. |
It's not really that big, and it doesn't appear to redesign anything. We don't understand a thing. |
|
👋 Thanks everyone for the feedback and for taking the time to discuss this. I initially closed this PR because it introduces a fairly large feature that touches on several architectural and UX aspects. Changes of this scope typically require coordination across the VS Code team — including design discussions, user experience validation, and alignment with other planned work. That means we need to allocate dedicated time for it in our planning process to ensure it fits well into the overall product direction. That said, I completely understand and appreciate the community’s interest in this feature. I’m reopening this PR so that it remains visible and open for discussion. We’ll revisit it when we have the opportunity to plan this work more thoroughly with the team. Thanks again for your contributions and understanding! |
|
Sandeep Somavarapu (@sandy081) I enjoy the work thus far, and I am willing to take ownership of the situation, and help with the coding aspect. In the worst case, I can communicate whenever I can unable to support the situation. |
|
I don't want to be mad, but...
You want to say you never found a time since working on this(!) problem on releasing not needed multi workspace feature as a "more powerful alternative" to this feature which was intended to close the issue back in 2017/2018?
Just open the original issue and read what people say. Nothing more is needed. Spend 5 min to read everything from your last comment here.
Where the previous opportunity you never reported back leaded the team to? When it will be again? Month? Year? Your post sounds completely like a robot response with no soul and no thrust to your words. And this is annoying asf... I happy that there a response from you and I hope you will find resources and time to finish this properly. Please, please, PLEASE do this in near future. Thank you. |
|
Can't this feature just be merged with an "experimental" feature flag? Then users can enjoy the naive implementation for the following 10 years until the vscode team finishes designing, discussing, aligning and validating. |
|
I love this PR, I always felt that user settings should override workspace settings. At the same time, I see this as a bit of a breaking change since the current design is already broken and if we change it now it could have unexpected consequences for users. If the VSCode team doesn't approve this, could we at least have a new type of settings called "User Override Settings" which is a new JSON file ( |
|
David Gomes (@davidgomes) I can fix the file name if you want me to 🫣 🍒 <----- :doit: |
|
How about a user settings option like this? "workbench.settings.experimentalWorkspaceOverridesPath": "settings.local.json" // relative to .vscodeThen we don't have to bikeshed the name |
|
Peter Jaško (@jaskp) I honestly thought of that as well, the only concern is that we would be all doing whatever, so hard to align, scan for that file and so on without loading the settings to begin with 😄 |
|
A standardised name means it can be gitignored more easily, at least. |
|
Agreed with you guys 😄 |
|
Sandeep Somavarapu (@sandy081) would the team be willing to relax the requirements for merging this feature if it were disabled by default and had a boolean opt-in flag in settings? Or is there nothing the community can do? |
|
Yordis Prieto (@yordis), shall we target Cursor (https://github.com/cursor/cursor) instead? Maybe they're more open to contributions? Sandeep Somavarapu (@sandy081), mind giving another update from your end? Allowing this to be behind an 'experimental' feature flag for the time being would be great! |
koenlek personally speaking, I only use Cursor. So I suggested them to cherry-pick (to fulfill my ego of contributing to Cursor 😄), I can make it work here however we want, dogfoot a bit. But I can not do much, other than suggesting to them. |
Great. Could you refer me to the issue on Cursor? I'll plus 1 it :) |
|
With more and more tools taking the "ignored I think there's a few considerations here, particularly relating to the UX of such a feature. I'm going to list a few questions I can think of, not because they all need answers, but to point out that nothing is simple and this is typically why product teams say "not right now". Bike-shedding over naming is just one part of a larger discussion.
P.S. Yordis Prieto (@yordis), I love you for this. Good to see you outside of wasmcloud! |
|
Lachlan Heywood (@lachieh) Some thoughts about your points
|
Fixes #40233