This is a tool that generates a JSON schema for Air configuration files (.air.toml
) based on the source code of Air.
The generated schema can be used with the Even Better Toml VS Code extension for schema-based validation and autocompletion.
Clone the repository, change to the repository directory and run the program:
git clone https://github.com/romamik/go-air-schema-gen
cd go-air-schema-gen
go run .
This will generate the schema in the current directory.
Add the following to your VS Code settings:
"evenBetterToml.schema.associations": {
".*/.air.toml": "file:///full/path/to/golang-air.json"
}
Make sure to replace "file:///full/path/to/golang-air.json"
with the correct file path where the generated "golang-air.json"
is located.
Side Note: There is a slight problem as
".*/.air.toml"
is a regex, so dots match any character and not only dots, as it is intended, but I failed to find a way around this.
Initially I planned to submit it to schemastore, so that it works automatically without extra configuration, but unfortunately there is already a schema that matches with ".air.toml"
filename and I do not see a way around it.