Skip to content

configurationDefaults should overwrite values, not entire nested objects. #201603

Description

@vanowm

Does this issue occur when all extensions are disabled?: No

When extension specifies configurationDefaults in package.json its content simply overrides existing data. This means if it contains nested objects, it takes the root of the object and copies it, instead overwriting values for each property of the object (aka merging)
This creates an issue when two extensions have the same root object, but different children. For example package.json of extension one

{
  "contributes": {
    "configurationDefaults": {
      "editor.tokenColorCustomizations": {
        "textMateRules": [
          {
            "scope": "my-extension-one",
            "settings": {
              "foreground": "green"
            }
          }
        ]
      }
    }
  }
}

and extension two:

{
  "contributes": {
    "configurationDefaults": {
      "editor.tokenColorCustomizations": {
        "[*Dark*]": {
          "textMateRules": [
            {
              "scope": "my-extension-two",
              "settings": {
                "foreground": "red"
              }
            }
          ]
        }
      }
    }
  }
}

VSCode will take the whole editor.tokenColorCustomizations object and overwrite it. Instead of merging them with another.
So in my tests one extension will override another and there is seems to be no telling which one will dominate when, sometimes it's one, another time is the other.

Also, if user config has the same multi-level-object setting, then it will override enterally the default config of the extension, instead of just the matching properties.

Metadata

Metadata

Labels

configVS Code configuration, settingsfeature-requestRequest for new features or functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions