Skip to content

IDE Autocompletion (Schema)

If you use Sourcery in VSCode or JetBrains, you can configure the IDE to use a remote schema to validate your .sourcery.yaml file and help with autocompletion.

See Also

JetBrains - Intellij, PyCharm, ...

  1. Open up the IDE settings management (e.g. click "File" -> "Settings").
  2. In the navigation menu, under "Languages & Frameworks", under "Schemas & DTDs", click "JSON Schema Mappings".
  3. Click the "+" icon to add a new mapping.
  4. Give the new mapping the name "Sourcery YAML Schema".
  5. Provide the URL https://docs.sourcery.ai/resources/sourcery_yaml_schema.json (you can see the schema yourself by following this link).
  6. Click the new "+" icon, and in the dropdown click "File".
  7. In the dialog, type .sourcery.yaml.
  8. Click "Accept" and/or "OK" to close the settings window.

Final settings for the Sourcery YAML JSON Schema Mapping in PyCharm

VSCode

These instructions assume you have the Red Hat YAML extension for VSCode installed.

  1. Open your VSCode settings management (Ctrl+, or Cmd+,).
  2. Search for YAML settings by typing "YAML" into the search dialog.
  3. Scroll until you find the "Yaml: Schemas" setting, and click "Edit in settings.json".
  4. In the "yaml.schemas" field, provide the following key/value: "https://docs.sourcery.ai/resources/sourcery_yaml_schema.json": ".sourcery.yaml"
  5. Save the settings.json file.
settings.json
{
    // additional settings
    "yaml.schemas": {
        "https://docs.sourcery.ai/resources/sourcery_yaml_schema.json": ".sourcery.yaml"
    }
}
Was this page helpful?