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
- Place a catalog file at
C:\Users\chirag\project\schemas\catalog.xml.
- Add to VS Code settings (settings.json, workspace scope):
"xml.catalogs": ["C:\Users\chirag\project\schemas\catalog.xml"]
- Open an XML file that references a schema resolved via that catalog.
- No schema validation occurs; hovering over the root element shows no type info.
- 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
Problem
The
xml.catalogssetting accepts an array of file paths to XML catalog files. On Windows, if those paths use backslashes (asvscode.Uri.fsPathproduces), 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
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
URIconstructor orFileconstructor. On Windows,new URI("C:\path")is not valid; it must benew 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:
Or the language server should accept and convert Windows-style paths.
Why This Matters
Windows users who configure
xml.catalogsvia the VS Code settings UI or who paste paths from Windows Explorer will naturally use backslashes. The silent failure is very confusing.Environment