Skip to content

Allow support for variable and different file path notations in xml.FileAssociations #307

@marsfan

Description

@marsfan

A number of things that are normally supported by configuration options in VS code JSON files do not seem to work when configuring xml.FileAssociations.
Namely:

  • Variable Substitution
  • Windows-Style file paths.

As an example, I have a test repository that has a schema in one folder, and an XML file in another folder.

Project Structure Photograph

image

    "xml.fileAssociations": [{
            "systemId": "schema/schema.xsd",
            "pattern": "testFile/*.xml"
        }]
} 

This works as expected, XML files in the testFile folder are checked against the schema document.

But if I instead refer to the files using the ${workspaceFolder} variable built into VS code like this:

    "xml.fileAssociations": [{
            "systemId": "${workspaceFolder}/schema/schema.xsd",
            "pattern": "${workspaceFolder}/testFile/*.xml"
        }]
}

The files are not being checked against the schema, and I do not get any warnings.

Furthermore, if I use windows style file path notation

    "xml.fileAssociations": [{
            "systemId": "schema\\schema.xsd",
            "pattern": "testFile\\*.xml"
        }]
}

I once again find that my XML files are not being checked against the schema file.

Both of these should be supported when configuring settings for the extension. Variable substitution is important for configuring paths in global settings that will change for each workspace, and Windows file path support is necessary to maintain consistency with other options that might be set in the same file.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions