With a PR that I’ve added to snapcraft when merged, you’ll be able to use the defined schema to validate your snapcraft.yaml
files as you write them in Visual Studio Code.
First, you need to install the YAML extension into visual studio. To do that, in Visual Studio Code, type ctrl+p
and then ext install redhat.vscode-yaml
followed by the enter
or return
key.
Next in VSCode type ctrl+shift+p
and then open user settings
followed by enter
. In the new ssettings window click the {}
symbol on the top-right of the window to open the JSON file. At the end of the file add the following code to use the copy of the schema that I have posted onto people.ubuntu.com (if there are entries already present then suffix the last one with a comma and add this snippet below that - it needs to be nested within the outermost {
and }
):
"yaml.schemas": {
"https://people.ubuntu.com/~diddledan/snapcraft-schemas/snapcraft-master.json": "**/snapcraft.yaml"
}
This copy of the schema is from the master
branch so it might include some syntax that is not currently supported by mainline snapcraft.