首页 > 解决方案 > VSCode 颜色主题方法调用

问题描述

我正在尝试更改 VSCode 中的方法调用颜色。我知道我可以更改功能范围颜色,如下所示:

{
  "name": "Function call", 
  "scope": "meta.function-call.object", 
  "settings": {
    "foreground": "#e26f60"
  }
}

方法调用是否有等价物。我只想突出显示以下代码中的foo_method ():

class Foo():
    def foo_method(self):
        print("Called Foo from class")

foo_object = Foo()
foo_object.foo_method()

标签: visual-studio-codethemestextmate

解决方案


方法调用的范围foo_method是:

meta.function-call.generic.python
meta.function-call.python
meta.member.access.python
source.python

因此,仅针对方法,请尝试在您的主题中使用更具体的范围选择器。例如,meta.member.access meta.function-call将选择meta.function-call范围下的所有meta.member.access范围:

{
  "name": "Function call", 
  "scope": "meta.member.access meta.function-call",
  "settings": {
    "foreground": "#e26f60"
  }
}

在此处输入图像描述

(您可能需要根据您的具体需求进一步调整范围选择器)


推荐阅读