How can I get Python's code coloring for Go code in VS code?

huangapple go评论90阅读模式
英文:

How can I get Python's code coloring for Go code in VS code?

问题

我在vs code中使用的是One Dark Pro主题。当我在编写Python文件时,每个元素都有不同的颜色,非常棒。

在Go文件中,与Python着色有很多相似之处(因为我当然还在使用One Dark Pro),例如def和func都是紫色的,但大部分代码都是纯白色的。

似乎是变量,尽管包和结构体字面量也会变成白色。

有没有办法在Go中获得Python的着色效果?

How can I get Python's code coloring for Go code in VS code?

How can I get Python's code coloring for Go code in VS code?

英文:

I use One Dark Pro in vs code. When I'm writing in a python file, everything has a distinct color, it's wonderful.

In a Go file, there are many similarities to the Python coloring (because of course I'm still using One Dark Pro, for example def and func are both purple) but much of the code is in plain white.

It seems to be variables, though packages and struct literals go white as well.

Is there a way to get the Python coloring in Go?

How can I get Python's code coloring for Go code in VS code?

How can I get Python's code coloring for Go code in VS code?

答案1

得分: 1

settings.json文件中进行修改:

// 仅为示例

"editor.tokenColorCustomizations": {
    "[Abyss]": {
        "textMateRules": [
            {
                "scope": "meta.function-call",
                "settings": {
                    "foreground": "#ffffff"
                }
            },
            {
                "scope": "entity.name.type, entity.name.class, entity.name.namespace, entity.name.scope-resolution",
                "settings": {
                    "fontStyle": ""
                }
            }
        ]
    }
},

在编写时使用Ctrl + Space,您将获得更多的配置建议。

英文:

Modify in the settings.json file using:

// Just an example

    "editor.tokenColorCustomizations": {
        "[Abyss]": {
            "textMateRules": [
                {
                    "scope": "meta.function-call",
                    "settings": {
                        "foreground": "#ffffff"
                    }
                },
                {
                    "scope": "entity.name.type, entity.name.class, entity.name.namespace, entity.name.scope-resolution",
                    "settings": {
                        "fontStyle": ""
                    }
                },
            ]
        }
    },

Use Ctrl + Space as you write and you'll get more configuration suggestions to use.

huangapple
  • 本文由 发表于 2022年7月27日 21:29:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/73138855.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定