Visual Studio代码tmlanguage扩展了现有的语言

时间:2018-02-08 16:16:59

标签: visual-studio-code vscode-extensions tmlanguage

我想为VS代码创建语法,扩展TypeScript。

这是我使用tmlanguage.json帮助者创建的yo code

{
    "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
    "name": "mylang",
    "patterns": [{
            "include": "source.ts"
        },
        {
            "include": "#keywords"
        },
        {
            "include": "#strings"
        },
        {
            "include": "#htmlTags"
        }
    ],
    "repository": {
        "keywords": {
            "patterns": [{
                "name": "keyword.control.htmlscript",
                "match": "\\b(if|while|for|return)\\b"
            }]
        },
        "htmlTags": {
            "patterns": [{
                "name": "variable.language",
                "match": "(div|text)"
            }]
        },
        "strings": {
            "name": "string.quoted.double.mylang",
            "begin": "\"",
            "end": "\"",
            "patterns": [{
                "name": "constant.character.escape.mylang",
                "match": "\\\\."
            }]
        }
    },
    "scopeName": "source.mylang"
}

在没有"include": "source.ts"的情况下,我添加了这个包含来显示TypeScript语法。添加后,它只识别TypeScript代码而不是我的代码。

为什么呢?有人做过类似的事吗?

0 个答案:

没有答案