Syntax Highlighting for yaml files

Sure.

  1. Install the YAML plugin in VS Code through Marketplace (Contributor is Red Hat)
  2. For automatic scheme, go to settings - plugins - YAML and open the settings.json for Yaml:Schemas.
    Please be aware that there are a bunch of different options to load settings, i.e. user, folder, workspace and much more I can’t remember :slight_smile: It depends on how you use VS Code which is the right place to configure, so chose wisely.
  3. set the yaml.schemas to look like this:
"yaml.schemas": {
    "https://www.schemastore.org/openhab-5.1.json": [
        "file:///etc/openhab/yaml/**/*.yml",
        "file:///etc/openhab/yaml/**/*.yaml"
    ]
}
  1. If your $OPENHAB_CONF is pointing to another folder than /etc/openhab/, please change the path accordingly.
  2. Check whether json format is still valid (missing comma, etc.)

Try it out by creating a test.yml file in $OPENHAB_CONF/yaml/ or a subfolder of this path.

1 Like