If you’re like me, you probably use VS Code to author your Workflows JSON or YAML. You also probably expect some kind syntax validation or auto-completion as you work on your workflow. Unfortunately, there’s no VS Code extension for Workflows and Cloud Code for VS Code does not support Workflows.
However, there’s a way to get partial auto-completion for Workflows in VS Code.
VS Code and JSON Schema
VS Code has the ability to display auto-complete suggestions for JSON and YAML files out of the box. It uses JSON Schema Store which hosts JSON Schemas for popular configuration files in JSON and YAML.
Thanks to Grant Timmerman, Workflows also has its JSON Schema hosted there:
- Hosted: https://json.schemastore.org/workflows.json
- Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/workflows.json
This means that you can get VS Code auto-complete your Workflows files.
Get VS Code recognize Workflows
To get VS Code auto-complete your Workflows files, first, you need a YAML extension for VS Code. I used Redhat YAML extension.
Then, you need to name your workflow as workflows.yaml
or workflows.json
and
voila! Now, you should see auto-complete working for Workflows:
Why is it partial?
Remember, I said partial auto-completion and the reason for that is the Workflows schema is already out of date. It doesn’t have some of the newer syntax. If you’re interested in seeing more syntax supported by the schema, please open issues in our workflows-samples repo and hopefully, we’ll gradually add the full syntax, if there’s enough demand for it.
Feel free to reach out to me on Twitter @meteatamel for any questions/feedback.