Sushil Jain
Sushil Jain

Reputation: 507

VS Code valid contributes.jsonValidation# fileMatch Pattern

I am writing a VS Code extension, in which, I want all files ending with .xyz to use a particular JSON schema in VS Code extension and for that, I've tried the following combinations under the contribution in package.json:

"jsonValidation": [
            {
                "fileMatch": "/*.xyz",
                "url": "http://127.0.0.1:8080/xyz.schema.json"
            },
            {
                "fileMatch": "/.xyz",
                "url": "http://127.0.0.1:8080/xyz.schema.json"
            },
            {
                "fileMatch": "*.xyz",
                "url": "http://127.0.0.1:8080/xyz.schema.json"
            },
            {
                "fileMatch": ".xyz",
                "url": "http://127.0.0.1:8080/xyz.schema.json"
            },
            {
                "fileMatch": "/xyz",
                "url": "http://127.0.0.1:8080/xyz.schema.json"
            }
        ]

But nothing seems to be working for me. Does anyone has any idea about the correct fileMatch pattern.

Upvotes: 0

Views: 262

Answers (1)

Sushil Jain
Sushil Jain

Reputation: 507

Nevermind, I found the answer with the help of one of my colleagues. Following worked for me:

"jsonValidation": [
            {
                "fileMatch": "/*.xyz",
                "url": "http://127.0.0.1:8080/xyz.schema.json"
            },
            {
                "fileMatch": "*.xyz",
                "url": "http://127.0.0.1:8080/xyz.schema.json"
            },
        ]

Upvotes: 1

Related Questions