0

我正在编写一个 TextMate 语法,以使用 Visual Studio Code 扩展 Markdown 语言的语法突出显示功能。预期的结果类似于Fabio 的 vscode-highlight所实现的结果,但我一直在寻找更“简单”的东西,而无需安装或创建扩展。

已经做了很多研究,但在检查范围时找不到任何匹配项。有什么建议么?截至目前,我的文件是:

./package.json
{
    "name": "name123",
    "description": "desc123",
    "publisher": "me",
    "version": "0.0.1",
    "engines": {
        "vscode": "^1.0.0"
    },
    "contributes": {
        "grammars": [{
            "language": "markdown",
            "scopeName": "text.html.markdown",
            "path": "./syntaxes/markdown.tmLanguage.json"
        }]
    }
}
./syntaxes/markdown.tmLanguage.json
{
  "scopeName": "text.html.markdown",
  "patterns": [
    { "include": "#headings" }],
  "repository": {
    "headings": {
      "patterns": [
        { "include": "#symbol" },
        { "include": "#text" }]},
        "symbol": {
          "match": "*s2",
          "name": "symbol.letter.number.headings.md" },
        "text": {
          "match": "Description 12345",
          "name": "text.description.headings.md" }
  }
}
4

1 回答 1

1

markdown文件中,有一个正则表达式错误记录到开发控制台:

ERR target of repeat operator is not specified: Error: target of repeat operator is not specified
    at Object.createOnigScanner (c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\vscode-textmate\release\main.js:58:24)
    at Grammar.createOnigScanner (c:\Program Files\Microsoft VS Code\resources\app\node_modules.asar\vscode-textmate\release\main.js:2466:30)
    [...]

问题是*s2正则表达式。我不确定你到底想在那里匹配什么,但必须有一些应该在之前重复的字符*

您的其他范围与预期匹配,symbol已删除以避免错误:

于 2019-04-13T08:19:55.117 回答