VS-CODE: 使用 TextMate 高亮实体内的函数

我正在使用以下作用域来高亮 Lua 中的函数,例如 API:MyCustomFunction()

function API:MyCustomFunction()
  --函数体
end
"name": "函数,特殊方法,标点符号",
"scope": [
    "entity.name.function",
    "meta.function-call",
    "variable.function",
    "keyword.other.special-method",
    "punctuation.separator.parameter",
    "punctuation.definition.parameters.begin",
    "punctuation.definition.parameters.end",
],
"settings": {
    "foreground": "#80d254"
}

我可以使用什么语法规则来高亮相同作用域内的函数 E.API:MyCustomFunction()

local E = { ... }
function E.API:MyCustomFunction()
  --函数体
end

它完全忽略了上面的作用域,并更喜欢使用:

"name": "变量,函数",
"scope": [
    "variable",
    "string constant.other.placeholder",
    "support.function.any-method",
],
"settings": {
    "foreground": "#eeeeee"
}

原文链接 https://stackoverflow.com/questions/70681206

点赞