TextMate 规则 - ContentName 和包含规则

TextMate rules - ContentName and inclusion of rules

提问人:Moseleyi 提问时间:12/12/2022 更新时间:12/12/2022 访问量:71

问:

我有这个规则,它嵌套在早期的规则中,这些规则工作正常。

"sql_function": {
    "name": "source.custom.sql.function",
    "begin": "(\\w+)(\\()",
    "end": "(\\))",
    "contentName": "source.custom.sql.function.value",
    "beginCaptures": {
        "0": {
            "name": "source.custom.sql.function.name"
        },
        "1": {
            "name": "source.custom.sql.function.scope.start"
        }
    },
    "endCaptures": {
        "0": {
            "name": "source.custom.sql.function.scope.end"
        }
    },
    "patterns": [
        {"include": "#variable"},
        {"include": "#string"},
        {"include": "#number"},
        {"include": "#sql_constant"},
        {"include": "#sql_keyword"},
        {"include": "#sql_keyword_main"},
        {"include": "#sql_keyword_type"},
        {"include": "#operator"},
        {"include": "#sql_function"}
    ]
},

我正在以下行上测试它:

sql: CAST(IF(${TABLE}.attempted_at IS NULL, 0, 1) AS BOOL) ;;

即使在嵌套时也能正确识别这些函数enter image description here

只有模式工作正常,但其余的无法识别。#variable"match": "\\${[^\\}]+}"

例如,我有这样的定义:sql_keyword_type

"match": "(?<!\\w)(BOOL|BOOLEAN|VARCHAR|NUMERIC|DECIMAL|INTEGER|)(?!\\w)"

但它在里面没有被识别,我不知道为什么。#sql_keyword_type'之间没有什么不同,是吗?source.lookml.sql.function.value#variable and

语法 textmate

评论


答: 暂无答案