spec icon indicating copy to clipboard operation
spec copied to clipboard

Different behavior using legacy options

Open klezm opened this issue 2 years ago • 2 comments

Problem

Using the deprecated properties settings and extensions will overwrite/reset all other user settings and not install any other extensions than defined in the property extensions. Using the properties inside the customizations property will only change the defined settings and install the defined extensions additionally to the user extensions.

Deprecated properties (legacy mode):

"settings": {},
"extensions": ["ms-python.python"]

Current usage of these properties:

"customizations": {
	"vscode": {
		"settings": {},
		"extensions": ["ms-python.python"]
	}
}

The customizations property was discussed in #1.

Proposal

It should be possible to reset any user settings/extensions in customizationsvscodesettings / extensions. Maybe add a property reset:

"customizations": {
	"vscode": {
		"reset": {
			"settings": true,
			"extensions": true,
		}
	}
}

klezm avatar Aug 21 '23 11:08 klezm

Hi 👋

Thanks for opening the issue.

Using the deprecated properties settings and extensions will overwrite/reset all other user settings

@klezm When you say user-settings, are these the one which gets added by the Features?

If that's the case, then I think it seems like a change in behavior is a result of https://containers.dev/implementors/spec/#merge-logic ; where the devcontainers/cli merges the customization property from devcontainer.json and devcontainer-feature.json. The merge logic might not be added to the deprecated extensions & settings property.

If you are looking to turn off all the customizations property, you could use the experimental --skip-persisting-customizations-from-features flag for the devcontainer build command. It omits all the Feature specified customizations ie. if your devcontainer.json referred to a set of Features, then their corresponding customizations (which includes extensions) will not be applied to your dev container.

We also have a similar issue open for opting out of extensions, see https://github.com/devcontainers/features/issues/386

samruddhikhandale avatar Aug 21 '23 23:08 samruddhikhandale

The issue is independent from the features. My guess is that setting extensions but not customizationsvscodeextensions will leave the latter to be [] therefore omitting locally installed vscode extensions. But If you set customizationsvscodeextensions to e.g. ["ms-python.python"] the merge logic of vscode will add that extensions to the locally installed ones.

klezm avatar Aug 22 '23 06:08 klezm