VS 代码有效 contributes.jsonValidation# 文件匹配模式

VS Code valid contributes.jsonValidation# fileMatch Pattern

我正在编写一个 VS 代码扩展,其中,我希望所有以 .xyz 结尾的文件在 VS 代码扩展中使用特定的 JSON 模式,为此,我尝试了以下组合贡献 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"
            }
        ]

但似乎没有什么对我有用。有没有人知道正确的 fileMatch 模式。

没关系,我在一位同事的帮助下找到了答案。以下对我有用:

"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"
            },
        ]