Skip to content

xml.catalogs entries with Windows backslash paths are silently ignored #1155

Description

@chirag127

Problem

The xml.catalogs setting accepts an array of file paths to XML catalog files. On Windows, if those paths use backslashes (as vscode.Uri.fsPath produces), the XML Language Server silently fails to load the catalog and falls back to no-validation mode. No error or warning is shown in the Output channel or as a squiggly.

Steps to Reproduce

  1. Place a catalog file at C:\Users\chirag\project\schemas\catalog.xml.
  2. Add to VS Code settings (settings.json, workspace scope):
    "xml.catalogs": ["C:\Users\chirag\project\schemas\catalog.xml"]
  3. Open an XML file that references a schema resolved via that catalog.
  4. No schema validation occurs; hovering over the root element shows no type info.
  5. Workaround: manually replacing backslashes with forward slashes in the setting value fixes the issue:
    "xml.catalogs": ["C:/Users/chirag/project/schemas/catalog.xml"]

Root Cause

The XML Language Server (LemMinX) receives the raw string from the VS Code setting and passes it directly to the Java URI constructor or File constructor. On Windows, new URI("C:\path") is not valid; it must be new URI("file:///C:/path") or at minimum use forward slashes.

Expected Behaviour

The extension should normalise catalog paths before sending them to the language server:

const normalised = vscode.Uri.file(rawPath).toString(); // file:///C:/Users/...

Or the language server should accept and convert Windows-style paths.

Why This Matters

Windows users who configure xml.catalogs via the VS Code settings UI or who paste paths from Windows Explorer will naturally use backslashes. The silent failure is very confusing.

Environment

  • OS: Windows 11 Enterprise 10.0.26200
  • VS Code: 1.89+
  • Extension: redhat.vscode-xml latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions