Skip to main content

collect_default_configurations

Function collect_default_configurations 

Source
pub(super) fn collect_default_configurations(
    application_state: &ApplicationState,
) -> Result<Value, CommonError>
Expand description

Collects default configurations from all installed extensions.

Reads each extension’s contributes.configuration entry and pulls the default value out of every property declaration. Stock VS Code extensions (vscode.git, vscode.npm, gitlens, etc.) declare their settings via the properties map shape:

"contributes": {
  "configuration": {
    "title": "Git",
    "properties": {
      "git.enabled":                 { "type": "boolean", "default": true,  "description": "…" },
      "git.path":                    { "type": ["string","array"], "default": null, "description": "…" },
      "git.autoRepositoryDetection": { "type": ["boolean","string"], "default": true, "description": "…" }
    }
  }
}

The previous implementation searched for a [ {key, value} ] array shape that doesn’t exist in any real VS Code manifest, so EVERY vscode.workspace.getConfiguration(...).get('foo') lookup fell through to undefined. Extensions that use the lookup’s first arg alone (no explicit default) saw undefined and silently bailed - which is the failure mode behind vscode.git activating but never reaching vscode.scm.createSourceControl(...).

contributes.configuration accepts BOTH a single object AND an array of objects (older multi-section schema), so we walk both shapes and recursively dive into properties. The dotted key (git.enabled) is split into a nested map shape so callers using inspect_configuration_value’s path.split('.').try_fold(...) land on the right node.