TextMate语法在VS Code上没有任何匹配

问题描述 投票:0回答:1

我正在编写TextMate语法,以使用Visual Studio Code扩展Markdown语言的语法突出显示功能。预期的结果类似于Fabio's 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" }
  }
}
visual-studio-code syntax-highlighting textmate vscode-extensions tmlanguage
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时的预期匹配,以避免错误:

© www.soinside.com 2019 - 2024. All rights reserved.