How to add autocompletion for YAML configuration files in your editor

One can use the pyCIF JSON schema to validate pyCIF’s YAML configuration files and add autocompletion features to your text editor if it supports JSON schema for YAML files.

The provided pyCIF JSON schema is available here: pycif_config.schema.json

Add autocompletion to Visual Studio Code (VS Code)

The following instructions apply to VS Code and VS Codium

  • Install the ỲAML extension:

    • Launch VS Code Quick Open (ctrl + P)

    • Paste the following command ext install redhat.vscode-yaml

    • Press enter

  • Add pyCIF JSON schema uri to VS Code settings:

    • Open VS Code settings.json file

      • Launch VS Code Command Palette (ctrl + shift + P)

      • Type open user settings

      • Press enter

    • Add the following entries (adapt the patterns necessary) to settings.json

      "yaml.disableDefaultProperties": true,
      "yaml.schemas": {
          "http://community-inversion.eu/pycif_config.schema.json": [
              "*.yaml",
              "*.yml"
          ]
      },
      
    • Save settings.json

    • Reload VS Code