redhat-developer / redhat-developer/vscode-xml

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

Open
#1,156 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
328
Forks
101
Avg merge
1d 17h
Merged PRs (30d)
7

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the files that read xml.fileAssociations and xml.catalogs, then inspect their getConfiguration('xml') calls and the document URI available at each call site. Done when both keys use URI-scoped configuration and multi-root folder overrides are honored without changing workspace or user-level fallback behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.