Highlight golang struct tags according to your theme
Preview
Your theme's default colors


Customization

Install
By default, some VS Code themes use semantic highlighting, which overrides custom struct tag highlighting with a simple string. To use this extension with such themes, you need to disable semantic highlighting for Go files:
Option 1: Disable only for Go
"[go]": {
"editor.semanticHighlighting.enabled": false
}
Option 2: Disable globally
"editor.semanticHighlighting.enabled": false
Add this to your settings.json
(open Command Palette → Preferences: Open Settings (JSON)).
Customizing Colors in User Settings
You can customize the colors for struct tag keys and values using editor.tokenColorCustomizations
in your settings.json
.
Font style

"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "meta.struct-tag.pair.go support.type.property-name.json", // struct tag key
"settings": {
"fontStyle": "bold underline"
}
},
{
"scope": "meta.struct-tag.pair.go punctuation.separator.dictionary.key-value.json", // struct tag separator (colon)
"settings": {
"fontStyle": ""
}
},
{
"scope": "meta.struct-tag.pair.go string.quoted.double.json", // struct tag value
"settings": {
"fontStyle": "italic"
}
}
]
}
Font color

"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "meta.struct-tag.pair.go support.type.property-name.json", // struct tag key
"settings": {
"foreground": "#9876AA",
}
},
{
"scope": "meta.struct-tag.pair.go punctuation.separator.dictionary.key-value.json", // struct tag separator (colon)
"settings": {
"foreground": "#BCBEC4"
}
},
{
"scope": "meta.struct-tag.pair.go string.quoted.double.json", // struct tag value
"settings": {
"foreground": "#6A8759",
}
}
]
}
Font style with color

"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "meta.struct-tag.pair.go support.type.property-name.json", // struct tag key
"settings": {
"foreground": "#9876AA",
"fontStyle": "bold"
}
},
{
"scope": "meta.struct-tag.pair.go punctuation.separator.dictionary.key-value.json", // struct tag separator (colon)
"settings": {
"foreground": "#BCBEC4"
}
},
{
"scope": "meta.struct-tag.pair.go string.quoted.double.json", // struct tag value
"settings": {
"foreground": "#6A8759",
"fontStyle": "italic"
}
}
]
}