【问题标题】:How to make vscode to auto detect my customised language如何让 vscode 自动检测我的自定义语言
【发布时间】:2022-07-07 14:54:59
【问题描述】:

我已经为 vscode 创建了一个语言扩展,但是 vscode 语言检测有时会更改为 typescript。有什么办法让vscode识别我自己的新语言。

【问题讨论】:

    标签: vscode-extensions


    【解决方案1】:

    您必须指定如何在包 json 文件中检测您的语言的详细信息。这是 ANTLR4 解析器/词法分析器的示例:

        "contributes": {
            "languages": [
                {
                    "id": "antlr",
                    "aliases": [
                        "ANTLR",
                        "antlr"
                    ],
                    "extensions": [
                        ".g",
                        ".g4"
                    ],
                    "firstLine": "^(lexer|parser)?\\s*grammar\\s*\\w+\\s*;",
                    "configuration": "./antlr.configuration.json"
                }
            ],
    

    您的母语需要类似的东西。

    【讨论】:

      猜你喜欢
      • 2020-07-25
      • 2012-08-27
      • 1970-01-01
      • 1970-01-01
      • 2017-01-06
      • 1970-01-01
      • 1970-01-01
      • 2018-07-13
      • 1970-01-01
      相关资源
      最近更新 更多