【问题标题】:VS Code valid contributes.jsonValidation# fileMatch PatternVS Code 有效的contributors.jsonValidation# fileMatch Pattern
【发布时间】:2021-03-26 00:34:53
【问题描述】:

我正在编写一个 VS Code 扩展,其中,我希望所有以 .xyz 结尾的文件都在 VS Code 扩展中使用特定的 JSON 模式,为此,我在 contribution 在 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 模式。

【问题讨论】:

    标签: json regex visual-studio-code vscode-settings vscode-extensions


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2022-12-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-16
      • 2017-11-26
      • 2021-08-29
      • 2022-12-02
      相关资源
      最近更新 更多