Skip to content

xml.fileAssociations and xml.catalogs do not support per-folder override in multi-root workspaces #1156

Description

@chirag127

Problem

In a multi-root workspace with different XML schemas per sub-project, it is not possible to scope xml.fileAssociations or xml.catalogs to individual folders. The extension reads these settings globally (or at workspace level) and applies them to all folders. A *.code-workspace with per-folder settings overrides for these keys is silently ignored.

Example

// myproject.code-workspace
{
  "folders": [
    { "path": "services/api", "name": "API" },
    { "path": "services/config", "name": "Config" }
  ],
  "settings": {
    // Workspace-global fallback
    "xml.fileAssociations": []
  }
}

Setting per-folder overrides like:

// services/api/.vscode/settings.json
{
  "xml.fileAssociations": [
    { "pattern": "**/*.xml", "systemId": "schemas/api-schema.xsd" }
  ]
}

has no effect — the workspace-level (empty) array wins for ALL folders.

Expected Behaviour

The extension should use vscode.workspace.getConfiguration('xml', document.uri) (URI-scoped lookup) so that VS Code's native folder-override resolution applies. This is a two-line change per config key access and is backwards-compatible (falls back to workspace/user settings when no folder override exists).

Proposed Fix

Replace:

const assocs = vscode.workspace.getConfiguration('xml').get('fileAssociations');

with:

const assocs = vscode.workspace.getConfiguration('xml', document.uri).get('fileAssociations');

Environment

  • OS: Windows 11 / macOS (reproducible on both)
  • VS Code: 1.89+ multi-root workspace
  • Extension: redhat.vscode-xml latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions