go-struct-tag
A Visual Studio Code extension that provides auto-completion for Go struct tags while typing.
It helps you quickly generate Go struct tags with consistent field naming and optional tag options.
Features
The extension provides built-in support for the following tags:
Screenshots
JSON

BSON

XORM

GORM

Requirements
To ensure auto-completion works correctly inside string literals, please enable quick suggestions for strings.
Open the Command Palette (⌘ + ⇧ + P / Ctrl + Shift + P), then select
Preferences: Open Settings (JSON) and add:
"editor.quickSuggestions": {
"strings": true
},
"editor.suggest.showWords": true
Configuration
go-struct-tag.cases
Defines how struct field names are converted when generating tag values.
snake
camel
pascal
constant
none
Default Configuration
"go-struct-tag.cases": [
"snake",
"camel"
]
Allows defining custom struct tags with their own formatting rules and options.
Example:
"go-struct-tag.customTags": {
"customTag1": {
"cases": [
"snake"
],
"options": [
"omitempty",
"string",
"-"
],
"separator": ","
},
"customTag2": {
"cases": []
},
"customTag3": {}
}
Field Descriptions
Custom tag names
customTag1, customTag2, customTag3
cases
Field name formatting for this tag:
- Not set: uses
go-struct-tag.cases
- Empty array (
[]): field name is omitted
options
A list of options appended after the field name.
separator
Separator used between options.
Defaults to , if not specified.
License
MIT