如何在Python VS Code中只突出显示函数定义而不突出显示函数调用

ioekq8ef  于 2023-03-28  发布在  Python
关注(0)|答案(1)|浏览(139)

在此图像中,函数定义“planetorbit”被突出显示,然而,“speed”,“resizemode”和“shapesize”也是如此。
有没有办法只突出显示“planetorbit”?
我试过在textMate中使用"scope": "entity.name.function",但这两个都突出显示了。
我的颜色更改设置为:

"editor.semanticHighlighting.enabled" : true,
    "editor.tokenColorCustomizations": {
        "keywords": "#FF8000",
        "comments": "#DD0000",
        "strings": "#02ff02dc",
        "variables": "#FFFFFF",
        "functions": "#FFFFFF",
        "numbers": "#FFFFFF",
        "textMateRules": [
            {"scope": "variable.parameter",
            "settings": {"foreground": "#FFFFFF"}},
            {"scope": "meta",
            "settings": {"foreground": "#FFFFFF"}},
            {"scope": "support.function",
            "settings": {"foreground": "#5e5eff"}},
            {"scope": "keyword.operator",
            "settings": {"foreground": "#FFFFFF"}},
            {"scope": "punctuation.separator",
            "settings": {"foreground": "#FFFFFF"}},
            {"scope": "entity.name.function",
            "settings": {"foreground": "#5E5EFF",}},
            {"scope": "entity.name.function-call",
            "settings": {"foreground": "#FFFFFF",}},
        ]
    },
    "workbench.colorCustomizations": {
        "editor.selectionBackground": "#7E7E7E",
        "editor.background": "#002240",
        "editorBracketHighlight.foreground1": "#FFFFFF",
        "editorBracketHighlight.foreground2": "#FFFFFF",
        "editorBracketHighlight.foreground3": "#FFFFFF",
        
    },
    "workbench.colorTheme": "Abyss",
kb5ga3dv

kb5ga3dv1#

将Seting中的"scope": "entity.name.function-call"替换为scope": "entity.name.function.member",以实现您想要的效果。

{"scope": "entity.name.function.member",
            "settings": {"foreground": "#FFFFFF",}},

  • 或将其添加到entity.name.function-call后面。*
{"scope": "entity.name.function-call,entity.name.function.member",
            "settings": {"foreground": "#FFFFFF",}},
  • 需要注意的是,这样的自定义语法高亮可能总是不尽如人意,因为很多Scope都是重复的。你可能修改了一个范围,得到了你想要的某种效果,但同时,改变另一种类型的效果让你不喜欢。*

相关问题