I’m sure many have come across this problem because I can’t be the only one.
In Visual Studio code I work with Kubernetes and Azure Devops YAML. Both have complete different formatting. To work with each I find I have to uninstall the others extension.
Has anyone worked out, how to have both together where VSCode can work out when your coding an Azure DevOps pipeline or a Kubernetes cluster?
2
Answers
I did do what @flyx recommended but late yesterday evening and did not post my answer but I am going to do that now.
I worked out the following things.
http://www.schemastore.org/json/composer
if you try to reference them by JSON glob wordsHaving figured out those three things I was able to set up my env, to allow the inteli sense and JSON syntax checker to pull the different needed schemas. I have also found the Google Cloud Code extension for Kubernetes is actually better than the Microsoft one and it picks up a lot quicker that your building a Kubernetes YAML file.
Also for this to work you need to save the file first, with the right extension for VSCode to know you are working on a certain technology and pull down the right Schema. Also, watch out for the .vscode file this sometimes gets a bit silly and does not put the right schema in, so just keep an eye on it. If it fails delete it close VSCode and reopen and you should be good to go.
Here are my JSON settings for anyone that wants to do this:
Extensions used for this:
The extension for Azure Pipelines describes how you can set it up to be used on specific files by setting
"files.associations"
.You can do a similar thing with the extension that supports Kubernetes.
Alternatively, you can exclusively us the latter as it supports custom schemas.
You can find a schema for Azure Pipelines here; register it as schema and set up a glob pattern that matches your Azure files.